Skip to main content

监控特朗普 Truth Social 动态并推送到订阅群

Project description

nonebot-plugin-trumpwatcher

�?监控特朗�?Truth Social 动态并推送到订阅�?✨

license pypi python

📖 介绍

一个用于监控特朗普 Truth Social 动态的 NoneBot2 插件,支持自动拉取、群组订阅推送和 AI 翻译总结�?

💿 安装

使用 nb-cli 安装(推荐)

�?NoneBot2 项目的根目录下打开命令�?输入以下指令即可安装:

nb plugin install nonebot-plugin-trumpwatcher
使用包管理器安装

�?NoneBot2 项目的插件目录下,打开命令�?根据你使用的包管理器,输入相应的安装命�?

pip
pip install nonebot-plugin-trumpwatcher
pdm
pdm add nonebot-plugin-trumpwatcher
poetry
poetry add nonebot-plugin-trumpwatcher
conda
conda install nonebot-plugin-trumpwatcher

打开 NoneBot2 项目根目录下�?pyproject.toml 文件,�?[tool.nonebot] 部分追加写入:

plugins = ["nonebot_plugin_trumpwatcher"]

🎉 数据�?

📝 依赖

注意: 本插件不指定 NoneBot2 驱动器依赖,请根据你的需求在主项目中配置驱动器�?

例如,在 .env 文件中配置:

DRIVER=~fastapi+~httpx+~websockets

并在主项目的 pyproject.toml 中安装对应的驱动器包(如果使�?poetry):

poetry add nonebot2[fastapi,websockets]

⚙️ 配置

�?NoneBot2 项目�?.env 文件中添加以下配置项(未配置则使用默认值):

基础配置

配置�? 类型 默认�? 说明
TRUMPWATCHER_SOURCE_URL str https://ix.cnn.io/data/truth-social/truth_archive.json 数据源地址
TRUMPWATCHER_FETCH_LIMIT int 20 每次拉取并比对的最大条数(1-100�?
TRUMPWATCHER_TIMEOUT float 20.0 拉取数据超时(秒�?
TRUMPWATCHER_FORWARD_USER_ID int 10000 合并转发节点显示�?QQ �?
TRUMPWATCHER_FORWARD_NICKNAME str 特朗普观察员 合并转发节点显示昵称

AI 翻译总结配置

配置�? 类型 默认�? 说明
TRUMPWATCHER_AI_SUMMARY_ENABLED bool false 是否启用 AI 翻译总结
TRUMPWATCHER_AI_SUMMARY_MAX_POSTS int 3 每次拉取最多对�?N 条追�?AI 总结�?-100�?
TRUMPWATCHER_AI_PROVIDER str qwen AI 服务提供方标�?
TRUMPWATCHER_AI_API_BASE str https://dashscope.aliyuncs.com/compatible-mode/v1 AI API Base URL
TRUMPWATCHER_AI_API_KEY str "" AI API Key(开�?AI 时必填)
TRUMPWATCHER_AI_MODEL str qwen-plus AI 模型�?
TRUMPWATCHER_AI_TIMEOUT float 20.0 AI 请求超时(秒�?
TRUMPWATCHER_AI_TEMPERATURE float 0.2 AI 生成温度�?-2�?
TRUMPWATCHER_AI_MAX_CHARS int 2000 单条动态送入 AI 的最大字符数�?00-20000�?
TRUMPWATCHER_AI_MULTIMODAL_ENABLED bool true 是否启用图片多模态输�?
TRUMPWATCHER_AI_MULTIMODAL_MAX_IMAGES int 3 单条动态最多传入的图片 URL 数量�?-10�?

自动推送配�?

配置�? 类型 默认�? 说明
TRUMPWATCHER_AUTO_FETCH_ENABLED bool false 是否启用自动拉取并推�?
TRUMPWATCHER_AUTO_FETCH_CRON str */10 * * * * 自动拉取 cron�? �?crontab 表达式)
TRUMPWATCHER_AUTO_FETCH_TIMEZONE str Asia/Shanghai 自动拉取时区

配置示例

# 基础配置
TRUMPWATCHER_FETCH_LIMIT=20
TRUMPWATCHER_TIMEOUT=20.0

# 启用 AI 翻译总结
TRUMPWATCHER_AI_SUMMARY_ENABLED=true
TRUMPWATCHER_AI_API_KEY=your_api_key_here
TRUMPWATCHER_AI_MODEL=qwen-plus

# 启用自动推送(�?5 分钟�?
TRUMPWATCHER_AUTO_FETCH_ENABLED=true
TRUMPWATCHER_AUTO_FETCH_CRON=*/5 * * * *

🎮 使用

命令列表

命令 别名 权限 说明
trump社媒拉取 trump / trump_fetch / trumpwatcher_fetch 任意群成�? 拉取最新动态、归档并推送到所有订阅群
trump社媒订阅 trump_sub / trumpwatcher_sub 群管理员/群主/SUPERUSER 当前群加入推送列�?
trump社媒取消订阅 trump_unsub / trumpwatcher_unsub 群管理员/群主/SUPERUSER 当前群移出推送列�?

使用流程

  1. **订阅推�?*: 在需要接收推送的群中发�?trump社媒订阅
  2. 手动拉取: 发�?trump社媒拉取 立即拉取最新动�?
  3. **自动推�?*: 配置 TRUMPWATCHER_AUTO_FETCH_ENABLED=true 启用定时自动推�?
  4. 取消订阅: 发�?trump社媒取消订阅 停止接收推�?

🔧 数据库迁�?

首次启用或升级表结构后执�?

nb orm upgrade

涉及�?

  • trumpwatcher_post_archive: 动态归�?
  • trumpwatcher_notify_group: 订阅群列�?

💡 AI 翻译总结说明

  • 默认使用千问(Qwen)兼容接�?
  • 启用后会在转发内容后追加"AI翻译总结"
  • 支持多模态图片输入(需模型支持�?
  • 如果模型不支持图�?会自动降级为纯文本总结
  • 请求失败时自动降级为仅发送原始消�?不影响主流程

📄 许可�?

本项目使�?MIT 许可证�?

📦 发布信息

🔧 开发者须�?

如果你想参与开发或了解插件的最佳实践,请查�?MAINTENANCE.md�?

🙏 致谢

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nonebot_plugin_trumpwatcher_legacy-1.0.4.tar.gz (13.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file nonebot_plugin_trumpwatcher_legacy-1.0.4.tar.gz.

File metadata

File hashes

Hashes for nonebot_plugin_trumpwatcher_legacy-1.0.4.tar.gz
Algorithm Hash digest
SHA256 5684709d56eff817ea8009a00dcb1d1c2bee5b4bef173808aa50d5d16afbd6c5
MD5 cfe616cd7838827b3ef941af0b27dbde
BLAKE2b-256 fd30d46a55aeee1528b78818b6cffd5fb49d448c02f3a77e0a5f52a6684c7c55

See more details on using hashes here.

File details

Details for the file nonebot_plugin_trumpwatcher_legacy-1.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for nonebot_plugin_trumpwatcher_legacy-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 dbea91e4c5959dc873fb3826472f31a470fc37e00e030c86c496e7724e8e872a
MD5 01dcb48fd001163f25d4ea9393d7701d
BLAKE2b-256 3e24d1661c58cbe6ff6fff3024ca66c617cfd30129ad7c605be9e6a58f831e24

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page