Files
limoka/SekaiYoneya/Friendly-telegram/SearchMusic.py
2025-07-10 21:02:34 +03:00

25 lines
1.1 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# @Sekai_Yoneya
from .. import loader, utils
@loader.tds
class SearchMusicMod(loader.Module):
"""
Модуль SearchMusic - поиск музыки
Работает через бота @lybot
"""
strings = {"name": "SearchMusic"}
async def smcmd(self, message):
"""Используй: .sm «название» чтобы найти музыку по названию."""
args = utils.get_args_raw(message)
reply = await message.get_reply_message()
if not args:
return await message.edit("<b>Нету аргументов.</b>")
try:
await message.edit("<b>Загрузка...</b>")
music = await message.client.inline_query('lybot', args)
await message.delete()
await message.client.send_file(message.to_id, music[0].result.document, reply_to=reply.id if reply else None)
except: return await message.client.send_message(message.chat_id, f"<b>Музыка с названием <code>{args}</code> не найдена.</b>")