feature:加入插件管理插件,用于通过指令管理插件的装载等操作。
This commit is contained in:
@@ -6,6 +6,8 @@
|
||||
# 3.群AI能力 #启用群AI #关闭群AI
|
||||
# 4.群总结能力 #启用群总结 #关闭群总结
|
||||
# 5.sehuatang PDF能力 #启用pdf #关闭pdf
|
||||
from typing import List
|
||||
|
||||
import redis
|
||||
import json
|
||||
from enum import Enum
|
||||
@@ -147,12 +149,12 @@ class GroupBotManager:
|
||||
# 如果是GROUP_LIST指令,返回 group:list 清单
|
||||
if command_str.strip().upper() == "群列表":
|
||||
return GroupBotManager.get_group_list()
|
||||
|
||||
|
||||
# 如果是清除群指令
|
||||
if command_str.strip().startswith("清除群-"):
|
||||
target_group_id = command_str.strip().split("-")[1]
|
||||
return GroupBotManager.remove_group(target_group_id)
|
||||
|
||||
|
||||
if len(command_parts) < 2:
|
||||
return None
|
||||
|
||||
@@ -241,18 +243,40 @@ class GroupBotManager:
|
||||
# 检查群是否在列表中
|
||||
if group_id not in GroupBotManager.local_cache["group_list"]:
|
||||
return f"群 {group_id} 不在机器人管理列表中"
|
||||
|
||||
|
||||
# 从本地缓存中移除群组
|
||||
GroupBotManager.local_cache["group_list"].remove(group_id)
|
||||
if group_id in GroupBotManager.local_cache["group_permissions"]:
|
||||
del GroupBotManager.local_cache["group_permissions"][group_id]
|
||||
|
||||
|
||||
# 从Redis中移除群组
|
||||
r.srem("group:list", group_id)
|
||||
r.delete(f'group:{group_id}:permissions')
|
||||
|
||||
|
||||
return f"已成功清除群 {group_id} 的所有设置"
|
||||
|
||||
@staticmethod
|
||||
def get_admin_list() -> List[str]:
|
||||
"""获取管理员列表
|
||||
|
||||
返回系统管理员的微信ID列表
|
||||
"""
|
||||
# 从配置文件中获取管理员列表
|
||||
config_admin_list = [] # self.config.get("admin_list", [])
|
||||
|
||||
# 手动添加的管理员ID列表
|
||||
manual_admin_list = [
|
||||
"Jyunere", # 示例ID,请替换为实际的微信ID
|
||||
"wxid_abcdef", # 示例ID,请替换为实际的微信ID
|
||||
"filehelper" # 文件传输助手,方便自己测试
|
||||
]
|
||||
|
||||
# 合并所有管理员列表并去重
|
||||
all_admin_list = list(set(config_admin_list + manual_admin_list))
|
||||
|
||||
return all_admin_list
|
||||
|
||||
|
||||
# 示例命令
|
||||
def simulate_commands():
|
||||
# 加载本地缓存
|
||||
|
||||
Reference in New Issue
Block a user