__init__.py 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. # coding=utf-8
  2. """
  3. 通知推送模块
  4. 提供多渠道通知推送功能,包括:
  5. - 飞书、钉钉、企业微信
  6. - Telegram、Slack
  7. - Email、ntfy、Bark
  8. 模块结构:
  9. - push_manager: 推送记录管理
  10. - formatters: 内容格式转换
  11. - batch: 批次处理工具
  12. - renderer: 通知内容渲染
  13. - splitter: 消息分批拆分
  14. - senders: 消息发送器(各渠道发送函数)
  15. - dispatcher: 多账号通知调度器
  16. """
  17. from trendradar.notification.push_manager import PushRecordManager
  18. from trendradar.notification.formatters import (
  19. strip_markdown,
  20. convert_markdown_to_mrkdwn,
  21. )
  22. from trendradar.notification.batch import (
  23. get_batch_header,
  24. get_max_batch_header_size,
  25. truncate_to_bytes,
  26. add_batch_headers,
  27. )
  28. from trendradar.notification.renderer import (
  29. render_feishu_content,
  30. render_dingtalk_content,
  31. )
  32. from trendradar.notification.splitter import (
  33. split_content_into_batches,
  34. DEFAULT_BATCH_SIZES,
  35. )
  36. from trendradar.notification.senders import (
  37. send_to_feishu,
  38. send_to_dingtalk,
  39. send_to_wework,
  40. send_to_telegram,
  41. send_to_email,
  42. send_to_ntfy,
  43. send_to_bark,
  44. send_to_slack,
  45. SMTP_CONFIGS,
  46. )
  47. from trendradar.notification.dispatcher import NotificationDispatcher
  48. __all__ = [
  49. # 推送记录管理
  50. "PushRecordManager",
  51. # 格式转换
  52. "strip_markdown",
  53. "convert_markdown_to_mrkdwn",
  54. # 批次处理
  55. "get_batch_header",
  56. "get_max_batch_header_size",
  57. "truncate_to_bytes",
  58. "add_batch_headers",
  59. # 内容渲染
  60. "render_feishu_content",
  61. "render_dingtalk_content",
  62. # 消息分批
  63. "split_content_into_batches",
  64. "DEFAULT_BATCH_SIZES",
  65. # 消息发送器
  66. "send_to_feishu",
  67. "send_to_dingtalk",
  68. "send_to_wework",
  69. "send_to_telegram",
  70. "send_to_email",
  71. "send_to_ntfy",
  72. "send_to_bark",
  73. "send_to_slack",
  74. "SMTP_CONFIGS",
  75. # 通知调度器
  76. "NotificationDispatcher",
  77. ]