diff --git a/bot/helper/mirror_utils/download_utils/telegram_downloader.py b/bot/helper/mirror_utils/download_utils/telegram_downloader.py index b35f7f3ddcd..259466b19ca 100644 --- a/bot/helper/mirror_utils/download_utils/telegram_downloader.py +++ b/bot/helper/mirror_utils/download_utils/telegram_downloader.py @@ -23,10 +23,10 @@ def __init__(self, listener): self.__name = "" self.__gid = '' self.__start_time = time.time() - self.__user_bot = Client(api_id=TELEGRAM_API, + self._bot = Client(api_id=TELEGRAM_API, api_hash=TELEGRAM_HASH, session_name=USER_SESSION_STRING) - self.__user_bot.start() + self._bot.start() self.__is_cancelled = False @property @@ -53,7 +53,7 @@ def __onDownloadStart(self, name, size, file_id): def __onDownloadProgress(self, current, total): if self.__is_cancelled: self.__onDownloadError('Cancelled by user!') - self.__user_bot.stop_transmission() + self._bot.stop_transmission() return with self.__resource_lock: self.downloaded_bytes = current @@ -76,7 +76,7 @@ def __onDownloadComplete(self): self.__listener.onDownloadComplete() def __download(self, message, path): - download = self.__user_bot.download_media(message, + download = self._bot.download_media(message, progress=self.__onDownloadProgress, file_name=path) if download is not None: self.__onDownloadComplete() @@ -85,7 +85,7 @@ def __download(self, message, path): self.__onDownloadError('Internal error occurred') def add_download(self, message, path): - _message = self.__user_bot.get_messages(message.chat.id, message.message_id) + _message = self._bot.get_messages(message.chat.id, message.message_id) media = None media_array = [_message.document, _message.video, _message.audio] for i in media_array: