Example #1
0
 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()
Example #2
0
 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()
Example #4
0
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()
Example #6
0
 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()
Example #7
0
 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()
Example #8
0
 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()
Example #9
0
 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()
Example #10
0
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
Example #11
0
 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()
Example #12
0
 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()
Example #13
0
 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()
Example #14
0
 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()
Example #15
0
 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
Example #16
0
 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()
Example #17
0
 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()
Example #18
0
 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()
Example #19
0
 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()
Example #20
0
 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()
Example #21
0
 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()
Example #22
0
 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()
Example #23
0
 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()
Example #24
0
 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()
Example #26
0
 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()
Example #27
0
 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()
Example #28
0
 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()
Example #29
0
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}/')
Example #30
0
 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()