mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-15 14:22:55 +08:00
update hook
This commit is contained in:
parent
f87c14595f
commit
8090ebe8ce
@ -94,9 +94,9 @@ async def check_update(bot: Bot) -> int:
|
||||
width = 0
|
||||
height = len(update_info.split('\n')) * 24
|
||||
for m in update_info.split('\n'):
|
||||
if len(m) * 24 > width:
|
||||
width = len(m) * 24
|
||||
A = CreateImg(800, height, font_size=20)
|
||||
if len(m) * 20 > width:
|
||||
width = len(m) * 17
|
||||
A = CreateImg(width, height, font_size=20)
|
||||
A.text((10, 10), update_info)
|
||||
A.save(f'{IMAGE_PATH}/update_info.png')
|
||||
return 200
|
||||
|
||||
@ -7,6 +7,7 @@ from nonebot.adapters.cqhttp import (
|
||||
MessageEvent,
|
||||
PrivateMessageEvent,
|
||||
GroupMessageEvent,
|
||||
PokeNotifyEvent
|
||||
)
|
||||
from configs.config import (
|
||||
BAN_RESULT,
|
||||
@ -132,10 +133,10 @@ _flmt_c = FreqLimiter(CHECK_NOTICE_INFO_CD)
|
||||
@run_preprocessor
|
||||
async def _(matcher: Matcher, bot: Bot, event: MessageEvent, state: T_State):
|
||||
if (
|
||||
not isinstance(event, MessageEvent)
|
||||
(not isinstance(event, MessageEvent) and matcher.module != "poke")
|
||||
or await BanUser.is_ban(event.user_id)
|
||||
or str(event.user_id) in bot.config.superusers
|
||||
) and matcher.module != "poke":
|
||||
):
|
||||
return
|
||||
module = matcher.module
|
||||
if module in admin_plugins_auth.keys() and matcher.priority not in [1, 9]:
|
||||
@ -167,8 +168,9 @@ async def _(matcher: Matcher, bot: Bot, event: MessageEvent, state: T_State):
|
||||
except ActionFailed:
|
||||
pass
|
||||
raise IgnoredException("权限不足")
|
||||
if module in plugins2info_dict.keys():
|
||||
if isinstance(event, GroupMessageEvent):
|
||||
if module in plugins2info_dict.keys() and matcher.priority not in [1, 9]:
|
||||
# 戳一戳单独判断
|
||||
if isinstance(event, GroupMessageEvent) or (isinstance(event, PokeNotifyEvent) and event.group_id):
|
||||
# 群权限
|
||||
if plugins2info_dict[module]["level"] > group_manager.get_group_level(
|
||||
str(event.group_id)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user