Skip to main content

nonebot-plugin-juzimi-anime-poke

NoneBotPluginLogo

NoneBotPluginText

✨ 戳一戳机器人,送你一句动漫语录 ✨

license pypi python

适用于 QQ 群聊的 NoneBot2 插件。当群友在群里戳一戳(双击头像)机器人时,机器人会自动回复一句动漫/二次元相关语录。也支持主动发送命令获取语录。

⚠️ 数据源说明:原 juzimi.com(句子迷)因技术升级暂时停止访问,本插件使用 juzikong.com(句子控) 的「二次元经典语录」专辑作为数据源。


📖 功能

  • 戳一戳触发:群里戳机器人 → 自动回复动漫语录
  • 命令触发:/动漫语录、/anime_quote、/二次元语录
  • 异步爬取:从句子控网站实时爬取动漫语录
  • 本地缓存:JSON 缓存,避免高频请求网站
  • 冷却机制:戳一戳和命令独立冷却,防止刷屏
  • 异常兜底:网络失败时使用内置语录库,不报错崩溃

💿 安装

使用 nb-cli

nb plugin install nonebot-plugin-juzimi-anime-poke

使用 pip

pip install nonebot-plugin-juzimi-anime-poke

然后在 pyproject.toml 中添加:

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

⚙️ 配置

在 .env 文件中添加:

配置项 必填 默认值 说明
juzimi_cache_expire_hours 否 24 缓存过期时间(小时)
juzimi_min_cache_count 否 20 缓存少于多少条时触发重新爬取
juzimi_max_pages 否 3 每次最多爬取多少页
juzimi_request_timeout 否 10 请求超时时间(秒)
juzimi_poke_cd 否 10 戳一戳冷却时间(秒),按群计算
juzimi_command_cd 否 5 命令冷却时间(秒),按群/用户计算
juzimi_at_user 否 False 回复时是否 @ 触发用户

🎉 使用

戳一戳触发

在 QQ 群里双击机器人头像(戳一戳),机器人会回复一句动漫语录。

示例回复:

被戳到了!送你一句:
「人永远不知道,谁哪次不经意的跟你说了再见之后,就真的不会再见了。」

主动命令

发送以下任一命令:

  • /动漫语录
  • /anime_quote
  • /二次元语录

示例:

/动漫语录

→ 「如果时光可以倒流,我还是会选择认识你,虽然会伤痕累累,但是心中的温暖记忆是谁都无法给予的。」

📁 项目结构

nonebot_plugin_juzimi_anime_poke/
├── __init__.py      # 插件入口:戳一戳监听、命令监听
├── config.py        # Pydantic 配置模型
├── crawler.py       # 异步爬虫(httpx + BeautifulSoup)
├── cache.py         # JSON 缓存读写
├── models.py        # 数据模型(Quote、CacheData)
├── README.md        # 本文件
└── pyproject.toml   # 项目配置

🕷️ 爬虫原理

  1. 使用 httpx.AsyncClient 异步请求句子控网站
  2. 页面使用 Nuxt.js SSR,语录数据注入在 window.__NUXT__ 中
  3. 通过正则提取 content:"..." 模式解析语录
  4. 请求间隔 1-3 秒随机延迟,避免对网站造成压力
  5. 爬取结果存入 ~/.local/share/nonebot2/juzimi_anime_poke/anime_quotes.json
  6. 优先使用缓存,缓存过期/不足时才重新爬取

⚠️ 注意事项

  1. 本插件仅用于个人学习和低频自用,不应高频请求句子控网站。
  2. 请遵守目标网站的服务条款和版权要求。
  3. 不要把爬取内容用于商业用途。
  4. 爬取频率受 juzimi_max_pages 和延迟控制,默认每次最多请求 3 页,间隔 1-3 秒。

📋 更新日志

[0.1.0] - 2026-05-18

  • 首次发布
  • 戳一戳触发动漫语录回复
  • 支持主动命令 /动漫语录、/anime_quote
  • 异步爬取 + JSON 缓存 + 冷却机制

📄 许可证

本项目使用 MIT License 开源。

Metadata

Release files for nonebot-plugin-juzimi-anime-poke 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nonebot-plugin-juzimi-anime-poke 0.1.0
File Size Uploaded Provenance Actions
nonebot_plugin_juzimi_anime_poke-0.1.0.tar.gz 10.9 kB Without provenance Details for nonebot_plugin_juzimi_anime_poke-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nonebot-plugin-juzimi-anime-poke 0.1.0
File Interpreter ABI Platform Actions
nonebot_plugin_juzimi_anime_poke-0.1.0-py3-none-any.whl Python 3 none any Details for nonebot_plugin_juzimi_anime_poke-0.1.0-py3-none-any.whl

Total release size: 25.2 kB

Release files / nonebot_plugin_juzimi_anime_poke-0.1.0.tar.gz

Download URL nonebot_plugin_juzimi_anime_poke-0.1.0.tar.gz
Size 10.9 kB
Tags Source
SHA-256 checksum
How to use checksums
cd5440cf685d30535b23bfd0f310686bf401335e314a4325355a2380db0557eb
BLAKE2b-256 checksum
How to use checksums
c7a704a4e66756c2888a4bc323baed7abdc5e54d793cc4166c4f4fc950dd0bed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.7

Release files / nonebot_plugin_juzimi_anime_poke-0.1.0-py3-none-any.whl

Download URL nonebot_plugin_juzimi_anime_poke-0.1.0-py3-none-any.whl
Size 14.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e8428a1e830a4501fe1a436f02b9d1d2c85e7d6c348a379080e6f3c8c7fc3630
BLAKE2b-256 checksum
How to use checksums
97850c520931c16fadd25021cc24a25c9c2ea53b7dd04043650d52bc2a0bd021
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.7

Security for nonebot-plugin-juzimi-anime-poke 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page