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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nonebot_plugin_tweet-0.1.2.tar.gz.
File metadata
- Download URL: nonebot_plugin_tweet-0.1.2.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f60817be37c311fb105ddc01fad1c545adbb1b00e8d85f70c18982a2ecb32084
|
|
| MD5 |
b1ae492b56cb7f37614198a6a8fa5ec4
|
|
| BLAKE2b-256 |
4c8cb72624d675a0960a17c7ad8ea58942a8bf80e10f5f9bc13ce399ea2867aa
|
File details
Details for the file nonebot_plugin_tweet-0.1.2-py3-none-any.whl.
File metadata
- Download URL: nonebot_plugin_tweet-0.1.2-py3-none-any.whl
- Upload date:
- Size: 8.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ae8b088f0dbe9dcd51745395dc18c73b9ceb2daa00ab4f264168558717ba3d4
|
|
| MD5 |
dd12c22abd6c675f6da106aba814d761
|
|
| BLAKE2b-256 |
5f4a6ae255aba910194512b4e8245d2bc80777872ea175f4fbb964b4a216606c
|