def recived_mission(update, context): global mode global link global target target = update.effective_message.text if "/cancel" == target.strip()[:7]: return cancel(update, context) # extract lid,tid from Link(shared & Target) lid = "".join(re.findall(regex, link)) tid = "".join(re.findall(regex, target)) # extract Shared_Link folderName if len(lid) == 28 or len(lid) == 33: foldername = folder_name(settings.Remote, lid, lid) elif len(lid) != 28 and len(lid) != 33: d_id = lid foldername = drive_get(d_id)['name'] # get Target_folderName under quick mode if "quick" == mode: # tid = Pre_Dst_id under quick mode tid = settings.Pre_Dst_id if len(tid) == 28 or len(tid) == 33: target_folder = folder_name(settings.Remote, tid, tid) elif len(tid) != 28 and len(tid) != 33: d_id = tid target_folder = drive_get(d_id)['name'] # get Target_folderName under copy mode elif "copy" == mode: if len(tid) == 28 or len(tid) == 33: target_folder = folder_name(settings.Remote, tid, tid) elif len(tid) != 28 and len(tid) != 33: d_id = tid target_folder = drive_get(d_id)['name'] # sendmsg Mission.INFO update.effective_message.reply_text(task_message().format( foldername, lid, target_folder, foldername)) # Build Mission Command commandstr = """{}' JSUSPLIT 'copy' JSUSPLIT '{}:{{{}}}' JSUSPLIT '{}:{{{}}}/{}' JSUSPLIT '{}' JSUSPLIT '{}' JSUSPLIT '{}""".format( settings.Clone, settings.Remote, lid, settings.Remote, tid, foldername, settings.Run_Mode, settings.TRANSFER, settings.CHECKERS, ) command = commandstr.split("' JSUSPLIT '") #print(command) return ConversationHandler.END, copyprocess(update, context, command)
def recived_mission(update, context): global mode global link global target target = update.effective_message.text # extract lid,tid from Link(shared & Target) lid = "".join(re.findall(regex, link)) tid = "".join(re.findall(regex, target)) # extract Shared_Link folderName if len(lid) == 28 or len(lid) == 33: foldername = folder_name(settings.Remote, lid, lid) elif len(lid) != 28 and len(lid) != 33: d_id = lid foldername = drive_get(d_id) # get Target_folderName under quick mode if "quick" == mode: # tid = Pre_Dst_id under quick mode tid = settings.Pre_Dst_id if len(tid) == 28 or len(tid) == 33: target_folder = folder_name(settings.Remote, tid, tid) elif len(tid) != 28 and len(tid) != 33: d_id = tid target_folder = drive_get(d_id) # get Target_folderName under copy mode elif "copy" == mode: if len(tid) == 28 or len(tid) == 33: target_folder = folder_name(settings.Remote, tid, tid) elif len(tid) != 28 and len(tid) != 33: d_id = tid target_folder = drive_get(d_id) # sendmsg Mission.INFO update.effective_message.reply_text(task_message().format( foldername, lid, target_folder, foldername)) # Build Mission Command command = """gclone copy {}:{{{}}} {}:{{{}}}/"{}" {} {}""".format( settings.Remote, lid, settings.Remote, tid, foldername, settings.Run_Mode, settings.TRANSFER, ) copyprocess(update, context, command) return ConversationHandler.END