Browse Source

add emoji downloader script

votekiss
easrng 6 months ago committed by maia arson crimew
parent
commit
c0d02a9990
  1. 1
      .gitignore
  2. 23
      scripts/get_emojis.sh

1
.gitignore vendored

@ -1 +1,2 @@
/target
/frontend/emojis/*

23
scripts/get_emojis.sh

@ -0,0 +1,23 @@
#!/bin/sh
set -eu
# Get guild ID
if [ ! "$1" ];then
echo "You need to provide a Discord Guild ID."
exit 1
else
guild="$1"
fi
# Get emoji folder
emojiFolder="$(readlink -f "$(dirname $0)/../frontend/emojis/")"
# Get Discord token
printf "Token: " 1>&2
trap 'stty echo' INT EXIT
stty -echo
read token
printf "\n" 1>&2
stty echo
curl "https://discord.com/api/v9/guilds/${guild}/emojis" -H "Authorization: $token" | jq --raw-output 'map("curl '"'"'https://cdn.discordapp.com/emojis/" + .id + ".png?size=48&quality=lossless'"'"' -o '"'${emojiFolder}/"'" + .name + ".png'"'"'") | join("\n")' | sh
Loading…
Cancel
Save