async def force_play_music(msg: Message): """ Force play music in voice call """ if not PLAYING: return await play_music(msg) if msg.input_str: if yt_regex.match(msg.input_str): QUEUE.insert(0, msg) else: mesg = await reply_text(msg, f"Searching `{msg.input_str}` on YouTube") title, link = await _get_song(msg.input_str) if link: await mesg.delete() msg.text = f"[{title}]({link})" QUEUE.insert(0, msg) else: await mesg.edit("No results found.") return elif msg.reply_to_message and msg.reply_to_message.audio: replied = msg.reply_to_message setattr(replied, '_client', msg.client) QUEUE.insert(0, replied) else: return await reply_text(msg, "Input not found") await _skip()
async def play_music(msg: Message): """ play music in voice call """ if msg.input_str: if yt_regex.match(msg.input_str): if PLAYING: msg = await reply_text(msg, _get_scheduled_text("Song", msg.input_str)) QUEUE.append(msg) else: mesg = await reply_text(msg, f"Searching `{msg.input_str}` on YouTube") title, link = await _get_song(msg.input_str) if link: await mesg.delete() if PLAYING: msg = await reply_text(msg, _get_scheduled_text(title, link)) else: msg.text = f"[{title}]({link})" QUEUE.append(msg) else: await mesg.edit("No results found.") elif msg.reply_to_message and msg.reply_to_message.audio: replied = msg.reply_to_message QUEUE.append(replied) if PLAYING: await reply_text(msg, _get_scheduled_text(replied.audio.title, replied.link)) else: return await reply_text(msg, "Input not found") if not PLAYING: await handle_queue()
async def convert_(message: Message): """ convert telegram files """ await message.edit("`Trying to Convert ...`") if message.reply_to_message and message.reply_to_message.media: message.text = '' if message.reply_to_message.document else ". -d" await _handle_message(message) else: await message.err("reply to media to convert it")
async def convert_(message: Message): """ convert telegram files """ await message.edit("`Trying to Convert ...`") if message.reply_to_message and message.reply_to_message.media: message.text = "" if message.reply_to_message.document else ". -d" await _handle_message(message) else: await message.edit("Please read `.help convert`", del_in=5)
async def convert_(message: Message): """ convert telegram files """ await message.edit("<b> Trying to Convert </b>") if message.reply_to_message and message.reply_to_message.media: message.text = '' if message.reply_to_message.document else ". -d" await _handle_message(message) else: await message.edit("Please read `/help convert`")
async def convert_(message: Message): """ convert telegram files """ await message.edit("`Trying to Convert ...`") if message.reply_to_message and message.reply_to_message.media: message.text = "" if message.reply_to_message.document else ". -d" try: dl_loc, _ = await tg_download(message, message.reply_to_message) except ProcessCanceled: await message.edit("`Process Canceled!`", del_in=5) except Exception as e_e: # pylint: disable=broad-except await message.err(e_e) else: await message.delete() await upload(message, Path(dl_loc), True) else: await message.edit("Please read `.help convert`", del_in=5)
async def convert_(message: Message): """ convert telegram files """ await message.edit("`Trying to Convert ...`") if message.reply_to_message and message.reply_to_message.media: dl_loc = await message.client.download_media( message=message.reply_to_message, file_name=Config.DOWN_PATH, progress=progress, progress_args=(message, "trying to download")) if message.process_is_canceled: await message.edit("`Process Canceled!`", del_in=5) else: await message.delete() dl_loc = os.path.join(Config.DOWN_PATH, os.path.basename(dl_loc)) message.text = '' if message.reply_to_message.document else ". -d" await upload(message, Path(dl_loc), True) else: await message.edit("Please read `.help convert`", del_in=5)