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.3.tar.gz (8.9 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.3-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nonebot_plugin_tweet-0.1.3.tar.gz
  • Upload date:
  • Size: 8.9 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.3.tar.gz
Algorithm Hash digest
SHA256 62a2b641de2522ec9574c858aa5716e25f256a15aa9fe1271fe9ffb5f1d24a21
MD5 60d7d8711d72c44863f8a33724be8e2c
BLAKE2b-256 03c078c48316b00f3a6080dee7e69b4abf0497351c6869158bf6f5a892597126

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nonebot_plugin_tweet-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4dce5d7ce28471319763ff7368eb7e7db828805013dda9052cd1d98b267c5e7d
MD5 2ef61ddd5e87415e18c8c7da48f5d4f0
BLAKE2b-256 7bf0bb393a2ccc4c48cb5bba5d6c4e5f926a89b4c6327e9498a8771d17b28bef

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