NoneBot2 plugin for monitoring Tieba forums
Project description
nonebot-plugin-tieba-monitor
基于 NoneBot2 的贴吧帖子监控插件,用于监控指定贴吧的新帖子并发送到 QQ 群。
功能特性
- 监控多个贴吧的新帖子
- 支持自定义检查时间间隔
- 支持多群组通知
- 支持 AI 内容分析与过滤(可选)
- 高效的异步实现
安装
使用 pip
pip install nonebot-plugin-tieba-monitor
使用 nb-cli
nb plugin install nonebot-plugin-tieba-monitor
使用方法
- 在 NoneBot2 项目中,确保配置了 OneBot 适配器
- 在
.env文件中添加插件配置 - 启动 NoneBot2,插件将自动运行并按照配置的时间间隔监控贴吧
配置项
在 .env 文件中,你可以配置以下参数:
基础配置
| 配置项 | 类型 | 默认值 | 说明 |
|---|---|---|---|
tieba_check_interval_seconds |
int | 300 | 检查新帖子的时间间隔(秒) |
tieba_output_directory |
str | "data/tieba_data" | 保存帖子数据的文件夹路径 |
tieba_threads_to_retrieve |
int | 5 | 每次检查时获取的最新帖子数量 |
tieba_forum_groups |
Dict[str, List[int]] | {} | 每个贴吧特定的通知群组,格式为:{'贴吧名称': [群号1, 群号2]} |
AI 分析配置(可选)
| 配置项 | 类型 | 默认值 | 说明 |
|---|---|---|---|
tieba_ai_enabled |
bool | false | 是否启用 AI 分析 |
tieba_ai_apikey |
str | "" | AI API 密钥 |
tieba_ai_endpoint |
str | "https://api.openai.com/v1" | AI API 端点 |
tieba_ai_model |
str | "gpt-3.5-turbo" | AI 模型名称 |
tieba_ai_max_chars |
int | 100 | 发送给 AI 的最大字符数 |
tieba_ai_system_prompt |
str | (见代码) | AI 分析使用的系统提示词,用于自定义 AI 的分析行为 |
tieba_ai_filter_keys |
List[str] | ["是否包含敏感内容", "是否包含广告、营销信息"] | AI 分析结果中的关键字段(搭配系统提示词使用) |
配置示例
# 基础配置
tieba_check_interval_seconds=300
tieba_output_directory=data/tieba_data
tieba_threads_to_retrieve=10
# 贴吧监控配置 - 格式: {'贴吧名': [群号1, 群号2]}
# 例如监控"王者荣耀"贴吧并发送到群 123456789 和 987654321
tieba_forum_groups={"王者荣耀": [123456789, 987654321], "英雄联盟": [123456789]}
# AI 分析配置(可选)
tieba_ai_enabled=false
tieba_ai_apikey=your_api_key
tieba_ai_endpoint=https://api.openai.com/v1
tieba_ai_model=gpt-3.5-turbo
tieba_ai_max_chars=500
tieba_ai_filter_keys=["是否包含敏感内容", "是否包含广告、营销信息"]
tieba_ai_system_prompt="""你是一个帖子内容分析助手。分析以下内容并返回JSON格式的结果..."""
注意事项
- 请确保
.env文件中的tieba_forum_groups参数格式正确 - 若启用 AI 分析功能,请提供有效的 API 密钥
- 首次启动时,插件将立即执行一次贴吧检查
- 如需自定义 AI 提示词,请确保返回格式与默认提示词一致
更多信息
- 本插件利用
aiotieba库进行贴吧内容获取 - 使用
nonebot-plugin-apscheduler进行定时任务管理 - 插件会将帖子数据保存在配置的输出目录中
开源许可
本项目采用 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
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_tieba_monitor-0.1.0.tar.gz.
File metadata
- Download URL: nonebot_plugin_tieba_monitor-0.1.0.tar.gz
- Upload date:
- Size: 22.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6f09dabdc4c866a2641b7b7a36a87fb6282b86896bde8ae8ad9de03b2e75f8f3
|
|
| MD5 |
b9816ec26d1f4ec1d83265a680965cdf
|
|
| BLAKE2b-256 |
d164e69573a1186286f7164da132d10d549756b7b53f68689c4e77bfcf97d91e
|
File details
Details for the file nonebot_plugin_tieba_monitor-0.1.0-py3-none-any.whl.
File metadata
- Download URL: nonebot_plugin_tieba_monitor-0.1.0-py3-none-any.whl
- Upload date:
- Size: 23.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7a5f60b215cdc674caf8ed591c016765f40bb711e45af6ac6733bfc2b8935fa3
|
|
| MD5 |
d1503b6da998eb73346eca6c97783b35
|
|
| BLAKE2b-256 |
15f40b52d6f83c8da50124bc14f071ddf13a0ddc9d3bc6d063a60eca36fb99f0
|