调整管理员信息
This commit is contained in:
@@ -71,7 +71,6 @@ class SystemUpdaterPlugin(MessagePluginInterface):
|
||||
self._commands = plugin_config.get("commands", ["更新系统", "系统更新"])
|
||||
self._shell_path = plugin_config.get("shell_path", "")
|
||||
self.wait_time = plugin_config.get("wait_time", 5)
|
||||
self.admin_wxids = plugin_config.get("admin_wxids", [])
|
||||
self.enable = plugin_config.get("enable", True)
|
||||
|
||||
self.LOG.debug(f"[{self.name}] 插件初始化完成,指令:{self._commands}")
|
||||
@@ -109,11 +108,11 @@ class SystemUpdaterPlugin(MessagePluginInterface):
|
||||
content = str(message.get("content", "")).strip()
|
||||
sender = message.get("sender")
|
||||
roomid = message.get("roomid", "")
|
||||
gbm = message.get("gbm", None)
|
||||
gbm: GroupBotManager = message.get("gbm")
|
||||
|
||||
self.bot: WechatAPIClient = message.get("bot")
|
||||
# 检查权限
|
||||
if self.admin_wxids and sender not in self.admin_wxids:
|
||||
if not self._is_admin(sender):
|
||||
await self.bot.send_text_message((roomid if roomid else sender), "⚠️ 您没有执行此操作的权限",
|
||||
sender)
|
||||
return True, "无权限"
|
||||
@@ -146,7 +145,6 @@ class SystemUpdaterPlugin(MessagePluginInterface):
|
||||
|
||||
return True, "系统更新中"
|
||||
|
||||
|
||||
def _execute_system_update(self):
|
||||
"""执行系统更新操作"""
|
||||
try:
|
||||
@@ -168,6 +166,12 @@ class SystemUpdaterPlugin(MessagePluginInterface):
|
||||
# 捕获其他异常
|
||||
logger.error(f"系统更新失败: {str(e)}")
|
||||
|
||||
def _is_admin(self, user_id: str) -> bool:
|
||||
"""检查用户是否为管理员"""
|
||||
# admin_list 现在是 GroupBotManager 的类属性,可以直接访问
|
||||
admin_list = GroupBotManager.get_admin_list()
|
||||
return user_id in admin_list
|
||||
|
||||
|
||||
# 插件入口点
|
||||
def get_plugin():
|
||||
|
||||
Reference in New Issue
Block a user