mirror of
https://bitbucket.org/SosoM1k0r31z31/funny-cat.git
synced 2025-04-11 22:55:46 +02:00
fix screenshot
This commit is contained in:
parent
e12be86164
commit
64dd1ef758
34
bot.py
34
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} <a:load:769818027956895744>")
|
||||
msg = await ctx.send(f"Processing request for `{url}` <a:load:769818027956895744>")
|
||||
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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user