Skip to content

Instantly share code, notes, and snippets.

@yutsuku
Created February 17, 2019 03:36
Show Gist options
  • Save yutsuku/b0f83665b11ce04354a9453447de4260 to your computer and use it in GitHub Desktop.
Save yutsuku/b0f83665b11ce04354a9453447de4260 to your computer and use it in GitHub Desktop.
bash script to easily change Discord Bot avatar
#!/bin/bash
if [ -z "$1" ]
then
echo "Usage: $0 your-image.jpg"
exit
fi
# get your "Bot" token from
# https://discordapp.com/developers/applications/
token="<bot-token-goes-here>"
b64=$(base64 -w 0 $1)
avatar="data:image/jpeg;base64,"$b64
(echo -n "{\"avatar\": \"$avatar\"}") | curl -H "Authorization: Bot $token" -H "Content-Type: application/json" -X PATCH -d @- https://discordapp.com/api/users/@me
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment