调整管理员信息

This commit is contained in:
liuwei
2026-01-19 14:15:46 +08:00
parent 9ca6123891
commit d3d48b0821
3 changed files with 9 additions and 14 deletions

View File

@@ -203,7 +203,7 @@ class RobotMenuPlugin(MessagePluginInterface):
# 格式:菜单 启用 功能名 或 菜单 关闭 功能名
if len(parts) >= 3 and parts[1] in ["启用", "关闭"]:
# 检查管理员权限
if not self._is_admin(sender):
if not GroupBotManager.is_admin(sender):
await bot.send_at_message(target, "❌权限不足,只有管理员可以管理功能", [sender])
return True, "权限不足"
@@ -252,9 +252,3 @@ class RobotMenuPlugin(MessagePluginInterface):
import traceback
self.LOG.error(traceback.format_exc())
return False, f"处理出错: {e}"
def _is_admin(self, user_id: str) -> bool:
"""检查用户是否为管理员"""
# admin_list 现在是 GroupBotManager 的类属性,可以直接访问
admin_list = GroupBotManager.get_admin_list()
return user_id in admin_list

View File

@@ -112,7 +112,7 @@ class SystemUpdaterPlugin(MessagePluginInterface):
self.bot: WechatAPIClient = message.get("bot")
# 检查权限
if not self._is_admin(sender):
if not GroupBotManager.is_admin(sender):
await self.bot.send_text_message((roomid if roomid else sender), "⚠️ 您没有执行此操作的权限",
sender)
return True, "无权限"
@@ -166,12 +166,6 @@ 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():

View File

@@ -347,6 +347,13 @@ class GroupBotManager:
"""
return GroupBotManager.admin_list
@staticmethod
def is_admin(user_id: str) -> bool:
"""检查用户是否为管理员"""
# admin_list 现在是 GroupBotManager 的类属性,可以直接访问
admin_list = GroupBotManager.get_admin_list()
return user_id in admin_list
# 示例命令
def simulate_commands():