Archived
1
0
Fork 0
This commit is contained in:
多羅狼 2023-07-03 11:54:17 +08:00 committed by GitHub
parent d0b6f9d199
commit 06adee068e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 1 deletions

View file

@ -40,4 +40,34 @@ async def _(msg: Bot.MessageSession):
res = msg.matched_msg
if res:
url = f"{api_url}?bvid={res.group()}"
await get_info(msg, url, get_detail=False)
@bili.handle(re.compile(r"(https?://)?(www|m).bilibili\.com/(av\d+|BV[A-Za-z0-9]{10}"),
desc="{bilibili.help.regex.url}")
async def _(msg: Bot.MessageSession):
res = msg.matched_msg
if res:
video = res.groups()[2]
if video[:2] == "BV":
url = f"{api_url}?bvid={video}"
else:
url = f"{api_url}?aid={video[2:]}"
await get_info(msg, url, get_detail=False)
@bili.handle(re.compile(r"(https?://)?b23\.tv/(av\d+|BV[A-Za-z0-9]{10}|[A-Za-z0-9]{7})"),
desc="{bilibili.help.regex.shorturl}")
async def _(msg: Bot.MessageSession):
res = msg.matched_msg
if res:
video = res.groups()[1]
if video[:2] == "BV":
url = f"{api_url}?bvid={video}"
elif video[:2] == "av":
url = f"{api_url}?aid={video[2:]}"
else:
...
await get_info(msg, url, get_detail=False)

View file

@ -33,7 +33,7 @@ async def regex_bugtracker(msg: Bot.MessageSession):
await msg.sendMessage(Image(screenshot))
@bug.regex(re.compile(r'(http[s]://)?bugs\.mojang\.com/(?:browse/(.*?-\d*)|projects/.*?/issues/(.*?-\d*))'),
@bug.regex(re.compile(r'(https?://)?bugs\.mojang\.com/(?:browse/(.*?-\d*)|projects/.*?/issues/(.*?-\d*))'),
mode='A', desc='{bugtracker.help.regex.url}')
async def _(msg: Bot.MessageSession):
async def bgtask(msg: Bot.MessageSession):