forked from mttu-developers/konabot
25 lines
671 B
Python
25 lines
671 B
Python
import re
|
|
from loguru import logger
|
|
from nonebot import on_message
|
|
from nonebot_plugin_alconna import UniMsg
|
|
|
|
from nonebot.adapters import Event
|
|
|
|
|
|
matcher_fix = on_message()
|
|
|
|
pattern = (
|
|
r"^(?:(?:av|cv)\d+|BV[a-zA-Z0-9]{10})|"
|
|
r"(?:b23\.tv|bili(?:22|23|33|2233)\.cn|\.bilibili\.com|QQ小程序(?:]|]|\])哔哩哔哩).{0,500}"
|
|
)
|
|
|
|
|
|
@matcher_fix.handle()
|
|
async def _(msg: UniMsg, event: Event):
|
|
if not re.search(pattern, msg.extract_plain_text()):
|
|
return
|
|
logger.info("检测到有 Bilibili 相关的消息,直接进行一个调用")
|
|
_module = __import__("nonebot_plugin_analysis_bilibili")
|
|
await _module.handle_analysis(event)
|
|
|