Skip to content

Commit

Permalink
update 0.1.4.3
Browse files Browse the repository at this point in the history
  • Loading branch information
HibiKier committed Mar 2, 2022
1 parent 0eb9f9f commit 067da9d
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 5 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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内容
Expand Down
2 changes: 1 addition & 1 deletion __version__
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__: v0.1.4.2
__version__: v0.1.4.3
14 changes: 12 additions & 2 deletions basic_plugins/hooks/task_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
)
)
)
Expand Down
3 changes: 2 additions & 1 deletion basic_plugins/super_cmd/bot_friend_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion plugins/fudu.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
6 changes: 6 additions & 0 deletions plugins/genshin/query_user/resin_remind/init_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
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
Expand Down Expand Up @@ -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(
Expand Down
7 changes: 7 additions & 0 deletions utils/manager/requests_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@ def remove_request(self, type_: str, id_: int):
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]:
"""
同意请求
Expand Down

0 comments on commit 067da9d

Please sign in to comment.