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()