优化指令,防止骚扰。只发给自己
This commit is contained in:
6
robot.py
6
robot.py
@@ -299,8 +299,10 @@ class Robot(Job):
|
||||
if msg.from_self():
|
||||
self.revoke_receive_message(msg)
|
||||
rsp = self.gbm.handle_command(msg.roomid, msg.content)
|
||||
self.send_text_msg(rsp, msg.roomid, msg.sender)
|
||||
return
|
||||
# 不在群里发送,防止被骚扰
|
||||
if rsp is not None:
|
||||
self.send_text_msg(rsp, msg.sender)
|
||||
return
|
||||
except Exception as e:
|
||||
self.LOG.error(f"revoke_receive_message error: {e}")
|
||||
|
||||
|
||||
@@ -138,18 +138,18 @@ class GroupBotManager:
|
||||
|
||||
# 如果是MENU指令,返回功能列表
|
||||
if command_str.strip().upper() == "MENU":
|
||||
return GroupBotManager.display_menu()
|
||||
return f"群ID:{group_id} \n {GroupBotManager.display_menu_status(group_id)}"
|
||||
|
||||
# 如果是MENU-STATUS指令,返回功能列表及其状态
|
||||
if command_str.strip().upper() == "MENU_STATUS":
|
||||
return GroupBotManager.display_menu_status(group_id)
|
||||
return f"群ID:{group_id} \n {GroupBotManager.display_menu_status(group_id)}"
|
||||
|
||||
# 如果是GROUP_LIST指令,返回 group:list 清单
|
||||
if command_str.strip().upper() == "GROUP_LIST":
|
||||
return GroupBotManager.get_group_list()
|
||||
|
||||
if len(command_parts) < 2:
|
||||
return "无效命令,格式应为:功能-操作 或 序号-操作"
|
||||
return None
|
||||
|
||||
feature_str = command_parts[0]
|
||||
action = command_parts[1]
|
||||
@@ -194,10 +194,10 @@ class GroupBotManager:
|
||||
# 根据不同的操作启用或禁用功能
|
||||
if action == "启用":
|
||||
GroupBotManager.set_group_permission(group_id, feature, PermissionStatus.ENABLED)
|
||||
return f"{feature.description} 已启用"
|
||||
return f"群ID:{group_id} \n {feature.description} 已启用"
|
||||
elif action == "关闭":
|
||||
GroupBotManager.set_group_permission(group_id, feature, PermissionStatus.DISABLED)
|
||||
return f"{feature.description} 已关闭"
|
||||
return f"群ID:{group_id} \n {feature.description} 已关闭"
|
||||
else:
|
||||
return "无效操作,仅支持启用或关闭"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user