NoneBot-Adapter-BiliBili-Live
B 站直播间协议支持
配置
修改 NoneBot 配置文件 .env 或者 .env.*。
Driver
请参考 driver 配置项,添加 HTTPClient 和 WebSocketClient 支持。如:
DRIVER=~httpx+~websockets
DRIVER=~aiohttp
BILIBILI_LIVE_BOTS
用户 Bot (Web API)
cookie机器人账号的 Cookies,需要存在SESSDATA(必须) 和bili_jct(用于一些 API 调用)。room_ids监听的直播间房间号列表,长短号均可。
类型为 WebBot。
开放平台 Bot
access_key开放平台提供的access_keyaccess_secret开放平台提供的access_secretapp_id项目 ID,在此处查看identify_codes主播身份码列表,主播身份码可以在幻星-互动玩法页面右下角 身份码 查看
类型为 OpenBot。
开放平台 Bot 无法调用任何 API。
示例
用户 Bot 配置示例:
BILIBILI_LIVE_BOTS='
[
{
"cookie": "SESSDATA=xxxxxxxxxxxxxxxx; bili_jct=xxxxxxxxxxxxx;",
"room_ids": [544853]
}
]
'
开放平台 Bot 配置示例:
BILIBILI_LIVE_BOTS='
[
{
"access_key": "xxxxxxxxxxxxxxxxxxxx",
"access_secret": "xxxxxxxxxxxxxxxxxxxx",
"app_id": 100000,
"identify_codes": ["xxxxxxxxxxxxxxxxxxxx"]
}
]
'
实现
标斜体的为用户 Bot 和开放平台 Bot 共有实现,粗体的为开放平台 Bot 独有实现(继承 OpenplatformOnlyEvent),其他为用户 Bot 独有实现(继承 WebOnlyEvent)。
来自开放平台的事件的 uid 均为 0,相应的存在 open_id 字段。
获取用户 ID 建议使用 event.get_user_id() 方法,而不是 event.uid 或 event.open_id。
消息类事件
DanmakuEvent弹幕消息SuperChatEvent醒目留言。来自开放平台的会被认为是to_me;来自用户 Bot 的当 Bot 为主播账号时会被认为是to_me。
通知类事件
用户互动
UserEnterEvent用户进入直播间UserFollowEvent用户关注主播UserShareEvent用户分享直播间LikeEvent点赞InteractionVote投票互动事件InteractionDanmaku弹幕互动事件InteractionFollow关注互动事件InteractionGift送礼互动事件InteractionShare分享互动事件InteractionLike点赞互动事件
礼物相关
SendGiftEvent送礼GuardBuyEvent上舰通知GuardBuyToastEvent用户庆祝消息SpecialGiftEvent特殊礼物GiftStarProcessEvent礼物星球点亮
直播状态
OpenLiveStartEvent开播事件OpenLiveEndEvent下播事件WebLiveStartEvent直播开始OnlineRankEvent高能榜更新OnlineRankCountEvent高能用户数量OnlineRankTopEvent到达直播间高能榜前三名LikeInfoUpdateEvent点赞数更新WatchedChangeEvent看过人数StopLiveRoomListEvent下播的直播间
直播间管理
RoomRealTimeMessageUpdateEvent主播信息更新RoomChangeEvent直播间信息更改ChangeRoomInfoEvent直播间背景图片修改RoomSkinMsgEvent直播间皮肤变更RoomSilentOnEvent开启等级禁言RoomSilentOffEvent关闭等级禁言RoomBlockMsgEvent指定观众禁言RoomAdminsEvent房管列表RoomAdminEntranceEvent设立房管RoomAdminRevokeEvent撤销房管
排行榜
PopularRankChangedEvent直播间在人气榜的排名改变HotRankChangedEvent直播间限时热门榜排名改变HotRankSettlementEvent限时热门榜上榜信息AreaRankChangedEvent直播间在所属分区的排名改变
元事件
HeartbeatEvent心跳包,包含人气值LIVE_OPEN_PLATFORM_INTERACTION_END开放平台互动结束事件。此事件不会进入 NoneBot 事件处理流程,会由适配器自行捕获。
API 实现
API 仅限用户 Bot。
弹幕发送
send_danmaku()发送弹幕消息
直播间信息
get_room_info()获取直播间详细信息get_user_room_status()获取用户对应的直播间状态get_master_info()获取主播信息
用户管理
add_silent_user()禁言观众get_silent_user_list()查询直播间禁言列表del_silent_user()解除禁言
代码实现参考
Metadata
Release files for nonebot-adapter-bilibili-live 0.2.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| nonebot_adapter_bilibili_live-0.2.6.tar.gz | 32.7 kB | Without provenance | Details for nonebot_adapter_bilibili_live-0.2.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nonebot_adapter_bilibili_live-0.2.6-py3-none-any.whl | Python 3 | none | any | Details for nonebot_adapter_bilibili_live-0.2.6-py3-none-any.whl |
Total release size: 69.1 kB
Release files / nonebot_adapter_bilibili_live-0.2.6.tar.gz
| Download URL | nonebot_adapter_bilibili_live-0.2.6.tar.gz |
|---|---|
| Size | 32.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c432f2dafa39f7a450506376140ff130b31cdb46583ccd20961d7ba9a920e958
|
|
BLAKE2b-256 checksum How to use checksums |
66dbadcdbc8371842a9976473f3a997d159ed1c72ef70e822097a379b08fe1e5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / nonebot_adapter_bilibili_live-0.2.6-py3-none-any.whl
| Download URL | nonebot_adapter_bilibili_live-0.2.6-py3-none-any.whl |
|---|---|
| Size | 36.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
76d9ea0a60f8685ab18bced226cacf449ff236996a138b78eef2cc000a0d1d7d
|
|
BLAKE2b-256 checksum How to use checksums |
18ad0595b2bcc42eb655d64c09b1791920f871c2d3fbfaed165a0b82c58d3872
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for nonebot-adapter-bilibili-live 0.2.6
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.