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(