Last active
June 11, 2023 10:45
-
-
Save M-ZubairAhmed/41d675d0ff91d8299ae6eef4011b5709 to your computer and use it in GitHub Desktop.
Script to generate 5k custom emojis in Mattermost
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#title :generate-custom-emojis.sh | |
#description :This script create 4000 custom emojis in mattermost. | |
#authors :saturninoabril,m-zubairahmed | |
#version :0.2 | |
#notes :Replace token and creator id with your own. | |
# e.g. TOKEN="xgqkaquaii8cz8pqqak5jsfm8c" | |
TOKEN="XX" | |
# e.g. CREATOR_ID="d5qcffcb47bs5nft9b78wgydfy" | |
CREATOR_ID="YY" | |
# set number of images and list all image file names | |
NUMBER_OF_IMAGES=4 | |
SEED=$RANDOM | |
declare -a files=("image001.gif" | |
"image002.gif" | |
"image003.gif" | |
"image004.gif" | |
) | |
# set number of custom emojis to generate | |
let count=0 | |
for i in {6000..7000} | |
do | |
IMAGE="./${files[$((i % $NUMBER_OF_IMAGES))]}" | |
FILENAME="${files[$((i % $NUMBER_OF_IMAGES))]}" | |
EMOJI='{"name":"'"$i-${SEED}"'","creator_id":"'"$CREATOR_ID"'"}' | |
curl -i -X POST -H "Authorization: Bearer $TOKEN" -H "Content-Type: multipart/form-data" -F "image=@$IMAGE" -F "emoji=$EMOJI" http://localhost:8065/api/v4/emoji | |
let count++ | |
echo "${count} emojis uploaded" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment