From 90d663b00b935c286c591ca1580d3222c0d1a0ee Mon Sep 17 00:00:00 2001 From: thedragonsinn <98635854+thedragonsinn@users.noreply.github.com> Date: Fri, 15 Dec 2023 15:12:55 +0530 Subject: [PATCH] Catch Telegraph acc creation Error. --- app/utils/helpers.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/app/utils/helpers.py b/app/utils/helpers.py index 41a4a51..2496321 100644 --- a/app/utils/helpers.py +++ b/app/utils/helpers.py @@ -1,23 +1,26 @@ +import os import time from pyrogram.types import Message, User from telegraph.aio import Telegraph -from app import Config +from app import Config, LOGGER from app.utils.media_helper import bytes_to_mb TELEGRAPH: None | Telegraph = None PROGRESS_DICT = {} -""" + async def init_task(): global TELEGRAPH TELEGRAPH = Telegraph() - await TELEGRAPH.create_account( - short_name="Plain-UB", author_name="Plain-UB", author_url=Config.UPSTREAM_REPO - ) -""" + try: + await TELEGRAPH.create_account( + short_name="Plain-UB", author_name="Plain-UB", author_url=Config.UPSTREAM_REPO + ) + except Exception as e: + LOGGER.error("Failed to Create Telegraph Account.") async def post_to_telegraph(title: str, text: str): telegraph = await TELEGRAPH.create_page(