From 7a39a9d45e4613b064ffe6bbc34c134fdc184258 Mon Sep 17 00:00:00 2001 From: Soulter <37870767+Soulter@users.noreply.github.com> Date: Thu, 1 Jun 2023 22:09:51 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20nick=E6=8C=87=E4=BB=A4=E4=BB=85?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E8=80=85=E8=83=BD=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- model/command/command.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/model/command/command.py b/model/command/command.py index 4ee83f265..b40d313a2 100644 --- a/model/command/command.py +++ b/model/command/command.py @@ -53,7 +53,7 @@ class Command: gu.log(f"{k}插件加载出现问题,原因: {str(e)}\n已安装插件: {cached_plugins.keys}\n如果你没有相关装插件的想法, 请直接忽略此报错, 不影响其他功能的运行。", level=gu.LEVEL_WARNING) if self.command_start_with(message, "nick"): - return True, self.set_nick(message, platform) + return True, self.set_nick(message, platform, role) if self.command_start_with(message, "plugin"): return True, self.plugin_oper(message, role, cached_plugins, platform) @@ -111,6 +111,7 @@ class Command: "info": info } except BaseException as e: + raise e fail_rec += f"加载{p}插件出现问题,原因{str(e)}\n" if fail_rec == "": return True, None @@ -249,7 +250,9 @@ class Command: ''' nick: 存储机器人的昵称 ''' - def set_nick(self, message: str, platform: str): + def set_nick(self, message: str, platform: str, role: str = "member"): + if role != "admin": + return True, "你无权使用该指令 :P", "nick" if platform == PLATFORM_GOCQ: l = message.split(" ") if len(l) == 1: