加入验证判断逻辑,以为是true,结果是文本。导致所有群都收到了消息

This commit is contained in:
liuwei
2025-02-17 15:34:13 +08:00
parent cceecc21fc
commit dc5be6c728
2 changed files with 30 additions and 17 deletions

View File

@@ -100,6 +100,14 @@ class GroupBotManager:
else:
return PermissionStatus.DISABLED
@staticmethod
def check_permission(group_id, feature: Feature):
"""检查某个功能是否启用,若未启用则返回提示信息"""
status = GroupBotManager.get_group_permission(group_id, feature)
if status == PermissionStatus.DISABLED:
return f"该功能未启用,请开启 {feature.description}"
return None # 如果已启用,则返回 None不做处理
@staticmethod
def handle_command(group_id, command_str):
"""统一处理群功能指令"""
@@ -246,6 +254,7 @@ def simulate_commands():
# 保存到 Redis
GroupBotManager.save_to_redis()
if __name__ == '__main__':
# 执行模拟命令
simulate_commands()