def onUploadComplete(self, link: str, size): with download_dict_lock: msg = f'<b>๐ ๐๐ถ๐น๐ฒ๐ก๐ฎ๐บ๐ฒ : </b><code>{download_dict[self.uid].name()}</code>\n<b>๐ฆ ๐๐จ๐ญ๐๐ฅ ๐๐ข๐ณ๐ : </b><code>{size}</code>\n' \ f' \n' \ f'๐ MXT MIRROR ZonE\n' \ f' \n' \ f'๐ ๐๐ง๐ค๐ช๐ฅ : @Mxtmirrorgroup\n' buttons = button_build.ButtonMaker() if SHORTENER is not None and SHORTENER_API is not None: surl = requests.get( f'https://{SHORTENER}/api?api={SHORTENER_API}&url={link}&format=text' ).text buttons.buildbutton("๐ ๐๐ซ๐ข๐ฏ๐ ๐๐ข๐ง๐ค ๐", surl) else: buttons.buildbutton("๐ ๐๐ซ๐ข๐ฏ๐ ๐๐ข๐ง๐ค ๐", link) LOGGER.info(f'Done Uploading {download_dict[self.uid].name()}') if INDEX_URL is not None: url_path = requests.utils.quote( f'{download_dict[self.uid].name()}') share_url = f'{INDEX_URL}/{url_path}' if os.path.isdir( f'{DOWNLOAD_DIR}/{self.uid}/{download_dict[self.uid].name()}' ): share_url += '/' if SHORTENER is not None and SHORTENER_API is not None: siurl = requests.get( f'https://{SHORTENER}/api?api={SHORTENER_API}&url={share_url}&format=text' ).text buttons.buildbutton("๐ ๐๐ง๐๐๐ฑ ๐๐ข๐ง๐ค ๐", siurl) else: buttons.buildbutton("๐ ๐๐ง๐๐๐ฑ ๐๐ข๐ง๐ค ๐", share_url) if BUTTON_THREE_NAME is not None and BUTTON_THREE_URL is not None: buttons.buildbutton(f"{BUTTON_THREE_NAME}", f"{BUTTON_THREE_URL}") if BUTTON_FOUR_NAME is not None and BUTTON_FOUR_URL is not None: buttons.buildbutton(f"{BUTTON_FOUR_NAME}", f"{BUTTON_FOUR_URL}") if BUTTON_FIVE_NAME is not None and BUTTON_FIVE_URL is not None: buttons.buildbutton(f"{BUTTON_FIVE_NAME}", f"{BUTTON_FIVE_URL}") if self.message.from_user.username: uname = f"@{self.message.from_user.username}" else: uname = f'<a href="tg://user?id={self.message.from_user.id}">{self.message.from_user.first_name}</a>' if uname is not None: msg += f'\n\n<b>๐ค ๐จ๐ฝ๐น๐ผ๐ฎ๐ฑ๐ฒ๐ฟ : ๐</b> {uname}\n\nโซ๏ธ#Uploaded To Team Drive โ \n\n๐ซ ๐ฟ๐ค ๐๐ค๐ฉ ๐๐๐๐ง๐ ๐๐ฃ๐๐๐ญ ๐๐๐ฃ๐ \n\nโ ๐ฃ๐ผ๐๐ฒ๐ฟ๐ฒ๐ฑ ๐๐ : <b>@ZEUTS</b>' try: fs_utils.clean_download(download_dict[self.uid].path()) except FileNotFoundError: pass del download_dict[self.uid] count = len(download_dict) sendMarkup(msg, self.bot, self.update, InlineKeyboardMarkup(buttons.build_menu(2))) if count == 0: self.clean() else: update_all_messages()
def onUploadComplete(self, link: str, size): with download_dict_lock: msg = f'<b>๐ ๆไปถๅ็งฐ : </b><code>{download_dict[self.uid].name()}</code>\n<b>๐ฆ ๆป่ฎกๅฎน้ : </b><code>{size}</code>\n' \ f' \n' \ f'๐ ่ฏถ๏ผ่ตท้ฃ๏ผ\n' \ f' \n' \ f'๐ ๅฐฑๆฏ้ฃ๏ผ\n' buttons = button_build.ButtonMaker() if SHORTENER is not None and SHORTENER_API is not None: surl = requests.get( f'https://{SHORTENER}/api?api={SHORTENER_API}&url={link}&format=text' ).text buttons.buildbutton("๐ ๐๐ซ๐ข๐ฏ๐ ้พๆฅ ๐", surl) else: buttons.buildbutton("๐ ๐๐ซ๐ข๐ฏ๐ ้พๆฅ ๐", link) LOGGER.info(f'Done Uploading {download_dict[self.uid].name()}') if INDEX_URL is not None: url_path = requests.utils.quote( f'{download_dict[self.uid].name()}') share_url = f'{INDEX_URL}/{url_path}' if os.path.isdir( f'{DOWNLOAD_DIR}/{self.uid}/{download_dict[self.uid].name()}' ): share_url += '/' if SHORTENER is not None and SHORTENER_API is not None: siurl = requests.get( f'https://{SHORTENER}/api?api={SHORTENER_API}&url={share_url}&format=text' ).text buttons.buildbutton("๐ ๐๐ง๐๐๐ฑ ้พๆฅ ๐", siurl) else: buttons.buildbutton("๐ ๐๐ง๐๐๐ฑ ้พๆฅ ๐", share_url) if BUTTON_THREE_NAME is not None and BUTTON_THREE_URL is not None: buttons.buildbutton(f"{BUTTON_THREE_NAME}", f"{BUTTON_THREE_URL}") if BUTTON_FOUR_NAME is not None and BUTTON_FOUR_URL is not None: buttons.buildbutton(f"{BUTTON_FOUR_NAME}", f"{BUTTON_FOUR_URL}") if BUTTON_FIVE_NAME is not None and BUTTON_FIVE_URL is not None: buttons.buildbutton(f"{BUTTON_FIVE_NAME}", f"{BUTTON_FIVE_URL}") if self.message.from_user.username: uname = f"@{self.message.from_user.username}" else: uname = f'<a href="tg://user?id={self.message.from_user.id}">{self.message.from_user.first_name}</a>' if uname is not None: msg += f'\n\n<b>๐ค ไธไผ ่ : ๐</b> {uname}\n\nโซ๏ธ#ไธไผ ๅฐๅข้็ โ \n\n๐ซ ไธๅไบซ ๐๐ฃ๐๐๐ญ ้พๆฅ \n\nโ ๆๆฏๆฏๆ : <b>@wawawame</b>' try: fs_utils.clean_download(download_dict[self.uid].path()) except FileNotFoundError: pass del download_dict[self.uid] count = len(download_dict) sendMarkup(msg, self.bot, self.update, InlineKeyboardMarkup(buttons.build_menu(2))) if count == 0: self.clean() else: update_all_messages()
def onUploadComplete(self, link: str, size): with download_dict_lock: msg = f'<b>๐ ๐๐ถ๐น๐ฒ๐ก๐ฎ๐บ๐ฒ : </b><code>{download_dict[self.uid].name()}</code>\n<b>๐ฃ๐ธ๐ฝ๐ช๐ต ๐ข๐ฒ๐๐ฎ : </b><code>{size}</code>\n' \ f' \n' \ f'โโโโโโ ๐ฯโฃ ็ช๐๐ฃัแปล ๐ฯฮท๏ฝ โโโโโโ\n' \ f' \n' \ f'Group : @Zeuts\n' buttons = button_build.ButtonMaker() if SHORTENER is not None and SHORTENER_API is not None: surl = requests.get(f'https://{SHORTENER}/api?api={SHORTENER_API}&url={link}&format=text').text buttons.buildbutton("๐ฏ๐๐๐๐ ๐ท๐๐๐", surl) else: buttons.buildbutton("๐ฏ๐๐๐๐ ๐ท๐๐๐", link) LOGGER.info(f'Done Uploading {download_dict[self.uid].name()}') if INDEX_URL is not None: url_path = requests.utils.quote(f'{download_dict[self.uid].name()}') share_url = f'{INDEX_URL}/{url_path}' if os.path.isdir(f'{DOWNLOAD_DIR}/{self.uid}/{download_dict[self.uid].name()}'): share_url += '/' if SHORTENER is not None and SHORTENER_API is not None: siurl = requests.get(f'https://{SHORTENER}/api?api={SHORTENER_API}&url={share_url}&format=text').text buttons.buildbutton("๐ฒ๐ท๐ญ๐ฎ๐ ๐ต๐ฒ๐ท๐ด", siurl) else: buttons.buildbutton("๐ฒ๐ท๐ญ๐ฎ๐ ๐ต๐ฒ๐ท๐ด", share_url) if BUTTON_THREE_NAME is not None and BUTTON_THREE_URL is not None: buttons.buildbutton(f"{BUTTON_THREE_NAME}", f"{BUTTON_THREE_URL}") if BUTTON_FOUR_NAME is not None and BUTTON_FOUR_URL is not None: buttons.buildbutton(f"{BUTTON_FOUR_NAME}", f"{BUTTON_FOUR_URL}") if BUTTON_FIVE_NAME is not None and BUTTON_FIVE_URL is not None: buttons.buildbutton(f"{BUTTON_FIVE_NAME}", f"{BUTTON_FIVE_URL}") if self.message.from_user.username: uname = f"@{self.message.from_user.username}" else: uname = f'<a href="tg://user?id={self.message.from_user.id}">{self.message.from_user.first_name}</a>' if uname is not None: msg += f'\n\n<b> ๐๐๐๐๐๐๐๐ </b> {uname}\n\nโซ๏ธ ๐๐๐๐๐๐๐๐ โ \n\n ๐๐ธ๐ท'๐ฝ ๐ข๐ฑ๐ช๐ป๐ฎ ๐๐ฒ๐ท๐ด \n\nโ ๐ฃ๐ผ๐๐ฒ๐ฟ๐ฒ๐ฑ ๐๐ : <b@zeuts</b>' try: fs_utils.clean_download(download_dict[self.uid].path()) except FileNotFoundError: pass del download_dict[self.uid] count = len(download_dict) sendMarkup(msg, self.bot, self.update, InlineKeyboardMarkup(buttons.build_menu(2))) if count == 0: self.clean() else: update_all_messages()
def drive_list(self, fileName): msg = "" fileName = self.escapes(str(fileName)) # Create Search Query for API request. query = f"'{parent_id}' in parents and (name contains '{fileName}')" response = self.__service.files().list( supportsTeamDrives=True, includeTeamDriveItems=True, q=query, spaces='drive', pageSize=200, fields='files(id, name, mimeType, size)', orderBy='modifiedTime desc').execute() content_count = 0 if response["files"]: msg += f'<h4>Results : {fileName}</h4><br><br>' for file in response.get('files', []): if file.get( 'mimeType' ) == "application/vnd.google-apps.folder": # Detect Whether Current Entity is a Folder or File. furl = f"https://drive.google.com/drive/folders/{file.get('id')}" msg += f"โ<code>{file.get('name')}<br>(folder๐)</code><br>" if SHORTENER is not None and SHORTENER_API is not None: sfurl = requests.get( f'https://{SHORTENER}/api?api={SHORTENER_API}&url={furl}&format=text' ).text msg += f"<b><a href={sfurl}>๐ ๐๐ซ๐ข๐ฏ๐ ๐๐ข๐ง๐ค ๐</a></b>" else: msg += f"<b><a href={furl}>๐ ๐๐ซ๐ข๐ฏ๐ ๐๐ข๐ง๐ค ๐</a></b>" if INDEX_URL is not None: url_path = requests.utils.quote(f'{file.get("name")}') url = f'{INDEX_URL}/{url_path}/' if SHORTENER is not None and SHORTENER_API is not None: siurl = requests.get( f'https://{SHORTENER}/api?api={SHORTENER_API}&url={url}&format=text' ).text msg += f' <b>| <a href="{siurl}">๐ ๐๐ง๐๐๐ฑ ๐๐ข๐ง๐ค ๐</a></b>' else: msg += f' <b>| <a href="{url}">๐ ๐๐ง๐๐๐ฑ ๐๐ข๐ง๐ค ๐</a></b>' elif file.get( 'mimeType') == 'application/vnd.google-apps.shortcut': msg += f"โ<a href='https://drive.google.com/drive/folders/{file.get('id')}'>{file.get('name')}" \ f"</a> (shortcut)" # Excluded index link as indexes cant download or open these shortcuts else: furl = f"https://drive.google.com/uc?id={file.get('id')}&export=download" msg += f"โ<code>{file.get('name')}<br>({get_readable_file_size(int(file.get('size')))})๐</code><br>" if SHORTENER is not None and SHORTENER_API is not None: sfurl = requests.get( f'https://{SHORTENER}/api?api={SHORTENER_API}&url={furl}&format=text' ).text msg += f"<b><a href={sfurl}>๐ ๐๐ซ๐ข๐ฏ๐ ๐๐ข๐ง๐ค ๐</a></b>" else: msg += f"<b><a href={furl}>๐ ๐๐ซ๐ข๐ฏ๐ ๐๐ข๐ง๐ค ๐</a></b>" if INDEX_URL is not None: url_path = requests.utils.quote(f'{file.get("name")}') url = f'{INDEX_URL}/{url_path}' if SHORTENER is not None and SHORTENER_API is not None: siurl = requests.get( f'https://{SHORTENER}/api?api={SHORTENER_API}&url={url}&format=text' ).text msg += f' <b>| <a href="{siurl}">๐ ๐๐ง๐๐๐ฑ ๐๐ข๐ง๐ค ๐</a></b>' else: msg += f' <b>| <a href="{url}">๐ ๐๐ง๐๐๐ฑ ๐๐ข๐ง๐ค ๐</a></b>' msg += '<br><br>' content_count += 1 if content_count == TELEGRAPHLIMIT: self.telegraph_content.append(msg) msg = "" content_count = 0 if msg != '': self.telegraph_content.append(msg) if len(self.telegraph_content) == 0: return "No Result Found :(", None for content in self.telegraph_content: self.path.append( Telegraph(access_token=TELEGRAPH_TOKEN).create_page( title='๐ฃ๐ฅ๐๐๐๐๐ฌ๐ข ๐ ๐๐ฅ๐ฅ๐ข๐ฅ ๐ญ๐ข๐ก๐', author_name='๐ฒ ๐จ๐ฝ๐น๐ผ๐ฎ๐ฑ ๐๐', author_url='https://t.me/PriiiiyoBOTs', html_content=content)['path']) self.num_of_path = len(self.path) if self.num_of_path > 1: self.edit_telegraph() msg = f"<b>๐ Search Results For <i>{fileName}</i></b> \n<b>๐ Found {len(response['files'])} results</b>" buttons = button_build.ButtonMaker() buttons.buildbutton("๐ Click HERE ๐", f"https://telegra.ph/{self.path[0]}") return msg, InlineKeyboardMarkup(buttons.build_menu(1)) else: return '', ''
def clone(self, link): self.transferred_size = 0 try: file_id = self.getIdFromUrl(link) except (KeyError, IndexError): msg = "Google drive ID could not be found in the provided link" return msg, "" msg = "" LOGGER.info(f"File ID: {file_id}") try: meta = self.getFileMetadata(file_id) if meta.get("mimeType") == self.__G_DRIVE_DIR_MIME_TYPE: dir_id = self.create_directory(meta.get('name'), parent_id) result = self.cloneFolder(meta.get('name'), meta.get('name'), meta.get('id'), dir_id) msg += f'<b>๐ ๐๐ถ๐น๐ฒ๐ก๐ฎ๐บ๐ฒ : </b><code>{meta.get("name")}</code>\n<b>Size : </b><code>{get_readable_file_size(self.transferred_size)}<code>' durl = self.__G_DRIVE_DIR_BASE_DOWNLOAD_URL.format(dir_id) buttons = button_build.ButtonMaker() if SHORTENER is not None and SHORTENER_API is not None: surl = requests.get( f'https://{SHORTENER}/api?api={SHORTENER_API}&url={durl}&format=text' ).text buttons.buildbutton("๐ ๐๐ซ๐ข๐ฏ๐ ๐๐ข๐ง๐ค ๐", surl) else: buttons.buildbutton("๐ ๐๐ซ๐ข๐ฏ๐ ๐๐ข๐ง๐ค ๐", durl) if INDEX_URL is not None: url_path = requests.utils.quote(f'{meta.get("name")}') url = f'{INDEX_URL}/{url_path}/' if SHORTENER is not None and SHORTENER_API is not None: siurl = requests.get( f'https://{SHORTENER}/api?api={SHORTENER_API}&url={url}&format=text' ).text buttons.buildbutton("๐ ๐๐ง๐๐๐ฑ ๐๐ข๐ง๐ค ๐", siurl) else: buttons.buildbutton("๐ ๐๐ง๐๐๐ฑ ๐๐ข๐ง๐ค ๐", url) if BUTTON_THREE_NAME is not None and BUTTON_THREE_URL is not None: buttons.buildbutton(f"{BUTTON_THREE_NAME}", f"{BUTTON_THREE_URL}") if BUTTON_FOUR_NAME is not None and BUTTON_FOUR_URL is not None: buttons.buildbutton(f"{BUTTON_FOUR_NAME}", f"{BUTTON_FOUR_URL}") if BUTTON_FIVE_NAME is not None and BUTTON_FIVE_URL is not None: buttons.buildbutton(f"{BUTTON_FIVE_NAME}", f"{BUTTON_FIVE_URL}") else: file = self.copyFile(meta.get('id'), parent_id) msg += f'<b>๐ ๐๐ถ๐น๐ฒ๐ก๐ฎ๐บ๐ฒ : </b><code>{file.get("name")}</code>' durl = self.__G_DRIVE_BASE_DOWNLOAD_URL.format(file.get("id")) buttons = button_build.ButtonMaker() if SHORTENER is not None and SHORTENER_API is not None: surl = requests.get( f'https://{SHORTENER}/api?api={SHORTENER_API}&url={durl}&format=text' ).text buttons.buildbutton("๐ ๐๐ซ๐ข๐ฏ๐ ๐๐ข๐ง๐ค ๐", surl) else: buttons.buildbutton("๐ ๐๐ซ๐ข๐ฏ๐ ๐๐ข๐ง๐ค ๐", durl) try: msg += f'\n<b>๐ฆ ๐๐จ๐ญ๐๐ฅ ๐๐ข๐ณ๐ : </b> {get_readable_file_size(int(meta.get("size")))}\n\n๐ฅ ๐๐ง๐๐๐๐๐ฎ๐ค ๐๐๐ง๐ง๐ค๐ง ๐๐ค๐ฃ๐\n\nโซ๏ธ#Uploaded to Drive โ \n\n๐ซ ๐ฟ๐ค ๐๐ค๐ฉ ๐๐๐๐ง๐ ๐๐ฃ๐๐๐ญ ๐๐๐ฃ๐ \n\nโ ๐ฃ๐ผ๐๐ฒ๐ฟ๐ฒ๐ฑ ๐ฏ๐ : <b>@PriiiiyoBOTs</b>' except TypeError: pass if INDEX_URL is not None: url_path = requests.utils.quote(f'{file.get("name")}') url = f'{INDEX_URL}/{url_path}' if SHORTENER is not None and SHORTENER_API is not None: siurl = requests.get( f'https://{SHORTENER}/api?api={SHORTENER_API}&url={url}&format=text' ).text buttons.buildbutton("๐ ๐๐ง๐๐๐ฑ ๐๐ข๐ง๐ค ๐", siurl) else: buttons.buildbutton("๐ ๐๐ง๐๐๐ฑ ๐๐ข๐ง๐ค ๐", url) if BUTTON_THREE_NAME is not None and BUTTON_THREE_URL is not None: buttons.buildbutton(f"{BUTTON_THREE_NAME}", f"{BUTTON_THREE_URL}") if BUTTON_FOUR_NAME is not None and BUTTON_FOUR_URL is not None: buttons.buildbutton(f"{BUTTON_FOUR_NAME}", f"{BUTTON_FOUR_URL}") if BUTTON_FIVE_NAME is not None and BUTTON_FIVE_URL is not None: buttons.buildbutton(f"{BUTTON_FIVE_NAME}", f"{BUTTON_FIVE_URL}") except Exception as err: if isinstance(err, RetryError): LOGGER.info( f"Total Attempts: {err.last_attempt.attempt_number}") err = err.last_attempt.exception() err = str(err).replace('>', '').replace('<', '') LOGGER.error(err) return err, "" return msg, InlineKeyboardMarkup(buttons.build_menu(2))
def clone(self, link): self.transferred_size = 0 try: file_id = self.getIdFromUrl(link) except (KeyError,IndexError): msg = "Google drive ID could not be found in the provided link" return msg, "" msg = "" LOGGER.info(f"File ID: {file_id}") try: meta = self.getFileMetadata(file_id) if meta.get("mimeType") == self.__G_DRIVE_DIR_MIME_TYPE: dir_id = self.create_directory(meta.get('name'), parent_id) result = self.cloneFolder(meta.get('name'), meta.get('name'), meta.get('id'), dir_id) msg += f'<b> Filename: </b><code>{meta.get("name")}</code>\n<b>Size : </b><code>{get_readable_file_size(self.transferred_size)}<code>' durl = self.__G_DRIVE_DIR_BASE_DOWNLOAD_URL.format(dir_id) buttons = button_build.ButtonMaker() if SHORTENER is not None and SHORTENER_API is not None: surl = requests.get(f'https://{SHORTENER}/api?api={SHORTENER_API}&url={durl}&format=text').text buttons.buildbutton("๐ฏ๐๐๐๐ ๐ท๐๐๐", surl) else: buttons.buildbutton("๐ฏ๐๐๐๐ ๐ท๐๐๐", durl) if INDEX_URL is not None: url_path = requests.utils.quote(f'{meta.get("name")}') url = f'{INDEX_URL}/{url_path}/' if SHORTENER is not None and SHORTENER_API is not None: siurl = requests.get(f'https://{SHORTENER}/api?api={SHORTENER_API}&url={url}&format=text').text buttons.buildbutton("๐ฒ๐ท๐ญ๐ฎ๐ ๐ต๐ฒ๐ท๐ด", siurl) else: buttons.buildbutton("๐ฒ๐ท๐ญ๐ฎ๐ ๐ต๐ฒ๐ท๐ด", url) if BUTTON_THREE_NAME is not None and BUTTON_THREE_URL is not None: buttons.buildbutton(f"{BUTTON_THREE_NAME}", f"{BUTTON_THREE_URL}") if BUTTON_FOUR_NAME is not None and BUTTON_FOUR_URL is not None: buttons.buildbutton(f"{BUTTON_FOUR_NAME}", f"{BUTTON_FOUR_URL}") if BUTTON_FIVE_NAME is not None and BUTTON_FIVE_URL is not None: buttons.buildbutton(f"{BUTTON_FIVE_NAME}", f"{BUTTON_FIVE_URL}") else: file = self.copyFile(meta.get('id'), parent_id) msg += f'<b> Filename: </b><code>{file.get("name")}</code>' durl = self.__G_DRIVE_BASE_DOWNLOAD_URL.format(file.get("id")) buttons = button_build.ButtonMaker() if SHORTENER is not None and SHORTENER_API is not None: surl = requests.get(f'https://{SHORTENER}/api?api={SHORTENER_API}&url={durl}&format=text').text buttons.buildbutton("๐ฏ๐๐๐๐ ๐ท๐๐๐", surl) else: buttons.buildbutton("๐ฏ๐๐๐๐ ๐ท๐๐๐", durl) try: msg += f'\n\n<b> ๐ฃ๐ธ๐ฝ๐ช๐ต ๐ข๐ฒ๐๐ฎ:</b> {get_readable_file_size(int(meta.get("size")))}\n\n๐๐๐ ๐๐๐ฃ๐ฃ๐ ๐ฃ โค๐โ๐ผ\n\nโซ๏ธ#Uploaded โ \n\n๐ซ Do not share links \n\nโ ๐ฃ๐ผ๐๐ฒ๐ฟ๐ฒ๐ฑ ๐ฏ๐ : <b>@๐๐๐๐๐</b>' except TypeError: pass if INDEX_URL is not None: url_path = requests.utils.quote(f'{file.get("name")}') url = f'{INDEX_URL}/{url_path}' if SHORTENER is not None and SHORTENER_API is not None: siurl = requests.get(f'https://{SHORTENER}/api?api={SHORTENER_API}&url={url}&format=text').text buttons.buildbutton("๐ฒ๐ท๐ญ๐ฎ๐ ๐ต๐ฒ๐ท๐ด", siurl) else: buttons.buildbutton("๐ฒ๐ท๐ญ๐ฎ๐ ๐ต๐ฒ๐ท๐ด", url) if BUTTON_THREE_NAME is not None and BUTTON_THREE_URL is not None: buttons.buildbutton(f"{BUTTON_THREE_NAME}", f"{BUTTON_THREE_URL}") if BUTTON_FOUR_NAME is not None and BUTTON_FOUR_URL is not None: buttons.buildbutton(f"{BUTTON_FOUR_NAME}", f"{BUTTON_FOUR_URL}") if BUTTON_FIVE_NAME is not None and BUTTON_FIVE_URL is not None: buttons.buildbutton(f"{BUTTON_FIVE_NAME}", f"{BUTTON_FIVE_URL}") except Exception as err: if isinstance(err, RetryError): LOGGER.info(f"Total Attempts: {err.last_attempt.attempt_number}") err = err.last_attempt.exception() err = str(err).replace('>', '').replace('<', '') LOGGER.error(err) return err, "" return msg, InlineKeyboardMarkup(buttons.build_menu(2))