Skip to main content

NoneBot2 plugin for forwarding tweets with optional translation support

Project description

nonebot-plugin-tweet

基于 RSSHub 的 Twitter/X 推文转发插件,支持自动翻译与多种输出模式。

功能亮点

  • 转发 twitter.com / x.com 链接中的推文文本、图片与视频
  • 支持 c / content 前缀仅发送多媒体内容
  • 支持 o / origin 前缀仅发送未翻译原文
  • 可选通过 OpenAI 兼容接口自动翻译推文文本

安装

nb-cli

nb plugin install nonebot-plugin-tweet

pip

pip install nonebot-plugin-tweet

安装完成后,将插件名加入 NoneBot 配置:

[tool.nonebot]
plugins = ["nonebot_plugin_tweet"]

或在代码中手动加载:

nonebot.load_plugin("nonebot_plugin_tweet")

配置

通过环境变量或 .env 文件配置插件参数:

变量名 默认值 说明
RSSHUB_BASE_URL https://rsshub.app/twitter/user/ RSSHub 推文路由基础地址,需包含末尾 /
RSSHUB_QUERY_PARAM 空字符串 追加到 RSSHub 请求的查询参数,示例:?format=raw
TRANSLATE_TARGET_LANGUAGE zh-Hans 翻译目标语言,留空代表禁用翻译
OPENAI_API_BASE 未设置 OpenAI 兼容接口地址,启用翻译时必填
OPENAI_API_KEY 未设置 OpenAI 兼容接口密钥,启用翻译时必填
OPENAI_MODEL gemini-2.5-flash-lite 用于翻译的模型名称,启用翻译时必填

如果仅需转发原始内容,可将 TRANSLATE_TARGET_LANGUAGE 置空或不配置,同时无需填写 OpenAI 相关参数。

使用说明

  • 直接发送推文链接即可触发转发。
  • 使用 c / content 前缀仅发送图片和视频。
  • 使用 o / origin 前缀仅发送未翻译的原始文本。
  • 视频会按顺序逐条下载并发送,发送间隔约为 1 秒。

本地调试

项目内置 bot.py,可在本地快速启动:

pip install -r requirements.txt
python bot.py

许可证

本项目基于 MIT 许可证开源。

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_tweet-0.1.4.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

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

nonebot_plugin_tweet-0.1.4-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file nonebot_plugin_tweet-0.1.4.tar.gz.

File metadata

  • Download URL: nonebot_plugin_tweet-0.1.4.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nonebot_plugin_tweet-0.1.4.tar.gz
Algorithm Hash digest
SHA256 d778494b1b43938be9ecbfd46a07d4f67c6d113d7f53b8a6c80a7a1eea481086
MD5 27ff432dd6bac943273cb562154d0b85
BLAKE2b-256 fcd5d3ef4a4c0a94e249f048bf731b02d7a1ad5b56a51a5880c18e43e2ee6a1a

See more details on using hashes here.

File details

Details for the file nonebot_plugin_tweet-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for nonebot_plugin_tweet-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 963dbec39463db38c8b0186362f79d69b47880171cca439a8f70b3841a74556d
MD5 60b4024441f65b20928d4961daa01373
BLAKE2b-256 f717eb665e42bc0da94d4ed4dd65163fe112586210af0d5c7235db3bb7414abf

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