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:
@@ -20,7 +20,7 @@ __plugin_meta__ = {
|
||||
|
||||
|
||||
@matcher.command("admin", permission=MessageEvent.ADMIN)
|
||||
async def handle_admin_command(bot: Bot, event: MessageEvent, args: list[str]):
|
||||
async def admin_command_handler(bot: Bot, event: MessageEvent, args: list[str]):
|
||||
"""
|
||||
处理 /admin 指令
|
||||
|
||||
@@ -40,8 +40,8 @@ async def handle_admin_command(bot: Bot, event: MessageEvent, args: list[str]):
|
||||
await event.reply("当前没有设置任何管理员。")
|
||||
return
|
||||
|
||||
admin_list_str = "\n".join(str(admin_id) for admin_id in admins)
|
||||
await event.reply(f"当前管理员列表 ({len(admins)}):\n{admin_list_str}")
|
||||
admin_list_text = "\n".join(str(admin_id) for admin_id in admins)
|
||||
await event.reply(f"当前管理员列表 ({len(admins)}):\n{admin_list_text}")
|
||||
return
|
||||
|
||||
if action in ("add", "remove"):
|
||||
|
||||
Reference in New Issue
Block a user