加入群ID显示

This commit is contained in:
liuwei
2025-02-17 16:00:20 +08:00
parent f8c73659f2
commit b3633caa4e
3 changed files with 53 additions and 49 deletions

View File

@@ -29,7 +29,7 @@ def archive_message(group_id, timestamp_str, sender, content, message_type, atta
# 提交事务
connection.commit()
print(f"Message archived successfully: {content}")
print(f"Message archived successfully:{group_id}:{sender}: {content}")
except Exception as e:
print(f"Error archiving message: {e}")

View File

@@ -158,7 +158,8 @@ class Robot(Job):
Feature.AI_CAPABILITY) == PermissionStatus.DISABLED:
self.sendTextMsg("群AI功能未开启", msg.roomid, msg.sender)
return True
rsp = self.chat.get_answer(q, (msg.roomid if msg.from_group() else msg.sender))
else:
rsp = self.chat.get_answer(q, (msg.roomid if msg.from_group() else msg.sender))
if rsp:
if msg.from_group():
@@ -441,7 +442,7 @@ class Robot(Job):
def message_summary_robot(self, sender: str = None):
try:
if self.gbm.get_group_permission(sender, Feature.DAILY_SUMMARY) == PermissionStatus.ENABLED:
if self.gbm.get_group_permission(sender, Feature.SUMMARY_CAPABILITY) == PermissionStatus.ENABLED:
self.LOG.info(f"群: {sender} 消息总结开始执行!")
content = get_messages(sender, self.allContacts)
summary = message_summary(content)

View File

@@ -206,53 +206,56 @@ def simulate_commands():
group_id = "49571962306@chatroom"
# 启用群机器人
print(GroupBotManager.handle_command(group_id, "ROBOT-启用"))
print(GroupBotManager.get_group_permission(group_id, Feature.AI_CAPABILITY) == PermissionStatus.DISABLED)
# 启用每日新闻自动播报
print(GroupBotManager.handle_command(group_id, "2-启用")) # 使用序号启用每日新闻自动播报
# 关闭群AI能力
print(GroupBotManager.handle_command(group_id, "4-关闭")) # 使用序号关闭群AI能力
# 启用群总结能力
print(GroupBotManager.handle_command(group_id, "5-启用")) # 使用序号启用群总结能力
# 关闭Sehuatang PDF能力
print(GroupBotManager.handle_command(group_id, "6-关闭")) # 使用序号关闭Sehuatang PDF能力
# 启用EPIC自动播报
print(GroupBotManager.handle_command(group_id, "7-启用")) # 使用序号启用EPIC自动播报
# 查看当前群组的功能权限
print(GroupBotManager.get_group_permission(group_id, Feature.ROBOT))
print(GroupBotManager.get_group_permission(group_id, Feature.DAILY_NEWS))
print(GroupBotManager.get_group_permission(group_id, Feature.AI_CAPABILITY))
print(GroupBotManager.get_group_permission(group_id, Feature.SUMMARY_CAPABILITY))
print(GroupBotManager.get_group_permission(group_id, Feature.PDF_CAPABILITY))
print(GroupBotManager.get_group_permission(group_id, Feature.EPIC))
# 查看群组所有功能和状态
permissions = GroupBotManager.list_group_permissions(group_id)
for feature, status in permissions.items():
print(f"{feature.description} (序号: {feature.value}): {status.value}")
# 查看 group:list 中的群组
print("当前启用群机器人的群组:", GroupBotManager.get_group_list())
# 查看菜单功能列表
print("功能列表:")
print(GroupBotManager.handle_command(group_id, "MENU"))
# 查看 group:list 清单
print("群组清单:")
print(GroupBotManager.handle_command(group_id, "GROUP_LIST"))
# 更新缓存
print(GroupBotManager.handle_command(group_id, "UPDATE"))
# 保存到 Redis
GroupBotManager.save_to_redis()
print(GroupBotManager.get_group_permission(group_id, Feature.SUMMARY_CAPABILITY) == PermissionStatus.ENABLED)
# # 启用群机器人
# print(GroupBoManager.handle_command(group_id, "ROBOT-启用"))
#
# # 启用每日新闻自动播报
# print(GroupBotManager.handle_command(group_id, "2-启用")) # 使用序号启用每日新闻自动播报
#
# # 关闭群AI能力
# print(GroupBotManager.handle_command(group_id, "4-关闭")) # 使用序号关闭群AI能力
#
# # 启用群总结能力
# print(GroupBotManager.handle_command(group_id, "5-启用")) # 使用序号启用群总结能力
#
# # 关闭Sehuatang PDF能力
# print(GroupBotManager.handle_command(group_id, "6-关闭")) # 使用序号关闭Sehuatang PDF能力
#
# # 启用EPIC自动播报
# print(GroupBotManager.handle_command(group_id, "7-启用")) # 使用序号启用EPIC自动播报
#
# # 查看当前群组的功能权限
# print(GroupBotManager.get_group_permission(group_id, Feature.ROBOT))
# print(GroupBotManager.get_group_permission(group_id, Feature.DAILY_NEWS))
# print(GroupBotManager.get_group_permission(group_id, Feature.AI_CAPABILITY))
# print(GroupBotManager.get_group_permission(group_id, Feature.SUMMARY_CAPABILITY))
# print(GroupBotManager.get_group_permission(group_id, Feature.PDF_CAPABILITY))
# print(GroupBotManager.get_group_permission(group_id, Feature.EPIC))
#
# # 查看群组所有功能和状态
# permissions = GroupBotManager.list_group_permissions(group_id)
# for feature, status in permissions.items():
# print(f"{feature.description} (序号: {feature.value}): {status.value}")
#
# # 查看 group:list 中的群组
# print("当前启用群机器人的群组:", GroupBotManager.get_group_list())
#
# # 查看菜单功能列表
# print("功能列表:")
# print(GroupBotManager.handle_command(group_id, "MENU"))
#
# # 查看 group:list 清单
# print("群组清单:")
# print(GroupBotManager.handle_command(group_id, "GROUP_LIST"))
#
# # 更新缓存
# print(GroupBotManager.handle_command(group_id, "UPDATE"))
#
# # 保存到 Redis
# GroupBotManager.save_to_redis()
if __name__ == '__main__':