Get a user's Discord avatar by their ID. This worker allows CORS from any origin, and can be embedded into websites, using your Discord profile as a sort of proto-Gravatar.
https://your.workers.dev/(id)
Parameter | Default |
---|---|
format | png |
resolution | 1024 |
This project uses Upstash Redis to cache the avatars. You can get a free account here.
- Create a new Upstash Redis instance, and save the URL and password.
- Create a Discord bot and save the token. No intents are required.
- Fork this repository, and deploy it to Cloudflare Workers.
- Go to the Worker settings and add the following secrets:
UPSTASH_REDIS_URL
: The URL of the Upstash Redis instance.UPSTASH_REDIS_TOKEN
: The password of the Upstash Redis instance.DISCORD_TOKEN
: The token of the Discord bot.
- Redeploy the Worker, and optionally set up Workers Builds.
- Enjoy!