优化代码,删除无效代码
This commit is contained in:
@@ -4,7 +4,6 @@ from typing import Dict, Any, List, Optional, Tuple
|
||||
|
||||
from loguru import logger
|
||||
|
||||
from message_util import MessageUtil
|
||||
from plugin_common.message_plugin_interface import MessagePluginInterface
|
||||
from plugin_common.plugin_interface import PluginStatus
|
||||
from utils.decorator.plugin_decorators import plugin_stats_decorator
|
||||
@@ -54,7 +53,6 @@ class GameTaskPlugin(MessagePluginInterface):
|
||||
|
||||
# 保存上下文对象
|
||||
self.event_system = context.get("event_system")
|
||||
self.message_util: MessageUtil = context.get("message_util")
|
||||
|
||||
# 初始化配置
|
||||
self._commands = self._config.get("GameTask", {}).get("command",
|
||||
@@ -117,7 +115,7 @@ class GameTaskPlugin(MessagePluginInterface):
|
||||
gbm: GroupBotManager = message.get("gbm")
|
||||
all_contacts = message.get("all_contacts", {})
|
||||
|
||||
self.bot = message.get("bot")
|
||||
self.bot: WechatAPIClient = message.get("bot")
|
||||
self.LOG.debug(f"插件执行: {self.name}:{content}")
|
||||
|
||||
# 检查权限
|
||||
@@ -147,8 +145,8 @@ class GameTaskPlugin(MessagePluginInterface):
|
||||
await self._handle_list_uncompleted_tasks(sender, roomid)
|
||||
return True, "列举未完成任务成功"
|
||||
else:
|
||||
self.message_util.send_text(f"❌未知命令!\n{self.command_format}",
|
||||
(roomid if roomid else sender), sender)
|
||||
await self.bot.send_at_message((roomid if roomid else sender), f"❌未知命令!\n{self.command_format}",
|
||||
[sender])
|
||||
return False, "未知命令"
|
||||
|
||||
except Exception as e:
|
||||
@@ -420,10 +418,10 @@ class GameTaskPlugin(MessagePluginInterface):
|
||||
for i, row in enumerate(ranks, 1):
|
||||
rank_text += f"🐓 {i}. {row['player_name']}: {row['points']} 分\n"
|
||||
|
||||
self.message_util.send_text(
|
||||
rank_text,
|
||||
await self.bot.send_at_message(
|
||||
(roomid if roomid else sender),
|
||||
sender
|
||||
rank_text,
|
||||
[sender]
|
||||
)
|
||||
except Exception as e:
|
||||
self.LOG.error(f"显示排行榜出错: {e}")
|
||||
|
||||
Reference in New Issue
Block a user