Created
October 16, 2022 01:27
-
-
Save fredgido/c40dcac8ed8240b32395ce87f8521dcf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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