refactor: 统一变量命名并优化代码结构

- 将函数名从 handle_admin_command 改为 admin_command_handler 以保持命名一致性
- 将变量名 comm_prefixes 改为 command_prefixes 以提高可读性
- 重命名 full_cmd 为 command_parts 和 cmd_name 为 command_name 以明确用途
- 简化 WebSocket 相关代码,移除未使用的导入
- 优化 main.py 中的初始化逻辑和变量命名
This commit is contained in:
2026-01-07 23:02:15 +08:00
parent 56b1014419
commit c3b3541694
5 changed files with 39 additions and 41 deletions

View File

@@ -116,15 +116,15 @@ class MessageHandler(BaseHandler):
if not prefix_found:
return
full_cmd = raw_text[len(prefix_found):].split()
if not full_cmd:
command_parts = raw_text[len(prefix_found):].split()
if not command_parts:
return
cmd_name = full_cmd[0]
args = full_cmd[1:]
command_name = command_parts[0]
args = command_parts[1:]
if cmd_name in self.commands:
command_info = self.commands[cmd_name]
if command_name in self.commands:
command_info = self.commands[command_name]
func = command_info["func"]
permission = command_info.get("permission")
override_check = command_info.get("override_permission_check", False)