mirror of
https://github.com/xuthus83/LittlePaimon.git
synced 2024-12-16 13:40:53 +08:00
🐛 修复入群欢迎
问题
This commit is contained in:
parent
8c711b4302
commit
eba4c0ee89
@ -70,8 +70,8 @@ async def _(event: PrivateMessageEvent, state: T_State, match: dict = RegexDict(
|
||||
|
||||
@manage_cmd.got('bool')
|
||||
async def _(state: T_State):
|
||||
if not state['group'] and state['user']:
|
||||
await manage_cmd.finish('用法:ban|unban 插件名 -g 群号列表 -u 用户列表', at_sender=True)
|
||||
if not state['group'] and not state['user']:
|
||||
await manage_cmd.finish('用法:pm ban|unban 插件名 -g 群号列表 -u 用户列表', at_sender=True)
|
||||
if state['session_id'] in cache_help:
|
||||
del cache_help[state['session_id']]
|
||||
if not state['plugin'] and state['plugin_no_exist']:
|
||||
|
@ -7,9 +7,10 @@ from nonebot import on_command, on_regex, on_notice, on_request
|
||||
from nonebot.rule import Rule
|
||||
from nonebot.permission import SUPERUSER
|
||||
from nonebot.params import CommandArg, ArgPlainText, RegexDict
|
||||
from nonebot.adapters.onebot.v11 import Bot, Message, MessageEvent, PrivateMessageEvent, FriendRequestEvent, GroupRequestEvent, \
|
||||
from nonebot.adapters.onebot.v11 import Bot, Message, MessageEvent, PrivateMessageEvent, FriendRequestEvent, \
|
||||
GroupRequestEvent, \
|
||||
RequestEvent, NoticeEvent, \
|
||||
GroupIncreaseNoticeEvent, FriendAddNoticeEvent
|
||||
GroupIncreaseNoticeEvent, FriendAddNoticeEvent, GroupMessageEvent
|
||||
from nonebot.typing import T_State
|
||||
|
||||
from LittlePaimon import NICKNAME, SUPERUSERS
|
||||
@ -174,21 +175,24 @@ async def _(event: MessageEvent, msg: Message = CommandArg()):
|
||||
target = ['全部']
|
||||
else:
|
||||
try:
|
||||
target = list(map(int, target))
|
||||
target = list(map(int, target.split(' ')))
|
||||
except Exception:
|
||||
await ban_greet.finish('请发送正确的要关闭入群欢迎的群号或者"全部"')
|
||||
await ban_greet.finish(f'请发送正确的要{"启用" if type else "禁用"}入群欢迎的群号或者"全部"')
|
||||
if not target:
|
||||
target = [event.group_id]
|
||||
if isinstance(event, GroupMessageEvent):
|
||||
target = [event.group_id]
|
||||
else:
|
||||
await ban_greet.finish(f'请发送正确的要{"启用" if type else "禁用"}入群欢迎的群号或者"全部"')
|
||||
for t in target:
|
||||
if t == '全部':
|
||||
config.group_ban = ['全部'] if type else []
|
||||
config.group_ban = [] if type else ['全部']
|
||||
elif not type:
|
||||
if t not in config.group_ban:
|
||||
config.group_ban.append(t)
|
||||
elif t in config.group_ban:
|
||||
config.group_ban.remove(t)
|
||||
config.save()
|
||||
await ban_greet.finish(f'已{"启用" if type else "禁用"}群{" ".join(target)}的群欢迎')
|
||||
await ban_greet.finish(f'已{"启用" if type else "禁用"}群{" ".join(map(str, target))}的群欢迎')
|
||||
|
||||
|
||||
@scheduler.scheduled_job('cron', hour='*/1')
|
||||
|
@ -332,12 +332,11 @@ async def bbs_auto_coin():
|
||||
|
||||
for group_id, result_list in coin_result_group.items():
|
||||
result_num = len(result_list)
|
||||
result_fail = len([result for result in result_list if not result['result']])
|
||||
if result_fail:
|
||||
msg = f'本群米游币自动获取共{result_num}个任务,已全部完成'
|
||||
else:
|
||||
if result_fail := len([result for result in result_list if not result['result']]):
|
||||
fails = '\n'.join(result['uid'] for result in result_list if not result['result'])
|
||||
msg = f'本群米游币自动获取共{result_num}个任务,其中成功{result_num - result_fail}个,失败{result_fail}个,失败的UID列表:\n{fails}'
|
||||
else:
|
||||
msg = f'本群米游币自动获取共{result_num}个任务,已全部完成'
|
||||
try:
|
||||
await get_bot().send_group_msg(group_id=int(group_id), message=msg)
|
||||
except Exception as e:
|
||||
|
@ -63,12 +63,11 @@ async def _():
|
||||
|
||||
for group_id, result_list in result_list['group'].items():
|
||||
result_num = len(result_list)
|
||||
result_fail = len([result for result in result_list if not result['result']])
|
||||
if result_fail:
|
||||
msg = f'本群云原神自动签到共{result_num}个任务,已全部完成'
|
||||
else:
|
||||
if result_fail := len([result for result in result_list if not result['result']]):
|
||||
fails = '\n'.join(result['uid'] for result in result_list if not result['result'])
|
||||
msg = f'本群云原神自动签到共{result_num}个任务,其中成功{result_num - result_fail}个,失败{result_fail}个,失败的UID列表:\n{fails}'
|
||||
else:
|
||||
msg = f'本群云原神自动签到共{result_num}个任务,已全部完成'
|
||||
try:
|
||||
await get_bot().send_group_msg(group_id=int(group_id), message=msg)
|
||||
except Exception as e:
|
||||
|
Loading…
x
Reference in New Issue
Block a user