x
This commit is contained in:
parent
d0b6f9d199
commit
06adee068e
2 changed files with 31 additions and 1 deletions
|
@ -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)
|
|
@ -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):
|
||||
|
|
Reference in a new issue