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
|
width = 0
|
||||||
height = len(update_info.split('\n')) * 24
|
height = len(update_info.split('\n')) * 24
|
||||||
for m in update_info.split('\n'):
|
for m in update_info.split('\n'):
|
||||||
if len(m) * 24 > width:
|
if len(m) * 20 > width:
|
||||||
width = len(m) * 24
|
width = len(m) * 17
|
||||||
A = CreateImg(800, height, font_size=20)
|
A = CreateImg(width, height, font_size=20)
|
||||||
A.text((10, 10), update_info)
|
A.text((10, 10), update_info)
|
||||||
A.save(f'{IMAGE_PATH}/update_info.png')
|
A.save(f'{IMAGE_PATH}/update_info.png')
|
||||||
return 200
|
return 200
|
||||||
|
|||||||
@ -7,6 +7,7 @@ from nonebot.adapters.cqhttp import (
|
|||||||
MessageEvent,
|
MessageEvent,
|
||||||
PrivateMessageEvent,
|
PrivateMessageEvent,
|
||||||
GroupMessageEvent,
|
GroupMessageEvent,
|
||||||
|
PokeNotifyEvent
|
||||||
)
|
)
|
||||||
from configs.config import (
|
from configs.config import (
|
||||||
BAN_RESULT,
|
BAN_RESULT,
|
||||||
@ -132,10 +133,10 @@ _flmt_c = FreqLimiter(CHECK_NOTICE_INFO_CD)
|
|||||||
@run_preprocessor
|
@run_preprocessor
|
||||||
async def _(matcher: Matcher, bot: Bot, event: MessageEvent, state: T_State):
|
async def _(matcher: Matcher, bot: Bot, event: MessageEvent, state: T_State):
|
||||||
if (
|
if (
|
||||||
not isinstance(event, MessageEvent)
|
(not isinstance(event, MessageEvent) and matcher.module != "poke")
|
||||||
or await BanUser.is_ban(event.user_id)
|
or await BanUser.is_ban(event.user_id)
|
||||||
or str(event.user_id) in bot.config.superusers
|
or str(event.user_id) in bot.config.superusers
|
||||||
) and matcher.module != "poke":
|
):
|
||||||
return
|
return
|
||||||
module = matcher.module
|
module = matcher.module
|
||||||
if module in admin_plugins_auth.keys() and matcher.priority not in [1, 9]:
|
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:
|
except ActionFailed:
|
||||||
pass
|
pass
|
||||||
raise IgnoredException("权限不足")
|
raise IgnoredException("权限不足")
|
||||||
if module in plugins2info_dict.keys():
|
if module in plugins2info_dict.keys() and matcher.priority not in [1, 9]:
|
||||||
if isinstance(event, GroupMessageEvent):
|
# 戳一戳单独判断
|
||||||
|
if isinstance(event, GroupMessageEvent) or (isinstance(event, PokeNotifyEvent) and event.group_id):
|
||||||
# 群权限
|
# 群权限
|
||||||
if plugins2info_dict[module]["level"] > group_manager.get_group_level(
|
if plugins2info_dict[module]["level"] > group_manager.get_group_level(
|
||||||
str(event.group_id)
|
str(event.group_id)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user