加入群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() connection.commit()
print(f"Message archived successfully: {content}") print(f"Message archived successfully:{group_id}:{sender}: {content}")
except Exception as e: except Exception as e:
print(f"Error archiving message: {e}") print(f"Error archiving message: {e}")

View File

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

View File

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