mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-15 06:12:53 +08:00
update 0.1.4.3
This commit is contained in:
parent
0eb9f9fc6f
commit
067da9dc57
@ -236,6 +236,10 @@ __Docker 最新版本由 [Sakuracio](https://github.com/Sakuracio) 提供__
|
||||
|
||||
## 更新
|
||||
|
||||
### 2022/3/3 \[v0.1.4.3]
|
||||
|
||||
* 修复手动同意群聊请求依旧退出
|
||||
|
||||
### 2022/3/1 \[v0.1.4.2]
|
||||
|
||||
* 0.1.4内容
|
||||
|
||||
@ -1 +1 @@
|
||||
__version__: v0.1.4.2
|
||||
__version__: v0.1.4.3
|
||||
@ -14,10 +14,20 @@ async def handle_api_call(bot: Bot, api: str, data: Dict[str, Any]):
|
||||
or api == "send_group_msg"
|
||||
)
|
||||
and (
|
||||
(r := re.search("^\[\[_task\|(.*)]]", str(data["message"]["text"]).strip()))
|
||||
(
|
||||
r := re.search(
|
||||
"^\[\[_task\|(.*)]]",
|
||||
data["message"].strip()
|
||||
if isinstance(data["message"], str)
|
||||
else str(data["message"]["text"]).strip(),
|
||||
)
|
||||
)
|
||||
or (
|
||||
r := re.search(
|
||||
"^[[_task\|(.*)]]", str(data["message"]["text"]).strip()
|
||||
"^[[_task\|(.*)]]",
|
||||
data["message"].strip()
|
||||
if isinstance(data["message"], str)
|
||||
else str(data["message"]["text"]).strip(),
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
@ -102,7 +102,7 @@ async def _(bot: Bot, cmd: Tuple[str, ...] = Command(), arg: Message = CommandAr
|
||||
if is_number(id_):
|
||||
id_ = int(id_)
|
||||
if cmd[:2] == "同意":
|
||||
rid = await requests_manager.approve(bot, id_, "group")
|
||||
rid = requests_manager.get_group_id(id_)
|
||||
if rid:
|
||||
await friend_handle.send("同意群聊请求成功..")
|
||||
if await GroupInfo.get_group_info(rid):
|
||||
@ -116,6 +116,7 @@ async def _(bot: Bot, cmd: Tuple[str, ...] = Command(), arg: Message = CommandAr
|
||||
group_info["member_count"],
|
||||
1
|
||||
)
|
||||
await requests_manager.approve(bot, id_, "group")
|
||||
else:
|
||||
await friend_handle.send("同意群聊请求失败,可能是未找到此id的请求..")
|
||||
else:
|
||||
|
||||
@ -132,4 +132,4 @@ async def get_fudu_img_hash(url, group_id):
|
||||
logger.warning(f"复读下载图片失败...")
|
||||
except Exception as e:
|
||||
logger.warning(f"复读读取图片Hash出错 {type(e)}:{e}")
|
||||
return ""
|
||||
return ""
|
||||
|
||||
@ -5,6 +5,7 @@ from apscheduler.jobstores.base import ConflictingIdError
|
||||
from nonebot import Driver
|
||||
from .._models import Genshin
|
||||
from datetime import datetime, timedelta
|
||||
from apscheduler.jobstores.base import JobLookupError
|
||||
from services.log import logger
|
||||
from nonebot.plugin import require
|
||||
from configs.config import Config
|
||||
@ -108,6 +109,11 @@ async def _():
|
||||
|
||||
|
||||
def add_job(user_id: int, uid: int):
|
||||
# 移除
|
||||
try:
|
||||
scheduler.remove_job(f"genshin_resin_remind_{uid}_{user_id}")
|
||||
except JobLookupError:
|
||||
pass
|
||||
date = datetime.now(pytz.timezone("Asia/Shanghai")) + timedelta(seconds=30)
|
||||
try:
|
||||
scheduler.add_job(
|
||||
|
||||
@ -75,6 +75,13 @@ class RequestManager(StaticData):
|
||||
break
|
||||
self.save()
|
||||
|
||||
def get_group_id(self, id_: int) -> Optional[int]:
|
||||
"""
|
||||
通过id获取群号
|
||||
:param id_: id
|
||||
"""
|
||||
return self._data["group"].get(id_)
|
||||
|
||||
async def approve(self, bot: Bot, id_: int, type_: str) -> Optional[int]:
|
||||
"""
|
||||
同意请求
|
||||
|
||||
Loading…
Reference in New Issue
Block a user