nonebot-plugin-bili-dynamic 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- nonebot_plugin_bili_dynamic/__init__.py +57 -0
- nonebot_plugin_bili_dynamic/api.py +665 -0
- nonebot_plugin_bili_dynamic/commands.py +634 -0
- nonebot_plugin_bili_dynamic/config.py +61 -0
- nonebot_plugin_bili_dynamic/database.py +165 -0
- nonebot_plugin_bili_dynamic/link_parser.py +147 -0
- nonebot_plugin_bili_dynamic/models.py +57 -0
- nonebot_plugin_bili_dynamic/monitor.py +349 -0
- nonebot_plugin_bili_dynamic/qrcode_login.py +253 -0
- nonebot_plugin_bili_dynamic/renderer.py +1206 -0
- nonebot_plugin_bili_dynamic/translator.py +26 -0
- nonebot_plugin_bili_dynamic-0.1.0.dist-info/METADATA +199 -0
- nonebot_plugin_bili_dynamic-0.1.0.dist-info/RECORD +17 -0
- nonebot_plugin_bili_dynamic-0.1.0.dist-info/WHEEL +5 -0
- nonebot_plugin_bili_dynamic-0.1.0.dist-info/entry_points.txt +2 -0
- nonebot_plugin_bili_dynamic-0.1.0.dist-info/licenses/LICENSE +21 -0
- nonebot_plugin_bili_dynamic-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"""
|
|
2
|
+
NoneBot2 B站动态推送插件
|
|
3
|
+
基于 Colter23/bilibili-dynamic-mirai-plugin 移植
|
|
4
|
+
"""
|
|
5
|
+
from nonebot import require, logger, get_driver
|
|
6
|
+
from nonebot.plugin import PluginMetadata
|
|
7
|
+
|
|
8
|
+
require("nonebot_plugin_apscheduler")
|
|
9
|
+
|
|
10
|
+
from .config import plugin_config
|
|
11
|
+
from .database import init_db, close_db
|
|
12
|
+
from .monitor import monitor
|
|
13
|
+
from .api import bili_api
|
|
14
|
+
|
|
15
|
+
__plugin_meta__ = PluginMetadata(
|
|
16
|
+
name="B站动态推送",
|
|
17
|
+
description="低延迟检测B站动态/直播并推送到QQ群/私聊",
|
|
18
|
+
usage=(
|
|
19
|
+
"/bi help 查看帮助\n"
|
|
20
|
+
"/bi login B站扫码登录\n"
|
|
21
|
+
"/bi add <UID> 添加订阅\n"
|
|
22
|
+
"/bi del <UID> 取消订阅\n"
|
|
23
|
+
"/bi list 订阅列表\n"
|
|
24
|
+
"/bi live <UID> 直播状态\n"
|
|
25
|
+
"/bi new <UID> 最新动态"
|
|
26
|
+
),
|
|
27
|
+
type="application",
|
|
28
|
+
homepage="https://github.com/TonyLiangP2010405/nonebot-plugin-bili-dynamic",
|
|
29
|
+
config=None,
|
|
30
|
+
supported_adapters={"~onebot.v11"},
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
# 导入指令和事件(触发注册)
|
|
34
|
+
from . import commands
|
|
35
|
+
from . import link_parser
|
|
36
|
+
from . import qrcode_login
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
driver = get_driver()
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
@driver.on_bot_connect
|
|
43
|
+
async def on_bot_connect():
|
|
44
|
+
"""Bot连接后初始化"""
|
|
45
|
+
logger.info("[BiliDynamic] Bot已连接,初始化数据库...")
|
|
46
|
+
await init_db()
|
|
47
|
+
await monitor.start()
|
|
48
|
+
logger.info("[BiliDynamic] 插件已就绪!")
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
@driver.on_bot_disconnect
|
|
52
|
+
async def on_bot_disconnect():
|
|
53
|
+
"""Bot断开时清理"""
|
|
54
|
+
logger.info("[BiliDynamic] Bot断开,清理资源...")
|
|
55
|
+
await monitor.close() if hasattr(monitor, 'close') else None
|
|
56
|
+
await bili_api.close()
|
|
57
|
+
await close_db()
|