Skip to content

Instantly share code, notes, and snippets.

@fredgido
Created October 16, 2022 01:27
Show Gist options
  • Select an option

  • Save fredgido/c40dcac8ed8240b32395ce87f8521dcf to your computer and use it in GitHub Desktop.

Select an option

Save fredgido/c40dcac8ed8240b32395ce87f8521dcf to your computer and use it in GitHub Desktop.
import discord
from PIL import Image
import io
import json
import httpx
bot = discord.Bot()
@bot.slash_command()
async def inspect(ctx, url: str):
try:
async with httpx.AsyncClient() as client:
r = await client.get(url)
data = r.content
img = Image.open(io.BytesIO(data))
except Exception as e:
return await ctx.respond(f"Failed loading image {e}")
await ctx.respond(json.dumps(dict(img.text.items()), indent=4))
bot.run("token")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment