fix:ruff
This commit is contained in:
@@ -1 +1 @@
|
||||
"""插件系统包"""
|
||||
"""插件系统包"""
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
"""测试插件包"""
|
||||
|
||||
"""
|
||||
这是一个测试插件
|
||||
"""
|
||||
"""
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"""测试插件动作模块"""
|
||||
|
||||
# 导入所有动作模块以确保装饰器被执行
|
||||
from . import test_action # noqa
|
||||
# from . import online_action # noqa
|
||||
from . import mute_action # noqa
|
||||
from . import test_action # noqa
|
||||
|
||||
# from . import online_action # noqa
|
||||
from . import mute_action # noqa
|
||||
|
||||
@@ -4,12 +4,15 @@ from typing import Tuple
|
||||
|
||||
logger = get_logger("mute_action")
|
||||
|
||||
|
||||
@register_action
|
||||
class MuteAction(PluginAction):
|
||||
"""测试动作处理类"""
|
||||
|
||||
action_name = "mute_action"
|
||||
action_description = "如果某人违反了公序良俗,或者别人戳你太多,,或者某人刷屏,一定要禁言某人,如果你很生气,可以禁言某人"
|
||||
action_description = (
|
||||
"如果某人违反了公序良俗,或者别人戳你太多,,或者某人刷屏,一定要禁言某人,如果你很生气,可以禁言某人"
|
||||
)
|
||||
action_parameters = {
|
||||
"target": "禁言对象,输入你要禁言的对象的名字,必填,",
|
||||
"duration": "禁言时长,输入你要禁言的时长,单位为秒,必填",
|
||||
@@ -27,22 +30,22 @@ class MuteAction(PluginAction):
|
||||
async def process(self) -> Tuple[bool, str]:
|
||||
"""处理测试动作"""
|
||||
logger.info(f"{self.log_prefix} 执行online动作: {self.reasoning}")
|
||||
|
||||
|
||||
# 发送测试消息
|
||||
target = self.action_data.get("target")
|
||||
duration = self.action_data.get("duration")
|
||||
reason = self.action_data.get("reason")
|
||||
platform, user_id = await self.get_user_id_by_person_name(target)
|
||||
|
||||
|
||||
await self.send_message_by_expressor(f"我要禁言{target},{platform},时长{duration}秒,理由{reason},表达情绪")
|
||||
|
||||
|
||||
try:
|
||||
await self.send_message(f"[command]mute,{user_id},{duration}")
|
||||
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"{self.log_prefix} 执行mute动作时出错: {e}")
|
||||
await self.send_message_by_expressor(f"执行mute动作时出错: {e}")
|
||||
|
||||
|
||||
return False, "执行mute动作时出错"
|
||||
|
||||
return True, "测试动作执行成功"
|
||||
|
||||
return True, "测试动作执行成功"
|
||||
|
||||
@@ -4,15 +4,14 @@ from typing import Tuple
|
||||
|
||||
logger = get_logger("check_online_action")
|
||||
|
||||
|
||||
@register_action
|
||||
class CheckOnlineAction(PluginAction):
|
||||
"""测试动作处理类"""
|
||||
|
||||
action_name = "check_online_action"
|
||||
action_description = "这是一个检查在线状态的动作,当有人要求你检查Maibot(麦麦 机器人)在线状态时使用"
|
||||
action_parameters = {
|
||||
"mode": "查看模式"
|
||||
}
|
||||
action_parameters = {"mode": "查看模式"}
|
||||
action_require = [
|
||||
"当有人要求你检查Maibot(麦麦 机器人)在线状态时使用",
|
||||
"mode参数为version时查看在线版本状态,默认用这种",
|
||||
@@ -23,22 +22,22 @@ class CheckOnlineAction(PluginAction):
|
||||
async def process(self) -> Tuple[bool, str]:
|
||||
"""处理测试动作"""
|
||||
logger.info(f"{self.log_prefix} 执行online动作: {self.reasoning}")
|
||||
|
||||
|
||||
# 发送测试消息
|
||||
mode = self.action_data.get("mode", "type")
|
||||
|
||||
|
||||
await self.send_message_by_expressor("我看看")
|
||||
|
||||
|
||||
try:
|
||||
if mode == "type":
|
||||
await self.send_message(f"#online detail")
|
||||
await self.send_message("#online detail")
|
||||
elif mode == "version":
|
||||
await self.send_message(f"#online")
|
||||
|
||||
await self.send_message("#online")
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"{self.log_prefix} 执行online动作时出错: {e}")
|
||||
await self.send_message_by_expressor("执行online动作时出错: {e}")
|
||||
|
||||
|
||||
return False, "执行online动作时出错"
|
||||
|
||||
return True, "测试动作执行成功"
|
||||
|
||||
return True, "测试动作执行成功"
|
||||
|
||||
@@ -4,15 +4,14 @@ from typing import Tuple
|
||||
|
||||
logger = get_logger("test_action")
|
||||
|
||||
|
||||
@register_action
|
||||
class TestAction(PluginAction):
|
||||
"""测试动作处理类"""
|
||||
|
||||
action_name = "test_action"
|
||||
action_description = "这是一个测试动作,当有人要求你测试插件系统时使用"
|
||||
action_parameters = {
|
||||
"test_param": "测试参数(可选)"
|
||||
}
|
||||
action_parameters = {"test_param": "测试参数(可选)"}
|
||||
action_require = [
|
||||
"测试情况下使用",
|
||||
"想测试插件动作加载时使用",
|
||||
@@ -22,17 +21,17 @@ class TestAction(PluginAction):
|
||||
async def process(self) -> Tuple[bool, str]:
|
||||
"""处理测试动作"""
|
||||
logger.info(f"{self.log_prefix} 执行测试动作: {self.reasoning}")
|
||||
|
||||
|
||||
# 获取聊天类型
|
||||
chat_type = self.get_chat_type()
|
||||
logger.info(f"{self.log_prefix} 当前聊天类型: {chat_type}")
|
||||
|
||||
|
||||
# 获取最近消息
|
||||
recent_messages = self.get_recent_messages(3)
|
||||
logger.info(f"{self.log_prefix} 最近3条消息: {recent_messages}")
|
||||
|
||||
|
||||
# 发送测试消息
|
||||
test_param = self.action_data.get("test_param", "默认参数")
|
||||
await self.send_message_by_expressor(f"测试动作执行成功,参数: {test_param}")
|
||||
|
||||
return True, "测试动作执行成功"
|
||||
|
||||
return True, "测试动作执行成功"
|
||||
|
||||
Reference in New Issue
Block a user