Skip to main content

NoneBot2 plugin for Bilibili live group subscriptions powered by nonebot-adapter-bilibili-live.

Project description

nonebot-plugin-bilibili-live-notify

基于 nonebot-adapter-bilibili-live 的 NoneBot2 插件,专注于 QQ 群内的 B 站直播订阅管理:

  • 群管理员订阅直播间
  • 群成员自行加入或退出提醒名单
  • 开播 / 下播自动推送
  • 按参与成员进行 @ 提醒
  • 本地持久化订阅状态

直接消费 nonebot-adapter-bilibili-live 提供的直播事件。

前置要求

  • NoneBot2 >= 2.4.2
  • nonebot-adapter-onebot
  • nonebot-adapter-bilibili-live

推荐使用 bilibili-live 适配器的 Web Bot 模式,因为可以直接按房间号监听。

安装

使用 nb 安装:

nb plugin install nonebot-plugin-bilibili-live-notify

或使用 pip 安装:

pip install nonebot-plugin-bilibili-live-notify

然后在 NoneBot 中加载插件:

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

配置

插件自身只需要一个可选配置项:

BILIBILI_LIVE_NOTIFY_DATA_FILE=.data/nonebot_plugin_bilibili_live_notify/subscriptions.json
BILIBILI_LIVE_NOTIFY_MANAGED_ROOMS_FILE=.data/nonebot_plugin_bilibili_live_notify/managed_rooms.json
BILIBILI_LIVE_NOTIFY_EXPORT_FILE=.data/nonebot_plugin_bilibili_live_notify/generated_bilibili_live_bots.json
  • BILIBILI_LIVE_NOTIFY_DATA_FILE: 自定义订阅数据文件路径;默认由 nonebot-plugin-localstore 管理
  • BILIBILI_LIVE_NOTIFY_MANAGED_ROOMS_FILE: 维护待监听房间列表的文件路径
  • BILIBILI_LIVE_NOTIFY_EXPORT_FILE: 导出的 BILIBILI_LIVE_BOTS 配置文件路径

直播事件来源由 nonebot-adapter-bilibili-live 提供,你还需要配置它的 BILIBILI_LIVE_BOTS

Web Bot 示例:

DRIVER=~httpx+~websockets
BILIBILI_LIVE_BOTS='
[
  {
    "cookie": "SESSDATA=xxxxxxxxxxxxxxxx; bili_jct=xxxxxxxxxxxxx;",
    "room_ids": [711308, 12345]
  }
]
'

使用说明

在群内使用:

订阅直播 711308 狂肝无尽狂潮
参与直播 711308
直播订阅列表

支持指令:

  • 直播帮助
  • 订阅直播 <房间号> [备注]
  • 取消订阅直播 <房间号|备注>
  • 备注直播 <房间号|旧备注> <新备注>
  • 直播监听列表
  • 更新直播监听配置
  • 导出直播监听配置
  • 参与直播 <房间号|备注>
  • 取消参与直播 <房间号|备注>
  • 直播订阅列表
  • 我参与的直播

重要说明

nonebot-adapter-bilibili-live 静态监听房间配置,本插件会额外维护一份“待监听房间列表”:

  1. 群里执行 订阅直播 时,如果该房间尚未被适配器监听,插件会自动把它加入待监听列表。
  2. 插件会立刻尝试在当前进程里补挂监听,并自动刷新导出的适配器配置文件。
  3. 管理员通常只需要正常订阅;只有在想检查状态时再用 直播监听列表,或在自动补挂失败时手动执行 更新直播监听配置
  4. 如果希望下次重启后仍然保留这些房间,再将自动导出的文件内容同步到 BILIBILI_LIVE_BOTS

说明:

  • 为了避免在群消息里直接暴露 Cookie,插件会把导出结果写到本地文件,而不是直接回显完整配置。
  • 当前默认会把“待监听房间”并入第一个可用的 bilibili-live Web Bot 配置中。
  • 更新直播监听配置 依赖适配器内部实现做运行时补挂,适合提升使用体验;真正的长期持久化仍以导出后的 BILIBILI_LIVE_BOTS 为准。
  • 插件在订阅和取消订阅后都会自动刷新导出文件,因此通常不需要再手动执行 导出直播监听配置

定位

nonebot-adapter-bilibili-live 负责“监听直播事件”。

本插件负责“群订阅管理、成员报名、按参与名单提醒、下播通知、持久化”。

License

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_bilibili_live_notify-0.2.0.tar.gz (15.5 kB view details)

Uploaded Source

Built Distribution

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

File details

Details for the file nonebot_plugin_bilibili_live_notify-0.2.0.tar.gz.

File metadata

File hashes

Hashes for nonebot_plugin_bilibili_live_notify-0.2.0.tar.gz
Algorithm Hash digest
SHA256 1f20d2191b8eb924212d0f758ba652aead59e6ea12db35b3adfc9bc3a4574acf
MD5 e3e400506e9beae021717f955a4ab0ff
BLAKE2b-256 5443cf47906c387e37c07f9ff312f2a45a0f573b3d1982010d6df98c2a3ec695

See more details on using hashes here.

Provenance

The following attestation bundles were made for nonebot_plugin_bilibili_live_notify-0.2.0.tar.gz:

Publisher: publish.yml on ArisaTaki/nonebot-plugin-bilibili-live-notify

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nonebot_plugin_bilibili_live_notify-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for nonebot_plugin_bilibili_live_notify-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7c2e3246e9d9f473e355a2673d95deae482d5facae81002cc4071a67d1b6a9e1
MD5 41aae9afe2d63eeb9d09d2f7b97f12f7
BLAKE2b-256 25073bbcfd2a30a9b69ae910d34611ce87796564cf817eae2e8d14996bcd918d

See more details on using hashes here.

Provenance

The following attestation bundles were made for nonebot_plugin_bilibili_live_notify-0.2.0-py3-none-any.whl:

Publisher: publish.yml on ArisaTaki/nonebot-plugin-bilibili-live-notify

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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