From 266e7f695fa9c24b09f02fc749e8b4069d4c89f0 Mon Sep 17 00:00:00 2001 From: ClovertaTheTrilobita Date: Sat, 25 Jan 2025 20:49:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=B4=E6=97=B6=E4=BF=AE=E5=A4=8D=E7=A7=81?= =?UTF-8?q?=E8=81=8Aai=E7=9B=B8=E5=85=B3=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/qq_plugins/chat.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/qq_plugins/chat.py b/src/qq_plugins/chat.py index 644954a..eabee42 100644 --- a/src/qq_plugins/chat.py +++ b/src/qq_plugins/chat.py @@ -19,6 +19,8 @@ with open(os.getcwd() + '/src/ai_chat/config/chat_ai.yaml', 'r', encoding='utf-8 t1 = on_command("管理员注册", rule=to_me(), priority=10, block=True) @t1.handle() async def handle_function(message: MessageEvent): + if not hasattr(message, 'group_openid'): + await t1.finish("暂未在当前场景下开放此功能。") member_openid, group_openid = message.author.id, message.group_openid password = message.get_plaintext().replace("/管理员注册", "").strip() @@ -33,6 +35,9 @@ t3 = on_command("开启ai",aliases={"关闭ai"},rule=to_me(),priority=10,block=T @t3.handle() async def handle_function(message: MessageEvent): + if not hasattr(message, 'group_openid'): + await t3.finish("暂未在当前场景下开放此功能。") + member_openid, group_openid, content = message.author.id, message.group_openid, message.get_plaintext() # 判断是否为管理员 if not await GroupChatRole.get_admin_list(group_openid, member_openid): @@ -55,6 +60,9 @@ tt = on_command("角色列表", rule=to_me(), priority=10, block=True) @tt.handle() async def handle_function(message: MessageEvent): + if not hasattr(message, 'group_openid'): + await tt.finish("暂未在当前场景下开放此功能。") + member_openid, group_openid = message.author.id, message.group_openid if not await GroupChatRole.get_admin_list(group_openid, member_openid): await tt.finish("您没有权限使用此功能。") @@ -69,6 +77,9 @@ t2 = on_command("添加人设",aliases={"更新人设","删除人设","切换人 @t2.handle() async def handle_function(message: MessageEvent): + if not hasattr(message, 'group_openid'): + await t3.finish("暂未在当前场景下开放此功能。") + member_openid, group_openid = message.author.id, message.group_openid if not await GroupChatRole.get_admin_list(group_openid, member_openid): await t2.finish("您没有权限使用此功能。")