QQ 群点歌 bot:选歌菜单 + 歌曲卡片 + 回调按钮
基于 qqbotsdk 的群点歌机器人: - 点歌 <歌名>:Markdown 选歌菜单,每行 5 个编号回调按钮 + 上下页 (每页 MENU_PAGE_SIZE 首,默认 10,受内嵌键盘 5 行限制上限 20) - 点编号弹歌曲卡片:[▶播放] 发语音 / [⬇下载] 发文件或直链(SEND_MODE) - 支持不 @ 机器人也能触发(GROUP_MESSAGE_CREATE 全量模式), 按 msg_id 排重并拦截机器人自发消息回推(self-echo) - 直链候选源回退:tx 等源受 CDN 风控时按 kw/wy/mg 逐个换源 - 自动撤回(WITHDRAW)翻页撤旧菜单、选歌撤菜单、点击后撤卡片
This commit is contained in:
commit
7a8adb4571
15 files changed
+2652
No files matched your search
@@ -0,0 +1,26 @@
|
||||
"""装配入口:注册命令并运行 bot。"""
|
||||
|
||||
import asyncio
|
||||
|
||||
from aiohttp import ClientSession
|
||||
from loguru import logger
|
||||
from qqbotsdk import EventEmitter, run_loop
|
||||
|
||||
from .config import BotConfig
|
||||
from .music import register
|
||||
|
||||
|
||||
async def amain() -> None:
|
||||
config = BotConfig.load()
|
||||
ee = EventEmitter() # 队列由 emitter 自建,run_loop 复用同一实例
|
||||
# bot 自建连接池:直链探测不受 SDK 的 TIMEOUT 约束
|
||||
async with ClientSession() as http:
|
||||
register(ee, config, http)
|
||||
await run_loop(ee)
|
||||
|
||||
|
||||
def main() -> None:
|
||||
try:
|
||||
asyncio.run(amain())
|
||||
except KeyboardInterrupt:
|
||||
logger.info("musicbot 已退出")
|
||||
Reference in new issue
Block a user