去除一些无用功能,以前的UI这些。
This commit is contained in:
13
robot.py
13
robot.py
@@ -73,13 +73,13 @@ class Robot(Job):
|
||||
self.wxid = self.wcf.get_self_wxid()
|
||||
self.allContacts = self.get_all_contacts()
|
||||
self.LOG.info(f"DB+REDIS 连接池开始初始化")
|
||||
# 初始化数据库连接管理器
|
||||
# 初始化数据库连接管理器
|
||||
self.db_manager = DBConnectionManager(
|
||||
mysql_config=self.config.mariadb,
|
||||
redis_config=self.config.redis
|
||||
)
|
||||
self.LOG.info(f"数据库连接管理器初始化完成")
|
||||
|
||||
|
||||
# 为了兼容现有代码,保留原有的连接池
|
||||
self.db_pool = self.db_manager.mysql_pool
|
||||
self.redis_pool = self.db_manager.redis_pool
|
||||
@@ -89,7 +89,7 @@ class Robot(Job):
|
||||
self.groups = {} # 存储按group_id分组的消息列表,每个group_id最多保留10条消息
|
||||
GroupBotManager.load_local_cache()
|
||||
# 消息存档模块初始化,自动完成入库动作
|
||||
self.message_storage = MessageStorage(self.db_pool, self.redis_pool)
|
||||
self.message_storage = MessageStorage()
|
||||
# 权限模块加载
|
||||
self.gbm = GroupBotManager()
|
||||
# 群成员变更模块加载
|
||||
@@ -293,7 +293,7 @@ class Robot(Job):
|
||||
if msg.from_group():
|
||||
# 调用统计逻辑进行聊天数据统计:
|
||||
try:
|
||||
process_message(msg)
|
||||
self.message_storage.process_message(msg)
|
||||
except Exception as e:
|
||||
self.LOG.error(f"process_message error: {e}")
|
||||
|
||||
@@ -616,7 +616,7 @@ class Robot(Job):
|
||||
|
||||
def message_count_to_db(self):
|
||||
try:
|
||||
write_to_db()
|
||||
self.message_storage.write_to_db()
|
||||
except Exception as e:
|
||||
self.LOG.error(f"write_to_db error:{e}")
|
||||
|
||||
@@ -635,7 +635,8 @@ class Robot(Job):
|
||||
return
|
||||
for r in receivers:
|
||||
if self.gbm.get_group_permission(r, Feature.DAILY_SUMMARY) == PermissionStatus.ENABLED:
|
||||
self.send_text_msg(generate_and_send_ranking(r, self.allContacts), r)
|
||||
output = self.message_storage.generate_and_send_ranking(r, self.allContacts)
|
||||
self.send_text_msg(output, r)
|
||||
except Exception as e:
|
||||
self.LOG.error(f"SendRanking error:{e}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user