Skip to content

Instantly share code, notes, and snippets.

@atpons
Created February 9, 2018 04:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atpons/24f2399bc7280bcb843bdbe11aca00c4 to your computer and use it in GitHub Desktop.
Save atpons/24f2399bc7280bcb843bdbe11aca00c4 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Discord へ指定フォルダ内のemojiをupload
# @atpons / MIT License
TOKEN=TOKEN_OF_BOT
DIR=DIRECTORY
ID=SERVER_ID
for file in `\find $DIR -maxdepth 1 -type f`; do
NAME=`basename $file | sed 's/\.[^\.]*$//' | sed 's/-/_/g'`
IMG=`base64 $file`
echo $NAME
curl -H 'Content-Type:application/json' -H "Authorization:Bot $TOKEN" -d "{\"name\":\"$NAME\",\"image\":\"data:image/png;base64,$IMG\"}" https://discordapp.com/api/guilds/$ID/emojis
sleep 1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment