main
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3from pyrogram.client import Client
4from pyrogram.types import Message
5
6from bridge.social import send_to_social_media_bridge
7from messages.sender import send2tg
8
9
10async def preview_music163(client: Client, message: Message, url: str = "", **kwargs):
11 """Preview music163 link in the message.
12
13 Args:
14 client (Client): The Pyrogram client.
15 message (Message): The trigger message object.
16 url (str, optional): Netease Music link.
17 """
18 status_msg = f"🔗正在解析Netease Music链接:\n{url}\n\n"
19 status_msg += "🤖调用第三方服务: @Music163bot\n"
20 status_msg += "您还可以发送歌曲名给 @VmomoVBot"
21 if kwargs.get("show_progress") and "progress" not in kwargs:
22 res = await send2tg(client, message, texts=status_msg, **kwargs)
23 kwargs["progress"] = res[0]
24 kwargs |= {"target_mid": message.id} # record the trigger msg_id as target_mid in kwargs
25 await send_to_social_media_bridge(client, message, url, **kwargs)