diff --git a/wechatter/config/validate.py b/wechatter/config/validate.py index 9fc75b0..a1cf6df 100644 --- a/wechatter/config/validate.py +++ b/wechatter/config/validate.py @@ -83,14 +83,6 @@ def validate_config(config): logger.critical(error_msg) raise ValueError(error_msg) - # 判断这个 rule 是否有 from_list_exclude 字段 - if ( - "from_list_exclude" in rule - and config["bot_name"] not in rule["from_list_exclude"] - ): - # 加入机器人名字,防止机器人自己转发自己的消息,导致死循环刷屏 - rule["from_list_exclude"].append(config["bot_name"]) - # Discord 消息转发配置 ess_fields = ["from_list", "webhook_url"] for i, rule in enumerate(config["discord_message_forwarding_rule_list"]): diff --git a/wechatter/init_logger.py b/wechatter/init_logger.py index 8d922d7..d7b7d35 100644 --- a/wechatter/init_logger.py +++ b/wechatter/init_logger.py @@ -71,5 +71,4 @@ def init_logger(log_level: str = ""): rotation="00:00", encoding="utf-8", format=LOGURU_FORMAT, - colorize=True, ) diff --git a/wechatter/message/message_forwarder.py b/wechatter/message/message_forwarder.py index 44e254f..67247bd 100644 --- a/wechatter/message/message_forwarder.py +++ b/wechatter/message/message_forwarder.py @@ -90,6 +90,10 @@ def forwarding_to_wechat(self, message_obj: Message): """ # TODO: 转发文件 + # 判断发送者是否为自己 + if message_obj.is_from_self: + return + # 判断是否设置了转发规则 if not self.all_message_rule and not self.specific_message_rules: logger.warning(