add emoji downloader script
This commit is contained in:
parent
0ce6b32a12
commit
c0d02a9990
2 changed files with 24 additions and 0 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1 +1,2 @@
|
|||
/target
|
||||
/frontend/emojis/*
|
||||
|
|
23
scripts/get_emojis.sh
Executable file
23
scripts/get_emojis.sh
Executable file
|
@ -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…
Reference in a new issue