fix自动处理加好友和加群请求

This commit is contained in:
CMHopeSunshine 2022-05-04 14:59:39 +08:00
parent af6d1fb256
commit 60a665362a

View File

@ -103,12 +103,14 @@ async def addFriend(bot: Bot, event: FriendRequestEvent):
superuser_msg = f'{event.user_id}请求添加派蒙为好友, 验证信息为:{event.comment}' superuser_msg = f'{event.user_id}请求添加派蒙为好友, 验证信息为:{event.comment}'
if config.paimon_add_friend == 1: if config.paimon_add_friend == 1:
superuser_msg += ',已自动同意' superuser_msg += ',已自动同意'
await event.approve() await sleep(random.randint(2, 4))
await event.approve(bot)
await sleep(random.randint(3, 6)) await sleep(random.randint(3, 6))
await bot.send_private_msg(user_id=event.user_id, message=f'旅行者你好呀,这里是小派蒙,发送/help查看帮助哦') await bot.send_private_msg(user_id=event.user_id, message=f'旅行者你好呀,这里是小派蒙,发送/help查看帮助哦')
elif config.paimon_add_friend == 2: elif config.paimon_add_friend == 2:
superuser_msg += ',已自动拒绝' superuser_msg += ',已自动拒绝'
await event.reject() await sleep(random.randint(2, 4))
await event.reject(bot)
else: else:
superuser_msg += ',请主人自行处理哦' superuser_msg += ',请主人自行处理哦'
await bot.send_private_msg(user_id=superuser, message=superuser_msg) await bot.send_private_msg(user_id=superuser, message=superuser_msg)
@ -121,12 +123,14 @@ async def addFriend(bot: Bot, event: GroupRequestEvent):
superuser_msg = f'{event.user_id}邀请派蒙加入群{event.group_id}' superuser_msg = f'{event.user_id}邀请派蒙加入群{event.group_id}'
if config.paimon_add_group == 1 or event.user_id == superuser: if config.paimon_add_group == 1 or event.user_id == superuser:
superuser_msg += ',已自动同意' superuser_msg += ',已自动同意'
await event.approve() await sleep(random.randint(2, 4))
await event.approve(bot)
await sleep(random.randint(3, 6)) await sleep(random.randint(3, 6))
await bot.send_group_msg(group_id=event.group_id, message=f'旅行者们大家好呀,这里是小派蒙,发送/help查看帮助哦') await bot.send_group_msg(group_id=event.group_id, message=f'旅行者们大家好呀,这里是小派蒙,发送/help查看帮助哦')
elif config.paimon_add_group == 2: elif config.paimon_add_group == 2:
superuser_msg += ',已自动拒绝' superuser_msg += ',已自动拒绝'
await event.reject() await sleep(random.randint(2, 4))
await event.reject(bot)
else: else:
superuser_msg += ',请主人自行处理哦' superuser_msg += ',请主人自行处理哦'
await bot.send_private_msg(user_id=superuser, message=superuser_msg) await bot.send_private_msg(user_id=superuser, message=superuser_msg)