This commit is contained in:
yasir 2023-02-20 18:56:47 +07:00
parent ee6fd74c3f
commit a6ef59ec4e
3 changed files with 13 additions and 10 deletions

View file

@ -1,7 +1,7 @@
import asyncio
from logging import getLogger
from pyrogram.errors import ChatWriteForbidden, FloodWait, MessageNotModified, ChatAdminRequired, MessageDeleteForbidden, MessageIdInvalid
from pyrogram.errors import ChatWriteForbidden, FloodWait, MessageNotModified, ChatAdminRequired, MessageDeleteForbidden, MessageIdInvalid, MessageEmpty
LOGGER = getLogger(__name__)
@ -32,7 +32,7 @@ async def editPesan(msg, text, **kwargs):
LOGGER.warning(str(e))
await asyncio.sleep(e.value)
return await editPesan(msg, text, **kwargs)
except (MessageNotModified, MessageIdInvalid):
except (MessageNotModified, MessageIdInvalid, MessageEmpty):
return
except Exception as e:
LOGGER.error(str(e))

View file

@ -127,7 +127,7 @@ async def inline_menu(_, inline_query: InlineQuery):
msg += f"<code>{i['name']}</code> (<b>{i['types'][0]}</b>)\n<b>Required:</b> <code>{i['required']}</code>\n{i['description']}\n\n"
if len(msg.encode("utf-8")) > 4096:
body_text = f"""
<pre>{msg}</pre>
<pre>{msg.replace("<user_id>", "(user_id)")}</pre>
"""
msg = await post_to_telegraph(False, method, body_text)
datajson.append(

View file

@ -69,13 +69,16 @@ async def ytdownv2(_, message):
return await message.reply("Please input a valid YT-DLP Supported URL")
url = message.text.split(" ", maxsplit=1)[1]
async with iYTDL(log_group_id=0, cache_path="cache", ffmpeg_location="/usr/bin/mediaextract") as ytdl:
x = await ytdl.parse(url)
if x is None:
return await message.reply("Failed parse URL, check logs..")
img = await get_ytthumb(x.key)
caption = x.caption
markup = x.buttons
await message.reply_photo(img, caption=caption, reply_markup=markup, quote=True)
try:
x = await ytdl.parse(url)
if x is None:
return await message.reply("Failed parse URL, check logs..")
img = await get_ytthumb(x.key)
caption = x.caption
markup = x.buttons
await message.reply_photo(img, caption=caption, reply_markup=markup, quote=True)
except Exception as err:
await kirimPesan(message, str(err))
@app.on_callback_query(filters.regex(r"^yt_listall"))