Update message_pusher.py #346
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📜 标题(Title)
请提供这个Pull Request中提议的更改的简洁描述:
app/messages/message_pusher.py:统一消息推送流程,新增飞书通道与通知历史记录。🔍 描述(Description)
请描述这个PR做了什么/为什么这些更改是必要的:
MessagePusher.push_messages,集中调用钉钉、企业微信、Bark、ntfy、Telegram、飞书、邮件、ServerChan 等通道,避免调用散落在各处,便于后续维护。is_any_push_channel_enabled与should_push_message等判定逻辑,用于根据用户配置和当前录制状态(开播/下播、是否仅通知不录制、是否手动停止)决定是否发送通知,减少无效推送。SettingsPage.user_config中读取feishu_enabled、feishu_webhook_url、feishu_msg_type、feishu_sign_secret等配置;NotificationService.send_to_feishu完成签名、时间戳和消息体组装,并记录成功/失败日志。_append_notification_history:meta)、各通道结果等;notification_history_enabled与notification_history_max_entries配置控制,自动截断超出最大条数的历史;user_config并通过config_manager.save_user_config持久化,便于在设置界面查看历史记录。log_push_result对每个通道统一记录成功或失败,其中失败会带上错误列表,便于排查推送异常。这些改动是必要的,因为:
📝 类型(Type of Change)
这个PR引入了哪种类型的更改?(请勾选所有适用的选项)
🏗️ 测试(Testing)
请描述您已经进行的测试:
python main.py,确保应用可正常启动。MessagePusher.should_push_message对开播场景返回True。notification_history中条目数不会超过配置的notification_history_max_entries,旧记录被正确截断。如果适用,请提供测试更改的说明:
5)。📋 检查清单(Checklist)
在您创建这个PR之前,请确保以下所有框都被勾选,方法是在每个框中放置一个
x:注意: 这个PR在所有复选框被勾选之前不会被合并。
感谢您的贡献!