加入验证判断逻辑,以为是true,结果是文本。导致所有群都收到了消息

This commit is contained in:
liuwei
2025-02-17 15:34:13 +08:00
parent cceecc21fc
commit dc5be6c728
2 changed files with 30 additions and 17 deletions
+21 -17
View File
@@ -26,6 +26,7 @@ from constants import ChatType
from robot_cmd.robot_command import GroupBotManager
from job_mgmt import Job
from robot_cmd.robot_command import Feature
from robot_cmd.robot_command import PermissionStatus
__version__ = "39.2.4.0"
@@ -327,7 +328,7 @@ class Robot(Job):
if not receivers:
return
for r in receivers:
if self.gbm.get_group_permission(r, feature):
if self.gbm.get_group_permission(r, feature) == PermissionStatus.ENABLED:
self.sendTextMsg(msg, r)
except Exception as e:
self.LOG.error(f"send_group_txt_message:{feature.description} error{e}")
@@ -338,7 +339,7 @@ class Robot(Job):
if not receivers:
return
for r in receivers:
if self.gbm.get_group_permission(r, feature):
if self.gbm.get_group_permission(r, feature) == PermissionStatus.ENABLED:
self.wcf.send_file(path, r)
except Exception as e:
self.LOG.error(f"send_group_file_message:{feature.description} error{e}")
@@ -414,17 +415,6 @@ class Robot(Job):
except Exception as e:
self.LOG.error(f"write_to_db error{e}")
def generateAndSendRanking(self):
try:
receivers = self.gbm.get_group_list()
if not receivers:
return
for r in receivers:
if self.gbm.get_group_permission(r, Feature.DAILY_SUMMARY):
self.sendTextMsg(generate_and_send_ranking(r, self.allContacts), r)
except Exception as e:
self.LOG.error(f"SendRanking error{e}")
def generateSehuatangPdf(self):
try:
path = pdf_file_path()
@@ -433,11 +423,25 @@ class Robot(Job):
except Exception as e:
self.LOG.error(f"generateSehuatangPdf error{e}")
def generateAndSendRanking(self):
try:
receivers = self.gbm.get_group_list()
if not receivers:
return
for r in receivers:
if self.gbm.get_group_permission(r, Feature.DAILY_SUMMARY) == PermissionStatus.ENABLED:
self.sendTextMsg(generate_and_send_ranking(r, self.allContacts), r)
except Exception as e:
self.LOG.error(f"SendRanking error{e}")
def message_summary_robot(self, sender: str = None):
try:
self.LOG.info(f"群: {sender} 消息总结开始执行!")
content = get_messages(sender, self.allContacts)
summary = message_summary(content)
self.sendTextMsg(summary, sender)
if self.gbm.get_group_permission(sender, Feature.DAILY_SUMMARY) == PermissionStatus.ENABLED:
self.LOG.info(f"群: {sender} 消息总结开始执行!")
content = get_messages(sender, self.allContacts)
summary = message_summary(content)
self.sendTextMsg(summary, sender)
else:
self.sendTextMsg("群发言总结功能未开启", sender)
except Exception as e:
self.LOG.error(f"message_summary_robot error{e}")