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 import asyncio
from logging import getLogger 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__) LOGGER = getLogger(__name__)
@ -32,7 +32,7 @@ async def editPesan(msg, text, **kwargs):
LOGGER.warning(str(e)) LOGGER.warning(str(e))
await asyncio.sleep(e.value) await asyncio.sleep(e.value)
return await editPesan(msg, text, **kwargs) return await editPesan(msg, text, **kwargs)
except (MessageNotModified, MessageIdInvalid): except (MessageNotModified, MessageIdInvalid, MessageEmpty):
return return
except Exception as e: except Exception as e:
LOGGER.error(str(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" 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: if len(msg.encode("utf-8")) > 4096:
body_text = f""" body_text = f"""
<pre>{msg}</pre> <pre>{msg.replace("<user_id>", "(user_id)")}</pre>
""" """
msg = await post_to_telegraph(False, method, body_text) msg = await post_to_telegraph(False, method, body_text)
datajson.append( datajson.append(

View file

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