diff --git a/core/config.py b/core/config.py index 9724ffb2..9c928d8d 100644 --- a/core/config.py +++ b/core/config.py @@ -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" diff --git a/plugins/system/chat_member.py b/plugins/system/chat_member.py index 0e24d2f8..feab54c2 100644 --- a/plugins/system/chat_member.py +++ b/plugins/system/chat_member.py @@ -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: