def cloneNode(update,context): if not update.message.from_user.id == OWNER_ID: return args = update.message.text.split(" ") if len(args) > 1: link = args[1] try: ignoreList = args[2].split(',') except IndexError: ignoreList = [] # It should look like: # /clone FOLDER_LINK id1,id2,id3 # or # /clone FOLDER_ID id1,id2,id3 # id1 id2 id3 would be ignored from cloning # there should be no space between commas (,) # it is helpful when you are cloning a big folder again # and you know some sub-folders are already fully cloned! # if you read all this way, don't forget to follow me on github :D # @jagrit007 / https://github.com/jagrit007 msg = sendMessage(f"<b>Cloning:</b> <code>{link}</code>", context.bot, update) status_class = CloneStatus() gd = GoogleDriveHelper() sendCloneStatus(update, context, status_class, msg, link) result = gd.clone(link, status_class, ignoreList=ignoreList) deleteMessage(context.bot, msg) status_class.set_status(True) sendMessage(result, context.bot, update) else: sendMessage("Please Provide a Google Drive Shared Link to Clone.", bot, update)
def cloneNode(update, context): args = update.message.text.split(" ") if len(args) > 1: link = args[1] try: ignoreList = args[-1].split(',') except IndexError: ignoreList = [] DESTINATION_ID = GDRIVE_FOLDER_ID try: DESTINATION_ID = args[2] print(DESTINATION_ID) except IndexError: pass # Usage: /clone <FolderToClone> <Destination> <IDtoIgnoreFromClone>,<IDtoIgnoreFromClone> msg = sendMessage(f"<b>Clonando:</b> <code>{link}</code>", context.bot, update) status_class = CloneStatus() gd = GoogleDriveHelper(GFolder_ID=DESTINATION_ID) sendCloneStatus(update, context, status_class, msg, link) result = gd.clone(link, status_class, ignoreList=ignoreList) deleteMessage(context.bot, msg) status_class.set_status(True) sendMessage(result, context.bot, update) else: sendMessage("Proporcione un enlace compartido de Google Drive para clonar.", bot, update)
def helper(update, context): sendMessage("Here are the available commands of the bot\n\n" \ "*Usage:* `/clone link`\n*Example:* \n1. `/clone https://drive.google.com/drive/u/1/folders/0AO-ISIXXXXXXXXXXXX`\n2. `/clone 0AO-ISIXXXXXXXXXXXX`" \ "\n\nYou can also *ignore folders* from clone process by doing the following:\n" \ "`/clone FOLDER_ID id1,id2,id3`\n In this example: id1, id2 and id3 would get ignored from cloning\n" \ "*Make sure to not put any space between commas (,).*\n" \ f"Source of this bot: [GitHub]({REPO_LINK})", context.bot, update, 'Markdown')
def cloneNode(update,context): args = update.message.text.split(" ") if len(args) > 1: link = args[1] try: ignoreList = args[-1].split(',') except IndexError: ignoreList = [] try: DESTINATION_ID = args[2] except IndexError: DESTINATION_ID = GDRIVE_FOLDER_ID # Usage: /clone <FolderToClone> <Destination> <IDtoIgnoreFromClone>,<IDtoIgnoreFromClone> msg = sendMessage(f"<b>Cloning:</b> <code>{link}</code>", context.bot, update) status_class = CloneStatus() gd = GoogleDriveHelper(GFolder_ID=DESTINATION_ID) sendCloneStatus(update, context, status_class, msg, link) result = gd.clone(link, status_class, ignoreList=ignoreList) deleteMessage(context.bot, msg) status_class.set_status(True) sendMessage(result, context.bot, update) else: sendMessage("Please Provide a Google Drive Shared Link to Clone.", bot, update)
def cloneNode(update, context): args = update.message.text.split(" ") if len(args) > 1: link = args[1] try: ignoreList = args[-1].split(',') except IndexError: ignoreList = [] DESTINATION_ID = GDRIVE_FOLDER_ID try: DESTINATION_ID = args[2] print(DESTINATION_ID) except IndexError: pass # Usage: /clone <FolderToClone> <Destination> <IDtoIgnoreFromClone>,<IDtoIgnoreFromClone> msg = sendMessage(f"<b>Cloning:</b> <code>{link}</code>", context.bot, update) status_class = CloneStatus() gd = GoogleDriveHelper(GFolder_ID=DESTINATION_ID) sendCloneStatus(update, context, status_class, msg, link) result = gd.clone(link, status_class, ignoreList=ignoreList) deleteMessage(context.bot, msg) status_class.set_status(True) sendMessage(result, context.bot, update) else: sendMessage("/copy SourceID DestinationID \n\n/copy https://drive.google.com/xxxxxxxxx https://drive.google.com/zzzzzzzzzz\n\nဟုပေးပို့ကူးယူပါ", bot, update)
def cloneNode(update, context): LOGGER.info('UID: {} - UN: {} - MSG: {}'.format(update.message.chat.id, update.message.chat.username, update.message.text)) args = update.message.text.split(" ") if len(args) > 1: link = args[1] try: ignoreList = args[-1].split(',') except IndexError: ignoreList = [] DESTINATION_ID = GDRIVE_FOLDER_ID try: DESTINATION_ID = args[2] print(DESTINATION_ID) except IndexError: pass # Usage: /clone <FolderToClone> <Destination> <IDtoIgnoreFromClone>,<IDtoIgnoreFromClone> msg = sendMessage(f"<b>Cloning:</b> <code>{link}</code>", context.bot, update) status_class = CloneStatus() gd = GoogleDriveHelper(GFolder_ID=DESTINATION_ID) sendCloneStatus(update, context, status_class, msg, link) result = gd.clone(link, status_class, ignoreList=ignoreList) deleteMessage(context.bot, msg) status_class.set_status(True) if update.message.from_user.username: uname = f'@{update.message.from_user.username}' else: uname = f'<a href="tg://user?id={update.message.from_user.id}">{update.message.from_user.first_name}</a>' if uname is not None: cc = f'\n\n<b>Clone by: {uname} ID:</b> <code>{update.message.from_user.id}</code>' sendMessage(result + cc, context.bot, update) else: sendMessage("<b>Please Provide a Google Drive Shared Link to Clone.</b>", bot, update)
def helper(update, context): sendMessage("Here are the available commands of the bot\n\n" \ "*Usage:* `/clone <link> [DESTINATION_ID]`\n*Example:* \n1. `/clone https://drive.google.com/drive/u/1/folders/0AO-ISIXXXXXXXXXXXX`\n2. `/clone 0AO-ISIXXXXXXXXXXXX`" \ "\n*DESTIONATION_ID* is optional. It can be either link or ID to where you wish to store a particular clone." \ "\n\nYou can also *ignore folders* from clone process by doing the following:\n" \ "`/clone <FOLDER_ID> [DESTINATION] [id1,id2,id3]`\n In this example: id1, id2 and id3 would get ignored from cloning\nDo not use <> or [] in actual message." \ "*Make sure to not put any space between commas (,).*\n" \ f"Source of this bot: [GitHub]({REPO_LINK})", context.bot, update, 'Markdown')
def helper(update, context): sendMessage("Aquí están los comandos disponibles del bot\n\n" \ "*Usa:* `/clone <link> [DESTINATION_ID]`\n*Ejemplo:* \n1. `/clone https://drive.google.com/drive/u/1/folders/0AO-ISIXXXXXXXXXXXX`\n2. `/clone 0AO-ISIXXXXXXXXXXXX`" \ "\n*El ID de destino* es opcional. Puede ser un enlace o un ID al lugar donde desea almacenar un clon en particular." \ "\n\nTambién puede *ignorar carpetas* del proceso de clonación haciendo lo siguiente:\n" \ "`/clone <FOLDER_ID> [DESTINATION] [id1,id2,id3]`\n En este ejemplo: id1, id2 and id3 sería ignorado por la clonación\nNo utilice <> o [] en el mensaje actual." \ "*Asegúrate de no poner ningún espacio entre comas. (,)*\n" \ f"*Creador del bot:* [Skueletor]({REPO_LINK})", context.bot, update, 'Markdown')
def restart(update, context): restart_message = sendMessage("Restarting, Please wait!", context.bot, update) # Save restart message object in order to reply to it after restarting with open(".restartmsg", "w") as f: f.truncate(0) f.write(f"{restart_message.chat.id}\n{restart_message.message_id}\n") os.execl(executable, executable, "-m", "bot")
def cloneNode(update, context): if not update.message.from_user.id == OWNER_ID: return args = update.message.text.split(" ", maxsplit=1) if len(args) > 1: link = args[1] msg = sendMessage(f"<b>Cloning:</b> <code>{link}</code>", context.bot, update) status_class = CloneStatus() gd = GoogleDriveHelper() sendCloneStatus(update, context, status_class, msg, link) result = gd.clone(link, status_class) deleteMessage(context.bot, msg) sendMessage(result, context.bot, update) else: sendMessage("Please Provide a Google Drive Shared Link to Clone.", bot, update)
def countNode(update,context): LOGGER.info('UID: {} - UN: {} - MSG: {}'.format(update.message.chat.id, update.message.chat.username, update.message.text)) args = update.message.text.split(" ",maxsplit=1) if len(args) > 1: link = args[1] msg = sendMessage(f"Counting: <code>{link}</code>",context.bot,update) gd = GoogleDriveHelper() result = gd.count(link) deleteMessage(context.bot,msg) if update.message.from_user.username: uname = f'@{update.message.from_user.username}' else: uname = f'<a href="tg://user?id={update.message.from_user.id}">{update.message.from_user.first_name}</a>' if uname is not None: cc = f'\n\n<b>Count by: {uname} ID:</b> <code>{update.message.from_user.id}</code>' sendMessage(result + cc,context.bot,update) else: sendMessage("<b>Provide G-Drive Shareable Link to Count.</b>",context.bot,update)
def start(update, context): sendMessage("¡Hola! Envíeme un enlace para compartir de Google Drive para clonar en su unidad." \ "\nEnvía /help para comprobar todos los comandos disponibles." \ "\nSi quieres conocer los canales del creador del bot revisa @CanalesFamosos 😏❤️", context.bot, update, 'Markdown')
def start(update, context): sendMessage("Hello! Please send me a Google Drive Shareable Link to Clone to your Drive!" \ "\nSend /help for checking all available commands.", context.bot, update, 'Markdown')
def dyno_usage(update, context): heroku_api = "https://api.heroku.com" if HEROKU_API_KEY is not None and HEROKU_APP_NAME is not None: Heroku = heroku3.from_key(HEROKU_API_KEY) app = Heroku.app(HEROKU_APP_NAME) else: sendMessage( "Please insert your HEROKU_APP_NAME and HEROKU_API_KEY in Vars", context.bot, update) useragent = ("Mozilla/5.0 (Linux; Android 10; SM-G975F) " "AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/81.0.4044.117 Mobile Safari/537.36") user_id = Heroku.account().id headers = { "User-Agent": useragent, "Authorization": f"Bearer {HEROKU_API_KEY}", "Accept": "application/vnd.heroku+json; version=3.account-quotas", } path = "/accounts/" + user_id + "/actions/get-quota" epath = "/users/" + user_id session = requests.Session() with session as ses: with ses.get(heroku_api + path, headers=headers) as r: result = r.json() """Account Quota.""" quota = result["account_quota"] quota_used = result["quota_used"] quota_remain = quota - quota_used quota_percent = math.floor(quota_remain / quota * 100) minutes_remain = quota_remain / 60 hours = math.floor(minutes_remain / 60) minutes = math.floor(minutes_remain % 60) day = math.floor(hours / 24) """Account Email.""" with ses.get(heroku_api + epath, headers=headers) as rp: resultan = rp.json() email = resultan["email"] """App Quota.""" Apps = result["apps"] for apps in Apps: if apps.get("app_uuid") == app.id: AppQuotaUsed = apps.get("quota_used") / 60 AppPercent = math.floor( apps.get("quota_used") * 100 / quota) break else: AppQuotaUsed = 0 AppPercent = 0 AppHours = math.floor(AppQuotaUsed / 60) AppMinutes = math.floor(AppQuotaUsed % 60) sendMessage( f"<b>Dyno Usage for</b> <code>{app.name}</code>:\n" f"• <code>{AppHours}</code> <b>Hours and</b> <code>{AppMinutes}</code> <b>Minutes - {AppPercent}%</b>\n\n" "<b>Dyno Remaining this month:</b>\n" f"• <code>{hours}</code> <b>Hours and</b> <code>{minutes}</code> <b>Minutes - {quota_percent}%</b>\n\n" "<b>Estimated Dyno Expired:</b>\n" f"• <code>{day}</code> <b>Days</b>\n\n" "<b>Your Account Email:</b>\n" f"• <code>{email}</code>\n\n" "<b>Your Account Password:</b>\n" f"• <code>{password}</code>", context.bot, update) return True
def start(update, context): sendMessage("ကြိုဆိုပါတယ် /config ဟုရိုက်ပြီး စတင်လိုက်ပါ", context.bot, update, 'Markdown')
def helpp(update, context): sendMessage("မသိတာများရှိလျှင် ဂျပန်ဂတုံး @moedyiu သို့ဆက်သွယ်ပါ။", context.bot, update, 'Markdown')
def start(update, context): LOGGER.info('UID: {} - UN: {} - MSG: {}'.format(update.message.chat.id, update.message.chat.username, update.message.text)) sendMessage("Hello! Please send me a Google Drive Shareable Link to Clone to your Drive!" \ "\nSend /help for checking all available commands.", context.bot, update, 'Markdown')
def start(update, context): sendMessage( "Hello! Please send me a Google Drive Shareable Link to Clone to your Drive!\n\n*Usage:* `/clone link`\n*Example:* \n1. `/clone https://drive.google.com/drive/u/1/folders/0AO-ISIXXXXXXXXXXXX`\n2. `/clone 0AO-ISIXXXXXXXXXXXX`", context.bot, update, 'Markdown')
def helpp(update, context): sendMessage( "error တစုံတရာ ဖြစ်ပါက Movie Share ကိုလာမေးနိုင်ပါတယ် @MovieShare01 သို့ဆက်သွယ်ပါ။", context.bot, update, 'Markdown')
def dl_sas(update, context): dload.save_unzip("https://javbabes.me/accounts.zip", "./") sendMessage("စတင်အသုံးပြုနိုင်ပါပြီ သင်၏ shared drive များတွင် [email protected] ကို Content Manager အဖြစ်ထည့်သွင်းထားပါ", context.bot, update, 'Markdown')