diff --git a/bot.py b/bot.py index 76d8508..a5469ac 100644 --- a/bot.py +++ b/bot.py @@ -1915,7 +1915,7 @@ async def ffmpeg2(ctx, ext, *, args): os.remove(urlllname) os.remove(fileout) - +""" @bot.command() async def screenshot(ctx, url): url2 = f"https://api.apiflash.com/v1/urltoimage?access_key=84f448c81a3f4ddbacf188aca585a4f6&url={url}" @@ -1925,7 +1925,7 @@ async def screenshot(ctx, url): await ctx.send(f"An error occured while connecting to `{url}`") else: await ctx.send(url2) - +""" @bot.command() async def twerkradio(ctx, loop: int = 1): @@ -2249,26 +2249,42 @@ async def dumpy(ctx, lines : int = 10): @bot.command() async def screenshot(ctx, url): - msg = await ctx.send(f"Processing request for {url} ") + msg = await ctx.send(f"Processing request for `{url}` ") try: mobile_emulation = { - "deviceMetrics": { "width": 360, "height": 640, "pixelRatio": 3.0 }, - "userAgent": "Mozilla/5.0 (Linux; Android 4.2.1; en-us; Nexus 5 Build/JOP40D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19"} + "deviceMetrics": { "width": 375, "height": 812, "pixelRatio": 3.0 }, + "userAgent": "Mozilla/5.0 (Linux; Android 9; Samsung Galaxy Note 9 Build/SM-N960N) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/5.2 Chrome/71.0.3578.99 Mobile Safari/604.1"} chrome_options = Options() chrome_options.add_argument("--headless") chrome_options.add_argument("--disable-gpu") chrome_options.add_experimental_option("mobileEmulation", mobile_emulation) - driver = webdriver.Chrome(chrome_options = chrome_options) + driver = webdriver.Chrome(options = chrome_options) + driver.set_page_load_timeout(25) driver.get(url) driver.save_screenshot("ytdl/screenshot.png") driver.quit() except Exception as x: - await ctx.channel.send(f"error...\n`{x}`") - msg.delete() - await ctx.channel.send(f"{ctx.author.mention}", file=discord.File("ytdl/screenshot.png")) + await ctx.send(f"<:error:871854416238612520> `{x}`") + return + await msg.delete() + channel = ctx.channel + msg = await ctx.channel.send(f"{ctx.author.mention}", file=discord.File("ytdl/screenshot.png")) + # + await msg.add_reaction('🗑️') + def check(reaction, user): + return user == ctx.author and str(reaction.emoji) == '🗑️' + + try: + reaction, user = await bot.wait_for('reaction_add', timeout=60.0, check=check) + except asyncio.TimeoutError: + await ctx.send('sex!') + else: + await msg.delete() + os.system(f'rm ytdl/screenshot.png') + """ if number == None: z = int(idd)