async def check_logs(): log_data = media.read_file("log.txt", filter=True) if log_data: for message in log_data: if "--channel=" in message: message = message.split(" --channel=") await send(message[0], channel=message[1]) else: await send(message) media.write_file("log.txt", "### Beginning of message buffer from server ###\n")
def check_for_captcha_solve(timeout=100): if __name__ == "__main__": media.write_file("captcha.txt", input("Solve the captcha:\n> ")) filename = "captcha.txt" for _ in range(timeout * 2): time.sleep(0.5) if os.path.isfile(filename): solved_captcha = media.read_file(filename)[0] media.remove_file(filename) return solved_captcha log(f"Captcha was not solved withing {timeout} seconds.\nAborting download.", silent=False) return False
async def check_logs(filename="log.txt"): log_data = media.read_file(filename, filter=True) if log_data: media.write_file(filename, "### Beginning of message buffer from server ###\n") bulk_message = [] for message in log_data: if "--embed" in message: metadata = eval(message.replace("--embed", "")) await create_embed(metadata) elif "--channel=" in message: message = message.split("--channel=") await send(message[0], channel=message[1]) elif "--file" in message: await send(message) # elif "--res=" in message: # forced_resolution = message.split("--res=")[1] # cfg.write_attempts(int(forced_resolution)) # bulk_message.append(message.split("--res=")[0]) else: bulk_message.append(message) if bulk_message: await send("\n".join(bulk_message))
async def solve(ctx, captcha_solution): await ctx.message.delete() filename = "solved_captcha.txt" media.write_file(filename, captcha_solution) await ctx.send("Attempting captcha solve...")