catch err

This commit is contained in:
Yasir Aris M 2023-09-27 21:59:19 +07:00 committed by GitHub
parent d4753fe5bc
commit b1b10ba246
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 7 deletions

View file

@ -6,9 +6,6 @@ from pyrogram.errors import FloodWait
from pyrogram.types import InputMediaPhoto
from misskaty.plugins.dev import shell_exec
from logging import getLogger
LOGGER = getLogger(__name__)
def hhmmss(seconds):
@ -18,8 +15,7 @@ def hhmmss(seconds):
async def take_ss(video_file):
out_put_file_name = f"genss-{str(time.time())}.png"
cmd = f"""vcsi "{video_file}" -t -w 1340 -g 4x4 --timestamp-font assets/DejaVuSans.ttf --metadata-font assets/DejaVuSans-Bold.ttf --template misskaty/helper/ssgen_template.html --quality 100 --end-delay-percent 20 --metadata-font-size 30 -o {out_put_file_name} --timestamp-font-size 20"""
r = await shell_exec(cmd)
LOGGER.info(r)
await shell_exec(cmd)
return out_put_file_name if os.path.lexists(out_put_file_name) else None

View file

@ -253,9 +253,15 @@ async def generate_session(bot, msg, telethon=False, is_bot: bool = False):
reply_markup=InlineKeyboardMarkup(gen_button),
)
elif telethon:
await client.start(bot_token=phone_number)
try:
await client.start(bot_token=phone_number)
except Exception as err:
return await msg.reply(err)
else:
await client.sign_in_bot(phone_number)
try:
await client.sign_in_bot(phone_number)
except Exception as err:
return await msg.reply(err)
if telethon:
string_session = client.session.save()
else: