优化admin 内容

This commit is contained in:
liuwei
2026-01-16 16:31:46 +08:00
parent fb186096f3
commit 41535bda65

View File

@@ -250,15 +250,19 @@ class GroupBotManager:
# 如果第一个参数是序号,则转化为对应的功能
if feature_str.isdigit():
feature_num = int(feature_str)
try:
feature = Feature(feature_num, "") # 使用枚举序号查找功能
except ValueError:
return "无效的功能序号"
# 通过遍历查找匹配的枚举值
feature = None
for f in Feature:
if f.value == feature_num:
feature = f
break
if not feature:
return f"无效的功能序号: {feature_num}"
else:
try:
feature = Feature[feature_str] # 通过枚举名称获取功能枚举
except KeyError:
return "无效功能名称"
return f"无效功能名称: {feature_str}"
r = get_redis_connection()
# 处理群机器人的启用和关闭(特别操作:更新 group:list