From 6b4b52f3c502dbd8570ddd599eb63fe202362d6e Mon Sep 17 00:00:00 2001 From: Soulter <37870767+Soulter@users.noreply.github.com> Date: Thu, 11 May 2023 22:56:38 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E5=AE=8C=E5=96=84=E8=BA=AB=E4=BB=BD?= =?UTF-8?q?=E7=BB=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cores/qqbot/core.py | 7 ++++++- model/command/command.py | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/cores/qqbot/core.py b/cores/qqbot/core.py index b2798a758..5343bdc04 100644 --- a/cores/qqbot/core.py +++ b/cores/qqbot/core.py @@ -465,8 +465,13 @@ def oper_msg(message, group=False, msg_ref = None, platform = None): else: qq_msg = message.message[0].text session_id = message.user_id - # todo: 暂时将所有人设为管理员 role = "admin" + if "sender" in message: + if message.sender.role == "owner": + role = "admin" + else: + role = message.sender.role + print("[GOCQ-BOT] 消息身份:"+ role) if qq_msg == "": send_message(platform, message, f"Hi~", msg_ref=msg_ref, gocq_loop=gocq_loop, qqchannel_bot=qqchannel_bot, gocq_bot=gocq_bot) diff --git a/model/command/command.py b/model/command/command.py index 151c97b65..782102d29 100644 --- a/model/command/command.py +++ b/model/command/command.py @@ -53,6 +53,8 @@ class Command: 插件指令 ''' def plugin_oper(self, message: str, role: str): + if role != "admin": + return False, f"你的身份组{role}没有权限操作插件", "plugin" l = message.split(" ") if len(l) < 3: return True, "【安装插件】示例:\n安装插件: \nplugin i 插件Github地址\n卸载插件: \nplugin i 插件名", "plugin"