update check

This commit is contained in:
hibiki 2021-08-18 01:47:21 +08:00
parent fc34cd541a
commit 0dced0bc90
2 changed files with 4 additions and 4 deletions

View File

@ -53,9 +53,7 @@ async def _(bot: Bot, event: MessageEvent, state: T_State):
change_group_switch(_cmd, int(block_type), True) change_group_switch(_cmd, int(block_type), True)
group_name = (await bot.get_group_info(group_id=int(block_type)))['group_name'] group_name = (await bot.get_group_info(group_id=int(block_type)))['group_name']
await switch_rule.send(f'已禁用群聊 {group_name}({block_type}) 的 {_cmd[2:]} 功能') await switch_rule.send(f'已禁用群聊 {group_name}({block_type}) 的 {_cmd[2:]} 功能')
else: elif block_type in ['all', 'private', 'group', 'a', 'p', 'g']:
if block_type not in ['all', 'private', 'group', 'a', 'p', 'g']:
block_type = 'all'
block_type = 'all' if block_type == 'a' else block_type block_type = 'all' if block_type == 'a' else block_type
block_type = 'private' if block_type == 'p' else block_type block_type = 'private' if block_type == 'p' else block_type
block_type = 'group' if block_type == 'g' else block_type block_type = 'group' if block_type == 'g' else block_type
@ -66,6 +64,8 @@ async def _(bot: Bot, event: MessageEvent, state: T_State):
await switch_rule.send(f'已在私聊中{_cmd[:2]}功能:{_cmd[2:]}') await switch_rule.send(f'已在私聊中{_cmd[:2]}功能:{_cmd[2:]}')
else: else:
await switch_rule.send(f'已在群聊中{_cmd[:2]}功能:{_cmd[2:]}') await switch_rule.send(f'已在群聊中{_cmd[:2]}功能:{_cmd[2:]}')
else:
await switch_rule.finish('格式错误:关闭[功能] [group]/[p/g]')
logger.info( logger.info(
f'USER {event.user_id} 使用功能管理命令 {state["_prefix"]["raw_command"]} | {block_type}' f'USER {event.user_id} 使用功能管理命令 {state["_prefix"]["raw_command"]} | {block_type}'
) )

View File

@ -95,7 +95,7 @@ async def check_update(bot: Bot) -> int:
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) * 20 > width: if len(m) * 20 > width:
width = len(m) * 24 width = len(m) * 18
A = CreateImg(width, 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')