Add Allow Bind User Invite Bot

This commit is contained in:
洛水居室 2023-01-23 21:34:13 +08:00
parent 28e0890390
commit 7ab92b630c
No known key found for this signature in database
GPG Key ID: C9DE87DA724B88FC
2 changed files with 10 additions and 0 deletions

View File

@ -21,6 +21,7 @@ dotenv.load_dotenv()
class JoinGroups(str, Enum):
NO_ALLOW = "NO_ALLOW"
ALLOW_AUTH_USER = "ALLOW_AUTH_USER"
ALLOW_USER = "ALLOW_USER"
ALLOW_ALL = "ALLOW_ALL"

View File

@ -71,6 +71,15 @@ class ChatMember(Plugin):
logger.error("获取信息出现错误", exc_info=exc)
else:
quit_status = False
elif config.join_groups == JoinGroups.ALLOW_USER:
try:
await self.user_service.get_user_by_id(user.id)
except UserNotFoundError:
logger.warning("用户 %s[%s] 邀请请求被拒绝", user.full_name, user.id)
except Exception as exc:
logger.error("获取信息出现错误", exc_info=exc)
else:
quit_status = False
elif config.join_groups == JoinGroups.ALLOW_ALL:
quit_status = False
else: