__init__.py 1.8 KB

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