加入功能开启显示指令

This commit is contained in:
liuwei
2025-03-07 17:44:10 +08:00
parent 152bc0a536
commit 1323bb98f3

View File

@@ -56,6 +56,17 @@ class GroupBotManager:
"group_list": set() # 用于缓存 group:list
}
@staticmethod
def display_menu_status(group_id):
"""显示所有功能列表及其在指定群组中的当前状态带emoji"""
menu = []
for feature in Feature:
status = GroupBotManager.get_group_permission(group_id, feature)
status_emoji = "" if status == PermissionStatus.ENABLED else ""
status_str = "启用" if status == PermissionStatus.ENABLED else "关闭"
menu.append(f"{status_emoji} {status_str}-{feature.value}-{feature.description}")
return "\n".join(menu)
@staticmethod
def load_local_cache():
"""从 Redis 加载数据到本地缓存"""
@@ -126,6 +137,10 @@ class GroupBotManager:
if command_str.strip().upper() == "MENU":
return GroupBotManager.display_menu()
# 如果是MENU-STATUS指令返回功能列表及其状态
if command_str.strip().upper() == "MENU-STATUS":
return GroupBotManager.display_menu_status(group_id)
# 如果是GROUP_LIST指令返回 group:list 清单
if command_str.strip().upper() == "GROUP_LIST":
return GroupBotManager.get_group_list()