fix:优化离开focus模式的机制,完全移除Interest机制,
This commit is contained in:
@@ -10,15 +10,13 @@ class GroupWholeBanAction(PluginAction):
|
||||
"""群聊全体禁言动作处理类"""
|
||||
|
||||
action_name = "group_whole_ban_action"
|
||||
action_description = (
|
||||
"开启或关闭群聊全体禁言,当群聊过于混乱或需要安静时使用"
|
||||
)
|
||||
action_description = "开启或关闭群聊全体禁言,当群聊过于混乱或需要安静时使用"
|
||||
action_parameters = {
|
||||
"enable": "是否开启全体禁言,输入True开启,False关闭,必填",
|
||||
}
|
||||
action_require = [
|
||||
"当群聊过于混乱需要安静时使用",
|
||||
"当需要临时暂停群聊讨论时使用",
|
||||
"当需要临时暂停群聊讨论时使用",
|
||||
"当有人要求开启全体禁言时使用",
|
||||
"当管理员需要发布重要公告时使用",
|
||||
]
|
||||
@@ -31,7 +29,7 @@ class GroupWholeBanAction(PluginAction):
|
||||
|
||||
# 获取参数
|
||||
enable = self.action_data.get("enable")
|
||||
|
||||
|
||||
if enable is None:
|
||||
error_msg = "全体禁言参数不完整,需要enable参数"
|
||||
logger.error(f"{self.log_prefix} {error_msg}")
|
||||
@@ -39,9 +37,9 @@ class GroupWholeBanAction(PluginAction):
|
||||
|
||||
# 确保enable是布尔类型
|
||||
if isinstance(enable, str):
|
||||
if enable.lower() in ['true', '1', 'yes', '开启', '是']:
|
||||
if enable.lower() in ["true", "1", "yes", "开启", "是"]:
|
||||
enable = True
|
||||
elif enable.lower() in ['false', '0', 'no', '关闭', '否']:
|
||||
elif enable.lower() in ["false", "0", "no", "关闭", "否"]:
|
||||
enable = False
|
||||
else:
|
||||
error_msg = f"无效的enable参数: {enable},应该是True或False"
|
||||
@@ -54,20 +52,12 @@ class GroupWholeBanAction(PluginAction):
|
||||
|
||||
try:
|
||||
# 发送群聊全体禁言命令,按照新格式
|
||||
await self.send_message(
|
||||
type="command",
|
||||
data={
|
||||
"name": "GROUP_WHOLE_BAN",
|
||||
"args": {
|
||||
"enable": enable
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
await self.send_message(type="command", data={"name": "GROUP_WHOLE_BAN", "args": {"enable": enable}})
|
||||
|
||||
logger.info(f"{self.log_prefix} 成功{action_text}全体禁言")
|
||||
return True, f"成功{action_text}全体禁言"
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"{self.log_prefix} 执行全体禁言动作时出错: {e}")
|
||||
await self.send_message_by_expressor(f"执行全体禁言动作时出错: {e}")
|
||||
return False, f"执行全体禁言动作时出错: {e}"
|
||||
return False, f"执行全体禁言动作时出错: {e}"
|
||||
|
||||
@@ -10,9 +10,7 @@ class MuteAction(PluginAction):
|
||||
"""群聊禁言动作处理类"""
|
||||
|
||||
action_name = "mute_action"
|
||||
action_description = (
|
||||
"如果某人违反了公序良俗,或者别人戳你太多,或者某人刷屏,一定要禁言某人,如果你很生气,可以禁言某人,可以自选禁言时长,视严重程度而定。"
|
||||
)
|
||||
action_description = "如果某人违反了公序良俗,或者别人戳你太多,或者某人刷屏,一定要禁言某人,如果你很生气,可以禁言某人,可以自选禁言时长,视严重程度而定。"
|
||||
action_parameters = {
|
||||
"target": "禁言对象,输入你要禁言的对象的名字,必填",
|
||||
"duration": "禁言时长,输入你要禁言的时长,单位为秒,必填,必须为数字",
|
||||
@@ -38,7 +36,7 @@ class MuteAction(PluginAction):
|
||||
target = self.action_data.get("target")
|
||||
duration = self.action_data.get("duration")
|
||||
reason = self.action_data.get("reason", "违反群规")
|
||||
|
||||
|
||||
if not target or not duration:
|
||||
error_msg = "禁言参数不完整,需要target和duration"
|
||||
logger.error(f"{self.log_prefix} {error_msg}")
|
||||
@@ -46,7 +44,7 @@ class MuteAction(PluginAction):
|
||||
|
||||
# 获取用户ID
|
||||
platform, user_id = await self.get_user_id_by_person_name(target)
|
||||
|
||||
|
||||
if not user_id:
|
||||
error_msg = f"未找到用户 {target} 的ID"
|
||||
logger.error(f"{self.log_prefix} {error_msg}")
|
||||
@@ -58,19 +56,12 @@ class MuteAction(PluginAction):
|
||||
try:
|
||||
# 确保duration是字符串类型
|
||||
duration_str = str(duration)
|
||||
|
||||
|
||||
# 发送群聊禁言命令,按照新格式
|
||||
await self.send_message(
|
||||
type="command",
|
||||
data={
|
||||
"name": "GROUP_BAN",
|
||||
"args": {
|
||||
"qq_id": str(user_id),
|
||||
"duration": duration_str
|
||||
}
|
||||
}
|
||||
type="command", data={"name": "GROUP_BAN", "args": {"qq_id": str(user_id), "duration": duration_str}}
|
||||
)
|
||||
|
||||
|
||||
logger.info(f"{self.log_prefix} 成功禁言用户 {target}({user_id}),时长 {duration} 秒")
|
||||
return True, f"成功禁言 {target},时长 {duration} 秒"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user