def onUploadComplete(self, link: str): with download_dict_lock: msg = f'๐ฆ๐๐ ๐ฏ๐๐๐๐ : <a href="{link}">{download_dict[self.uid].name()}</a> ({download_dict[self.uid].size()})' LOGGER.info(f'Done Uploading {download_dict[self.uid].name()}') if INDEX_URL is not None: share_url = requests.utils.requote_uri( f'{INDEX_URL}/{download_dict[self.uid].name()}') if os.path.isdir( f'{DOWNLOAD_DIR}/{self.uid}/{download_dict[self.uid].name()}' ): share_url += '/' msg += f'\n\n ๐๐ด๐๐๐๐ : <a href="{share_url}">๐สษชแดแด ๐แดสแด</a>' if self.tag is not None: msg += f'\ncc: @{self.tag}' try: fs_utils.clean_download(download_dict[self.uid].path()) except FileNotFoundError: pass del download_dict[self.uid] count = len(download_dict) sendMessage(msg, self.bot, self.update) if count == 0: self.clean() else: update_all_messages()
def onDownloadError(self, error): error = error.replace('<', ' ') error = error.replace('>', ' ') LOGGER.info(self.update.effective_chat.id) with download_dict_lock: try: download = download_dict[self.uid] del download_dict[self.uid] LOGGER.info(f"Deleting folder: {download.path()}") fs_utils.clean_download(download.path()) LOGGER.info(str(download_dict)) except Exception as e: LOGGER.error(str(e)) pass count = len(download_dict) 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>' msg = f"{uname} your download has been stopped due to: {error}" sendMessage(msg, self.bot, self.update) if count == 0: self.clean() else: update_all_messages()
def onUploadComplete(self, link: str, size, files, folders, typ): with download_dict_lock: msg = f'<b>โ ๐ Filename: </b><code>{download_dict[self.uid].name()}</code>\n<b>โ ๐ฆ Size: </b><code>{size}</code>' if os.path.isdir(f'{DOWNLOAD_DIR}/{self.uid}/{download_dict[self.uid].name()}'): msg += '\n<b>โ ๐ Type: </b><code>Folder</code>' msg += f'\n<b>โ ๐ณ ๐ฃ๐ผ๐๐ฒ๐ฟ๐ฒ๐ฑ ๐๐</b> @AT_BOTs' else: msg += f'\n<b>โ ๐ Type: </b><code>{typ}</code>' 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("๐ Drive Link ๐ ", surl) else: buttons.buildbutton("๐ Drive Link ๐ ", 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("โ๏ธ Index Link โ๏ธ", siurl) else: buttons.buildbutton("โ๏ธ Index Link โ๏ธ", share_url) else: share_urls = f'{INDEX_URL}/{url_path}?a=view' 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 siurls = requests.get(f'https://{SHORTENER}/api?api={SHORTENER_API}&url={share_urls}&format=text').text buttons.buildbutton("โ๏ธ Index Link โ๏ธ", siurl) if VIEW_LINK: buttons.buildbutton("๐ View Link", siurls) else: buttons.buildbutton("โ๏ธ Index Link โ๏ธ", share_url) if VIEW_LINK: buttons.buildbutton("๐ View Link", share_urls) 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 BUTTON_SIX_NAME is not None and BUTTON_SIX_URL is not None: buttons.buildbutton(f"{BUTTON_SIX_NAME}", f"{BUTTON_SIX_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\ncc: {uname}' 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 cancel_mirror(bot, update): mirror_message = update.message.reply_to_message with download_dict_lock: keys = download_dict.keys() dl = download_dict[mirror_message.message_id] if mirror_message is None or mirror_message.message_id not in keys: if '/mirror' in mirror_message.text or '/tarmirror' in mirror_message.text: msg = 'Message has already been cancelled' else: msg = 'Please reply to the /mirror message which was used to start the download to cancel it!' sendMessage(msg, bot, update) return if dl.status() == "Uploading": sendMessage("Upload in Progress, Don't Cancel it.", bot, update) return elif dl.status() == "Archiving": sendMessage("Archival in Progress, Don't Cancel it.", bot, update) return elif dl.status() != "Queued": download = dl.download() if len(download.followed_by_ids) != 0: downloads = aria2.get_downloads(download.followed_by_ids) aria2.pause(downloads) aria2.pause([download]) elif dl.status() == "Uploading": sendMessage("Upload in Progress, Dont Cancel it.", bot, update) return else: dl._listener.onDownloadError("Download stopped by user!") sleep(1) #Wait a Second For Aria2 To free Resources. clean_download(f'{DOWNLOAD_DIR}{mirror_message.message_id}/')
def onUploadComplete(self, link: str): with download_dict_lock: msg = f'<b>Filename : </b><code>{download_dict[self.uid].name()}</code>\n<b>Size : </b><code>{download_dict[self.uid].size()}</code>' buttons = button_build.ButtonMaker() buttons.buildbutton("โ๏ธ Cloud Link โ๏ธ", link) LOGGER.info(f'Done Uploading {download_dict[self.uid].name()}') if INDEX_URL is not None: share_url = requests.utils.requote_uri(f'{INDEX_URL}/{download_dict[self.uid].name()}') if os.path.isdir(f'{DOWNLOAD_DIR}/{self.uid}/{download_dict[self.uid].name()}'): share_url += '/' buttons.buildbutton("โน๏ธ Index Link โน๏ธ", 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\ncc : {uname}' 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 onDownloadError(self, error): error = error.replace('<', ' ') error = error.replace('>', ' ') LOGGER.info(self.update.effective_chat.id) with download_dict_lock: try: download = download_dict[self.uid] del download_dict[self.uid] LOGGER.info(f"Deleting folder: {download.path()}") fs_utils.clean_download(download.path()) LOGGER.info(f"Deleting {download.name()} from download_dict.") LOGGER.info(str(download_dict)) except Exception as e: LOGGER.error(str(e)) pass count = len(download_dict) 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>' msg = f"{uname} โ ๏ธ ๐๐จ๐ฎ๐ซ ๐๐จ๐ฐ๐ง๐ฅ๐จ๐๐ ๐ก๐๐ฌ ๐๐๐๐ง ๐ฌ๐ญ๐จ๐ฉ๐ฉ๐๐ ๐๐ฎ๐ ๐ญ๐จ: Download stopped by user !" sendMessage(msg, self.bot, self.update) if count == 0: self.clean() else: update_all_messages()
def onUploadComplete(self, link: str): with download_dict_lock: msg = f'<a href="{link}">{download_dict[self.uid].name()}</a> ({download_dict[self.uid].size()})' LOGGER.info(f'Done Uploading {download_dict[self.uid].name()}') if INDEX_URL is not None: share_url = requests.utils.requote_uri( f'{INDEX_URL}/{download_dict[self.uid].name()}') if os.path.isdir( f'{DOWNLOAD_DIR}/{self.uid}/{download_dict[self.uid].name()}' ): share_url += '/' msg += f'\n\nShareable link: <a href="{share_url}">here</a>' 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'\ncc : {uname}' try: fs_utils.clean_download(download_dict[self.uid].path()) except FileNotFoundError: pass del download_dict[self.uid] count = len(download_dict) sendMessage(msg, self.bot, self.update) if count == 0: self.clean() else: update_all_messages()
def onUploadComplete(self, link: str): with download_dict_lock: msg = f'<b>Filename:</b> <code>{download_dict[self.uid].name()}</code>\n\n<b>Size:</b> <i>{download_dict[self.uid].size()}</i>\n\n<b>Gdrive:</b> {link}' LOGGER.info(f'Done Uploading {download_dict[self.uid].name()}') if INDEX_URL is not None: share_url = requests.utils.requote_uri( f'{INDEX_URL}/{download_dict[self.uid].name()}') if os.path.isdir( f'{DOWNLOAD_DIR}/{self.uid}/{download_dict[self.uid].name()}' ): share_url += '/' msg += f'\n\n<b>Index:</b> {share_url}' if self.tag is not None: msg += f'\ncc: @{self.tag}' try: fs_utils.clean_download(download_dict[self.uid].path()) except FileNotFoundError: pass del download_dict[self.uid] count = len(download_dict) sendMessage(msg, self.bot, self.update) if count == 0: self.clean() else: update_all_messages()
def onDownloadError(self, error): error = error.replace('<', ' ') error = error.replace('>', ' ') LOGGER.info(self.update.effective_chat.id) with download_dict_lock: try: download = download_dict[self.uid] del download_dict[self.uid] LOGGER.info(f"Bentar aku delete in: {download.path()}") fs_utils.clean_download(download.path()) LOGGER.info(str(download_dict)) except Exception as e: LOGGER.error(str(e)) pass count = len(download_dict) 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>' msg = f"{uname} Link download yang kamu kirim ga bisa nih :( karena: {error}" sendMessage(msg, self.bot, self.update) if count == 0: self.clean() else: update_all_messages()
def cancel_mirror(update,context): args = update.message.text.split(" ",maxsplit=1) mirror_message = None if len(args) > 1: gid = args[1] dl = getDownloadByGid(gid) if not dl: sendMessage(f"GID: <code>{gid}</code> not found.",context.bot,update) return with download_dict_lock: keys = list(download_dict.keys()) mirror_message = dl.message elif update.message.reply_to_message: mirror_message = update.message.reply_to_message with download_dict_lock: keys = list(download_dict.keys()) dl = download_dict[mirror_message.message_id] if len(args) == 1: if mirror_message is None or mirror_message.message_id not in keys: if BotCommands.MirrorCommand in mirror_message.text or \ BotCommands.TarMirrorCommand in mirror_message.text: msg = "Mirror already have been cancelled" sendMessage(msg,context.bot,update) return else: msg = "Please reply to the /mirror message which was used to start the download or /cancel gid to cancel it!" sendMessage(msg,context.bot,update) return if dl.status() == "Uploading": dl.download().cancel_download() sleep(1) # Wait a Second For Aria2 To free Resources. clean_download(f'{DOWNLOAD_DIR}{mirror_message.message_id}/') return
def onUploadComplete(self, link: str, size, files, folders, typ): with download_dict_lock: msg = f'<b>Filename: </b><code>{download_dict[self.uid].name()}</code>\n<b>Size: </b><code>{size}</code>' buttons = button_build.ButtonMaker() if SHORTENER is not None and SHORTENER_API is not None: surl = requests.get( 'https://{}/api?api={}&url={}&format=text'.format( SHORTENER, SHORTENER_API, link)).text buttons.buildbutton("โ๏ธDrive Linkโ๏ธ", surl) else: buttons.buildbutton("โ๏ธDrive Linkโ๏ธ", 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 += '/' msg += '\n\n<b>Type: </b>Folder' msg += f'\n<b>SubFolders: </b>{folders}' msg += f'\n<b>Files: </b>{files}' else: msg += f'\n\n<b>Type: </b>{typ}' if SHORTENER is not None and SHORTENER_API is not None: siurl = requests.get( 'https://{}/api?api={}&url={}&format=text'.format( SHORTENER, SHORTENER_API, share_url)).text buttons.buildbutton("โกIndex Linkโก", siurl) else: buttons.buildbutton("โกIndex Linkโก", 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\ncc: {uname}' 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>๐ Filename : </b><code>{download_dict[self.uid].name()}</code>\n<b>๐๏ธ Size : </b><code>{size}</code>\n' \ f' \n' \ f'๐ Hey I am Priyo Welcome To My Area.\n' \ f'๐ Do not Share Gdrive/Index Links Outside The Group.\n' \ f' \n' \ f'๐ฐJoin To Mirror Group @PriyoMirrors\n' buttons = button_build.ButtonMaker() if SHORTENER is not None and SHORTENER_API is not None: surl = requests.get( 'https://{}/api?api={}&url={}&format=text'.format( SHORTENER, SHORTENER_API, link)).text buttons.buildbutton("๐พDrive Link๐พ", surl) else: buttons.buildbutton("๐พDrive Link๐พ", link) LOGGER.info(f'Done Uploading {download_dict[self.uid].name()}') if INDEX_URL is not None: share_url = requests.utils.requote_uri( f'{INDEX_URL}/{download_dict[self.uid].name()}') 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( 'https://{}/api?api={}&url={}&format=text'.format( SHORTENER, SHORTENER_API, share_url)).text buttons.buildbutton("๐Index Link๐", siurl) else: buttons.buildbutton("๐Index Link๐", 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\nReq. By ๐ : {uname}' 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>Filename : </b><code>{download_dict[self.uid].name()}</code>\n<b>Size : </b><code>{download_dict[self.uid].size()}</code>\n' \ f' \n' \ f'๐ฉ Join Our Team Drive To Gain Access To The G-Drive Link.\n' \ f'๐ฉ Do Not Share G-Drive/Index Links Outside The Group.\n' \ f' \n' \ f' ๐งจ CodexCLoudx Join @CodexCLoudx\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("๐ฉ๏ธDrive Link๐ฉ๏ธ", surl) else: buttons.buildbutton("๐ฉ๏ธDrive Link๐ฉ๏ธ", link) LOGGER.info(f'Done Uploading {download_dict[self.uid].name()}') if INDEX_URL is not None: share_url = requests.utils.requote_uri( f'{INDEX_URL}/{download_dict[self.uid].name()}') 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("๐ฅIndex Link๐ฅ", siurl) else: buttons.buildbutton("๐ฅIndex Link๐ฅ", 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\ncc @ : {uname}' 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>๐ Filename: </b><code>{download_dict[self.uid].name()}</code>\n<b>๐พ Total Size: </b><code>{size}</code>' \ f'\n' \ f'๐ ๐๐จ๐ข๐ง ๐๐ฎ๐ซ ๐๐๐๐ฆ ๐๐ซ๐ข๐ฏ๐ ๐ ๐จ๐ซ ๐๐๐๐๐ฌ๐ฌ๐ข๐ง๐ ๐-๐๐ซ๐ข๐ฏ๐ ๐๐ข๐ง๐ค. \n' \ f'๐ ๐๐จ ๐๐จ๐ญ ๐๐ก๐๐ซ๐ ๐-๐๐ซ๐ข๐ฏ๐ / ๐๐ง๐๐๐ฑ ๐๐ข๐ง๐ค๐ฌ ๐๐ฎ๐ญ๐ฌ๐ข๐๐ ๐ญ๐ก๐ ๐๐ซ๐จ๐ฎ๐ฉ. \n' \ f'\n' \ f'โ๏ธ ๐๐จ๐ข๐ง ๐๐๐ ๐๐ฅ๐จ๐ฎ๐ โ @TtuCloud\n' buttons = button_build.ButtonMaker() if SHORTENER is not None and SHORTENER_API is not None: surl = requests.get( 'https://{}/api?api={}&url={}&format=text'.format( SHORTENER, SHORTENER_API, link)).text buttons.buildbutton("๐พDrive Link๐พ", surl) else: buttons.buildbutton("๐พDrive Link๐พ", link) LOGGER.info(f'Done Uploading {download_dict[self.uid].name()}') if INDEX_URL is not None: share_url = requests.utils.requote_uri( f'{INDEX_URL}/{download_dict[self.uid].name()}') 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( 'https://{}/api?api={}&url={}&format=text'.format( SHORTENER, SHORTENER_API, share_url)).text buttons.buildbutton("๐Index Link๐", siurl) else: buttons.buildbutton("๐Index Link๐", 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 Req. By ๐ : {uname}' 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 onUploadError(self, error: str, progress_status: list, index: int): LOGGER.error(error) sendMessage(error, self.context, self.update) with download_dict_lock: del download_dict[self.message.message_id] try: fs_utils.clean_download(progress_status[index].path()) except FileNotFoundError: pass
def onUploadComplete(self, link: str, size): with download_dict_lock: msg = f'<b>Filename: </b>{download_dict[self.uid].name()}\n<b>Size: </b>{size}' buttons = button_build.ButtonMaker() if SHORTENER is not None and SHORTENER_API is not None: surl = requests.get( 'https://{}/api?api={}&url={}&format=text'.format( SHORTENER, SHORTENER_API, link)).text buttons.buildbutton("โ๏ธDrive Link โซท[สฯพแธ]โซธโ๏ธ", surl) else: buttons.buildbutton("โ๏ธDrive Link โซท[สฯพแธ]โซธโ๏ธ", 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}' vshare_url = f'{INDEX_URL}/{url_path}?a=view' 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( 'https://{}/api?api={}&url={}&format=text'.format( SHORTENER, SHORTENER_API, share_url)).text buttons.buildbutton("โกIndex Download Link โซท[สฯพแธ]โซธโก", siurl) else: buttons.buildbutton("Direct Download Link โซท[สฯพแธ]โซธ", share_url) buttons.buildbutton("Online view Link โซท[สฯพแธ]โซธ", vshare_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"@classbackupbot" else: uname = f"@classbackupbot" if uname is not None: msg += f'\n\n Credit Goes TO โซท[สฯพแธ]โซธ' 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): with download_dict_lock: msg = f'<b>Filename : </b><code>{download_dict[self.uid].name()}</code>\n<b>Size : </b><code>{download_dict[self.uid].size()}</code>' buttons = button_build.ButtonMaker() if SHORTENER is not None and SHORTENER_API is not None: surl = requests.get( 'https://{}/api?api={}&url={}&format=text'.format( SHORTENER, SHORTENER_API, link)).text buttons.buildbutton("รขลกยกDrive Linkรขลกยก", surl) else: buttons.buildbutton("รขลกยกDrive Linkรขลกยก", link) LOGGER.info(f'Done Uploading {download_dict[self.uid].name()}') if INDEX_URL is not None: share_url = requests.utils.requote_uri( f'{INDEX_URL}/{download_dict[self.uid].name()}') if os.path.isdir( f'{DOWNLOAD_DIR}/{self.uid}/{download_dict[self.uid].name()}' ): if FIX_HASH_ISSUE: share_url = share_url.replace( '#', '%2523' ) # https://github.com/magneto261290/magneto-python-aria/issues/37 share_url += '/' if SHORTENER is not None and SHORTENER_API is not None: siurl = requests.get( 'https://{}/api?api={}&url={}&format=text'.format( SHORTENER, SHORTENER_API, share_url)).text buttons.buildbutton("รฐลธโยฅIndex Linkรฐลธโยฅ", siurl) else: buttons.buildbutton("รฐลธโยฅIndex Linkรฐลธโยฅ", 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\ncc : {uname}' 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>Filename : </b><code>{download_dict[self.uid].name()}</code>\n<b>Size : </b><code>{size}</code>" 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("Drive Link", surl) else: buttons.buildbutton("Drive Link", 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("Index Link", siurl) else: buttons.buildbutton("Index Link", 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\ncc : {uname}" 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>๐งฐT๐๐๐๐๐๐๐ฃ๐: </b><code>{size}</code>' buttons = button_build.ButtonMaker() if SHORTENER is not None and SHORTENER_API is not None: surl = requests.get( 'https://{}/api?api={}&url={}&format=text'.format( SHORTENER, SHORTENER_API, link)).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( 'https://{}/api?api={}&url={}&format=text'.format( SHORTENER, SHORTENER_API, share_url)).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> {uname}\n\n<b>#๐๐๐๐๐๐๐๐ T๐ T๐๐๐๐ณ๐๐๐๐</b>\n\n<b>๐ฟ๐๐ ๐๐๐๐๐ฑ๐ข : @ANonYmoUS_FriEND</b>\n\n<b>โป๏ธ<u>๐ป๐๐ป๐๐โ๐๐ปโข</u>โป๏ธ</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): with download_dict_lock: msg = f'โฌข๐๐ถ๐น๐ฒ๐ก๐ฎ๐บ๐ฒ : <code>{download_dict[self.uid].name()}</code>\n\n<b>โฌข๐ง๐ผ๐๐ฎ๐น ๐ฆ๐ถ๐๐ฒ : </b> {download_dict[self.uid].size()}' buttons = button_build.ButtonMaker() if SHORTENER is not None and SHORTENER_API is not None: surl = requests.get( 'https://{}/api?api={}&url={}&format=text'.format( SHORTENER, SHORTENER_API, link)).text buttons.buildbutton("โฌข๐๐ฟ๐ถ๐๐ฒ ๐๐ถ๐ป๐ธโฌข", surl) else: buttons.buildbutton("โฌข๐๐ฟ๐ถ๐๐ฒ ๐๐ถ๐ป๐ธโฌข", link) LOGGER.info(f'Done Uploading {download_dict[self.uid].name()}') if INDEX_URL is not None: share_url = requests.utils.requote_uri( f'{INDEX_URL}/{download_dict[self.uid].name()}') 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( 'https://{}/api?api={}&url={}&format=text'.format( SHORTENER, SHORTENER_API, share_url)).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>@AiTorrent_Ware</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>๐Fษชสแดษดแดแดแด : </b><code>{download_dict[self.uid].name()}</code>\n<b>๐ณSษชแดขแด : </b><code>{size}</code>' buttons = button_build.ButtonMaker() if SHORTENER is not None and SHORTENER_API is not None: surl = requests.get( 'https://{}/api?api={}&url={}&format=text'.format( SHORTENER, SHORTENER_API, link)).text buttons.buildbutton("โ๏ธDสษชแด แด Lษชษดแดโ๏ธ", surl) else: buttons.buildbutton("โ๏ธDสษชแด แด Lษชษดแดโ๏ธ", link) LOGGER.info(f'Done Uploading {download_dict[self.uid].name()}') if INDEX_URL is not None: share_url = requests.utils.requote_uri( f'{INDEX_URL}/{download_dict[self.uid].name()}') 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( 'https://{}/api?api={}&url={}&format=text'.format( SHORTENER, SHORTENER_API, share_url)).text buttons.buildbutton("๐Iษดแด แดx Lษชษดแด๐", siurl) else: buttons.buildbutton("๐Iษดแด แดx Lษชษดแด๐", 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>๐ฃ๏ธHแดส</b> โ{uname}โ, <b>Yแดแดส Fษชสแด Is ๐ชMษชสสแดสแดแด & Uแดสแดแดแด แดแด @mirrorGtax1111</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>FileName: </b><code>{download_dict[self.uid].name()}</code>\n<b>๐ Size: </b><code>{size}</code>' buttons = button_build.ButtonMaker() if SHORTENER is not None and SHORTENER_API is not None: surl = requests.get( 'https://{}/api?api={}&url={}&format=text'.format( SHORTENER, SHORTENER_API, link)).text buttons.buildbutton("๐ Drive Link", surl) else: buttons.buildbutton("๐ Drive Link", link) LOGGER.info(f'Done Uploading {download_dict[self.uid].name()}') if INDEX_URL is not None: share_url = requests.utils.requote_uri( f'{INDEX_URL}/{download_dict[self.uid].name()}') 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( 'https://{}/api?api={}&url={}&format=text'.format( SHORTENER, SHORTENER_API, share_url)).text buttons.buildbutton("๐ฒ INDEX LINK", siurl) else: buttons.buildbutton("๐ฒ INDEX LINK", 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>๐ค Uploader: </b>๐ {uname}\n\nโซ๏ธ#Uploaded To Team Drive โ \n\nโ ๐ฟ๐ค ๐ฃ๐ค๐ฉ ๐จ๐๐๐ง๐ ๐๐ฃ๐๐๐ญ ๐๐๐ฃ๐ ๐ \n\n๐ก๏ธ๐ฃ๐ผ๐๐ฒ๐ฟ๐ฒ๐ฑ ๐๐: <b>@TGFilmZone</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>Nama File : </b><code>{download_dict[self.uid].name()}</code>\n<b>Gede Filenya : </b><code>{size}</code>' buttons = button_build.ButtonMaker() if SHORTENER is not None and SHORTENER_API is not None: surl = requests.get( 'https://{}/api?api={}&url={}&format=text'.format( SHORTENER, SHORTENER_API, link)).text buttons.buildbutton("รฐลธโยพIni Link Google Drivenyaรฐลธโยพ", surl) else: buttons.buildbutton("รฐลธโยพIni Link Google Drivenyaรฐลธโยพ", link) LOGGER.info(f'Done Uploading {download_dict[self.uid].name()}') if INDEX_URL is not None: share_url = requests.utils.requote_uri( f'{INDEX_URL}/{download_dict[self.uid].name()}') 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( 'https://{}/api?api={}&url={}&format=text'.format( SHORTENER, SHORTENER_API, share_url)).text buttons.buildbutton("รฐลธลกโฌIni Link Indexnyaรฐลธลกโฌ", siurl) else: buttons.buildbutton("รฐลธลกโฌIni Link Indexnyaรฐลธลกโฌ", 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\nMakasih {uname} udah gunain/request dari bot aku' 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): with download_dict_lock: msg = f'๐File Name : <code>{download_dict[self.uid].name()}</code>\n\n<b>๐File Size: </b> {download_dict[self.uid].size()}' buttons = button_build.ButtonMaker() if SHORTENER is not None and SHORTENER_API is not None: surl = requests.get( 'https://{}/api?api={}&url={}&format=text'.format( SHORTENER, SHORTENER_API, link)).text buttons.buildbutton("โก๏ธGdrive Linkโก๏ธ", surl) else: buttons.buildbutton("โก๏ธGdrive Linkโก๏ธ", link) LOGGER.info(f'Done Uploading {download_dict[self.uid].name()}') if INDEX_URL is not None: share_url = requests.utils.requote_uri( f'{INDEX_URL}/{download_dict[self.uid].name()}') 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( 'https://{}/api?api={}&url={}&format=text'.format( SHORTENER, SHORTENER_API, share_url)).text buttons.buildbutton("๐ฅIndex Link๐ฅ", siurl) else: buttons.buildbutton("๐ฅIndex Link๐ฅ", 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<b>๐งUploader: </b>{uname}\n๐ต๐ฟ๐ค N๐ค๐ฉ ๐๐๐๐ง๐ ๐๐ฃ๐๐๐ญ ๐๐๐ฃ๐ ๐\nBot By : <b>@Debojit16 โค๏ธ</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>โ ๐ File Name :</b> <code>{download_dict[self.uid].name()}</code>\n\n<b>โ ๐ฆ Total Size : </b><code>{size}</code>' buttons = button_build.ButtonMaker() if SHORTENER is not None and SHORTENER_API is not None: surl = requests.get( 'https://{}/api?api={}&url={}&format=text'.format( SHORTENER, SHORTENER_API, link)).text buttons.buildbutton("๐ ๐-๐๐ฅ๐๐ฉ๐ ๐๐๐ก๐ ๐ ", surl) else: buttons.buildbutton("๐ ๐-๐๐ฅ๐๐ฉ๐ ๐๐๐ก๐ ๐ ", link) LOGGER.info(f'Done Uploading {download_dict[self.uid].name()}') if INDEX_URL is not None: share_url = requests.utils.requote_uri( f'{INDEX_URL}/{download_dict[self.uid].name()}') 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( 'https://{}/api?api={}&url={}&format=text'.format( SHORTENER, SHORTENER_API, share_url)).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>โ ๐ถ Uploader :</b> {uname}\n\n<b>#Uploaded To Team Drive โ </b>\n\n<b>โฉ ๐ณ ๐ฃ๐ผ๐๐ฒ๐ฟ๐ฒ๐ฑ ๐๐ @ABHIJEETSCLAN</b>\n\n<b>โ ๐๐ข ๐ก๐ข๐ง <u>๐ฆ๐๐๐ฅ๐</u> ๐๐ก๐๐๐ซ ๐๐๐ก๐ ๐ฃ๐จ๐๐๐๐๐๐ฌ โ </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): with download_dict_lock: msg = f'๐ ๐๐ถ๐น๐ฒ๐ก๐ฎ๐บ๐ฒ : <code>{download_dict[self.uid].name()}</code>\n\n<b>๐ Total Size : </b> {download_dict[self.uid].size()}' buttons = button_build.ButtonMaker() if SHORTENER is not None and SHORTENER_API is not None: surl = requests.get( 'https://{}/api?api={}&url={}&format=text'.format( SHORTENER, SHORTENER_API, link)).text buttons.buildbutton("๐ ๐๐ซ๐ข๐ฏ๐ ๐๐ข๐ง๐ค", surl) else: buttons.buildbutton("๐ ๐๐ซ๐ข๐ฏ๐ ๐๐ข๐ง๐ค", link) LOGGER.info(f'Done Uploading {download_dict[self.uid].name()}') if INDEX_URL is not None: share_url = requests.utils.requote_uri( f'{INDEX_URL}/{download_dict[self.uid].name()}') 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( 'https://{}/api?api={}&url={}&format=text'.format( SHORTENER, SHORTENER_API, share_url)).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>๐ค Uploader: </b>๐ {uname}\n\nโซ๏ธ๐ดUploaded To GDrive โ \n\n๐ธ๐ถ ๐ฃ๐ผ๐๐ฒ๐ฟ๐ฒ๐ฑ ๐๐: <b>@ImPrashantt</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>๐ฐFilename : </b><code>{download_dict[self.uid].name()}</code>\n<b>๐พSize : </b><code>{size}</code>\n\n<b>๐To Acess Google Drive Links\nJoin๐๐ผ<a href="https://groups.google.com/g/test-cloud-bot">Google Group</a></b>' buttons = button_build.ButtonMaker() if SHORTENER is not None and SHORTENER_API is not None: surl = requests.get( 'https://{}/api?api={}&url={}&format=text'.format( SHORTENER, SHORTENER_API, link)).text buttons.buildbutton("โป๏ธDrive Linkโป๏ธ", surl) else: buttons.buildbutton("โป๏ธDrive Linkโป๏ธ", link) LOGGER.info(f'Done Uploading {download_dict[self.uid].name()}') if INDEX_URL is not None: share_url = requests.utils.requote_uri( f'{INDEX_URL}/{download_dict[self.uid].name()}') 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( 'https://{}/api?api={}&url={}&format=text'.format( SHORTENER, SHORTENER_API, share_url)).text buttons.buildbutton("๐ฅIndex Link๐ฅ", siurl) else: buttons.buildbutton("๐ฅIndex Link๐ฅ", 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๐คต๐ป : {uname}' 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): with download_dict_lock: msg = f'๐ Nama file : <code>{download_dict[self.uid].name()}</code>\n\n<b>๐ Ukuran File : </b> {download_dict[self.uid].size()}' buttons = button_build.ButtonMaker() if SHORTENER is not None and SHORTENER_API is not None: surl = requests.get( 'https://{}/api?api={}&url={}&format=text'.format( SHORTENER, SHORTENER_API, link)).text buttons.buildbutton("๐ Link Gdrive", surl) else: buttons.buildbutton("๐ Link Gdrive", link) LOGGER.info(f'Done Uploading {download_dict[self.uid].name()}') if INDEX_URL is not None: share_url = requests.utils.requote_uri( f'{INDEX_URL}/{download_dict[self.uid].name()}') 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( 'https://{}/api?api={}&url={}&format=text'.format( SHORTENER, SHORTENER_API, share_url)).text buttons.buildbutton("๐ก Link Index", siurl) else: buttons.buildbutton("๐ก Link Index", 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>๐ค Uploader: </b>๐ {uname}\n\n๐ #Uploaded To Google Drive โ \n\n๐ ๏ธ Dimohon support bot ini dengan membeli produk admin ๐โค๏ธ \n\n๐ก๏ธBot dibuat oleh: <b>@dkdownloader</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 cancel_mirror(update, context): args = update.message.text.split(" ", maxsplit=1) mirror_message = None if len(args) > 1: gid = args[1] dl = getDownloadByGid(gid) if not dl: sendMessage(f"GID: <code>{gid}</code> Not Found.", context.bot, update) return mirror_message = dl.message elif update.message.reply_to_message: mirror_message = update.message.reply_to_message with download_dict_lock: keys = list(download_dict.keys()) try: dl = download_dict[mirror_message.message_id] except: pass if len(args) == 1: msg = f"Please reply to the <code>/{BotCommands.MirrorCommand}</code> message which was used to start the download or send <code>/{BotCommands.CancelMirror} GID</code> to cancel it!" if mirror_message and mirror_message.message_id not in keys: if BotCommands.MirrorCommand in mirror_message.text or \ BotCommands.TarMirrorCommand in mirror_message.text or \ BotCommands.UnzipMirrorCommand in mirror_message.text: msg1 = "Mirror Already Have Been Cancelled" sendMessage(msg1, context.bot, update) return else: sendMessage(msg, context.bot, update) return elif not mirror_message: sendMessage(msg, context.bot, update) return if dl.status() == "Uploading...๐ค": sendMessage("Upload in Progress, You Can't Cancel It.", context.bot, update) return elif dl.status() == "Archiving...๐": sendMessage("Archival in Progress, You Can't Cancel It.", context.bot, update) return elif dl.status() == "Extracting...๐": sendMessage("Extract in Progress, You Can't Cancel It.", context.bot, update) return else: dl.download().cancel_download() sleep( 3 ) # incase of any error with ondownloaderror listener, clean_download will delete the folder but the download will stuck in status msg. clean_download(f'{DOWNLOAD_DIR}{mirror_message.message_id}/')
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>' buttons = button_build.ButtonMaker() if SHORTENER is not None and SHORTENER_API is not None: surl = requests.get('https://{}/api?api={}&url={}&format=text'.format(SHORTENER, SHORTENER_API, link)).text buttons.buildbutton("โ๏ธDrive Linkโ๏ธ", surl) else: buttons.buildbutton("โ๏ธDrive Linkโ๏ธ", 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 IRU_SHORTENER is not None and IRU_SHORTENER_API is not None: if IRU_SHORTENER == "cutt.ly": siurl = requests.get('http://cutt.ly/api/api.php?key={}&short={}'.format(IRU_SHORTENER_API, share_url)) if NEW_DOMAIN is not None: siurl = siurl.replace("cutt.ly", NEW_DOMAIN) else: siurl = requests.get('https://{}/api?api={}&url={}&format=text'.format(IRU_SHORTENER, IRU_SHORTENER_API, share_url)).text buttons.buildbutton("โกIndex Linkโก", siurl) LastPg = f'\n\n๐ <b>For Mobile Devices</b> ๐๐พ\nCopy this Ultra Speed Link and Past it on Chrome and Open it. ๐\n<code>{siurl}</code>\n\n๐ <b>For Other Devices</b> ๐๐พ\nClick on <b>โก๏ธIndex Link โก๏ธ</b> Button to Download Your File. \n\n<b>โก๏ธIndex Link โก๏ธ</b> Button also Works for Mobiles. But some Mobiles Throw Errors โ๏ธ' else: buttons.buildbutton("โกIndex Linkโก", share_url) LastPg = f'\n\n๐ <b>For Mobile Devices</b> ๐๐พ\nCopy this Ultra Speed Link and Past it on Chrome and Open it. ๐\n<code>{share_url}</code>\n\n๐ <b>For Other Devices</b> ๐๐พ\nClick on <b>โก๏ธIndex Link โก๏ธ</b> Button to Download Your File. \n\n<b>โก๏ธIndex Link โก๏ธ</b> Button also Works for Mobiles. But some Mobiles Throw Errors โ๏ธ' 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}' if INS_TEXT_AADS is not None: msg += f'{LastPg}' 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()