mirror of
https://github.com/Xtao-Labs/iShotaBot.git
synced 2024-11-24 00:31:30 +00:00
fix: bilibili BV filter
This commit is contained in:
parent
7f411871d1
commit
0d14b0fdfe
@ -20,7 +20,7 @@ from scheduler import scheduler
|
|||||||
@bot.on_message(
|
@bot.on_message(
|
||||||
filters.incoming
|
filters.incoming
|
||||||
& filters.text
|
& filters.text
|
||||||
& filters.regex(r"av(\d{1,12})|BV(1[A-Za-z0-9]{2}4.1.7[A-Za-z0-9]{2})|b23.tv")
|
& filters.regex(r"av(\d{1,12})|BV(\w{10})|b23.tv")
|
||||||
& ~(
|
& ~(
|
||||||
filters.command(["download", "bilibili_fav"])
|
filters.command(["download", "bilibili_fav"])
|
||||||
& (filters.user(bili_auth_user) | filters.chat(bili_auth_chat))
|
& (filters.user(bili_auth_user) | filters.chat(bili_auth_chat))
|
||||||
@ -32,7 +32,7 @@ async def bili_resolve(_: Client, message: Message):
|
|||||||
"""
|
"""
|
||||||
if "b23.tv" in message.text:
|
if "b23.tv" in message.text:
|
||||||
message.text = await b23_extract(message.text)
|
message.text = await b23_extract(message.text)
|
||||||
p = re.compile(r"av(\d{1,12})|BV(1[A-Za-z0-9]{2}4.1.7[A-Za-z0-9]{2})")
|
p = re.compile(r"av(\d{1,12})|BV(\w{10})|b23.tv")
|
||||||
video_number = p.search(message.text)
|
video_number = p.search(message.text)
|
||||||
if video_number:
|
if video_number:
|
||||||
video_number = video_number[0]
|
video_number = video_number[0]
|
||||||
|
@ -19,7 +19,7 @@ from models.services.bilifav import BiliFavAction
|
|||||||
async def bili_download_resolve(_: Client, message: Message):
|
async def bili_download_resolve(_: Client, message: Message):
|
||||||
if "b23.tv" in message.text:
|
if "b23.tv" in message.text:
|
||||||
message.text = await b23_extract(message.text)
|
message.text = await b23_extract(message.text)
|
||||||
p = re.compile(r"av(\d{1,12})|BV(1[A-Za-z0-9]{2}4.1.7[A-Za-z0-9]{2})")
|
p = re.compile(r"av(\d{1,12})|BV(\w{10})|b23.tv")
|
||||||
video_number = p.search(message.text)
|
video_number = p.search(message.text)
|
||||||
if video_number:
|
if video_number:
|
||||||
video_number = video_number[0]
|
video_number = video_number[0]
|
||||||
@ -80,9 +80,14 @@ async def bili_download_resolve_cb(_: Client, callback_query: CallbackQuery):
|
|||||||
video = create_video(video_number)
|
video = create_video(video_number)
|
||||||
if video_db := await BiliFavAction.get_by_bv_id(video.get_bvid()):
|
if video_db := await BiliFavAction.get_by_bv_id(video.get_bvid()):
|
||||||
await callback_query.answer("找到缓存")
|
await callback_query.answer("找到缓存")
|
||||||
|
caption = (
|
||||||
|
f"详细信息:https://t.me/{bilifav_channel_username}/{video_db.message_id}"
|
||||||
|
if video_db.message_id
|
||||||
|
else None
|
||||||
|
)
|
||||||
await callback_query.message.reply_video(
|
await callback_query.message.reply_video(
|
||||||
video_db.file_id,
|
video_db.file_id,
|
||||||
caption=f"详细信息:https://t.me/{bilifav_channel_username}/{video_db.message_id}",
|
caption=caption,
|
||||||
quote=True,
|
quote=True,
|
||||||
)
|
)
|
||||||
raise ContinuePropagation
|
raise ContinuePropagation
|
||||||
|
Loading…
Reference in New Issue
Block a user