Skip to content

Commit

Permalink
Merge pull request breakdowns#17 from brutewooorse/patch-1
Browse files Browse the repository at this point in the history
Use bot session_string
  • Loading branch information
breakdowns authored Mar 9, 2021
2 parents 7244121 + d023e2c commit c07b135
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions bot/helper/mirror_utils/download_utils/telegram_downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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()
Expand All @@ -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:
Expand Down

0 comments on commit c07b135

Please sign in to comment.