mirror of
https://github.com/suyiiyii/nonebot-bison.git
synced 2025-06-02 09:26:12 +08:00
fix auto_agree
This commit is contained in:
parent
771d44860b
commit
751331262c
@ -3,18 +3,16 @@ from nonebot.adapters.cqhttp import Bot, Event
|
||||
from nonebot.permission import SUPERUSER
|
||||
from nonebot.typing import T_State
|
||||
from nonebot.adapters.cqhttp.permission import PRIVATE_FRIEND
|
||||
from nonebot.adapters.cqhttp.event import FriendRequestEvent, GroupRequestEvent
|
||||
from nonebot.adapters.cqhttp.event import FriendRequestEvent, GroupRequestEvent, RequestEvent
|
||||
|
||||
friend_req = on_request(priority=5)
|
||||
|
||||
@friend_req.handle()
|
||||
async def add_superuser(bot: Bot, event: FriendRequestEvent, state: T_State):
|
||||
if event.user_id in bot.config.superusers:
|
||||
async def add_superuser(bot: Bot, event: RequestEvent, state: T_State):
|
||||
if event.user_id in bot.config.superusers and event.request_type == 'private':
|
||||
await event.approve(bot)
|
||||
logger.info('add user {}'.format(event.user_id))
|
||||
|
||||
@friend_req.handle()
|
||||
async def agree_to_group(bot: Bot, event: GroupRequestEvent, state: T_State):
|
||||
if event.sub_type == 'invite' and event.user_id in bot.config.superusers:
|
||||
elif event.sub_type == 'invite' and event.user_id in bot.config.superusers and event.request_type == 'group':
|
||||
await event.approve(bot)
|
||||
logger.info('add group {}'.format(event.group_id))
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user