Skip to content
Extraits de code Groupes Projets
Valider 24643ca2 rédigé par Tigriz's avatar Tigriz
Parcourir les fichiers

risitas and fixing script

parent f7cbb3af
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
#!/bin/bash
# usage
# matrixpack token
# matrixpack token homeserver
#
# pack name is the folder name
# sticker name is the file name
# /!\ token is sensible information
if test $# != 1 ; then
if test $# != 2 ; then
echo 1>&2 "$0:FATAL: $# invalid argument number (expected 1)"
exit 1
fi
......@@ -14,18 +14,19 @@ fi
dir=$(pwd)
token=$1
packname=${dir##*/}
homeserver=$2
echo -e "Creating sticker pack\ndir=$dir\npackname=$packname"
echo -n "{\"title\":\"$packname\",\"id\":\"$packname\",\"stickers\":[" > "$packname.json"
json="{\"title\":\"$packname\",\"id\":\"$packname\",\"stickers\":["
first=0
for f in *
do
if test $first != 1 ; then
first=1
else echo -n "," >> "$packname.json"
else json="$json,"
fi
mxc=$(curl -X POST -H "Content-Type: image/png" --data-binary "@$f" "https://serveur.d'accueil/_matrix/media/r0/upload?access_token=$token" | python3 -c "import sys, json; print(json.load(sys.stdin)['content_uri'])")
echo -n "{\"body\":\"$f\",\"info\":{\"h\":128,\"w\":128,\"thumbnail_url\":\"$mxc\"},\"msgtype\":\"m.sticker\",\"url\":\"$mxc\",\"id\":\"$f\"}" >> "$packname.json"
mxc=$(curl -X POST -H "Content-Type: image/png" --data-binary "@$f" "https://$homeserver/_matrix/media/r0/upload?access_token=$token" | python3 -c "import sys, json; print(json.load(sys.stdin)['content_uri'])")
json="$json{\"body\":\"$f\",\"info\":{\"h\":128,\"w\":128,\"thumbnail_url\":\"$mxc\"},\"msgtype\":\"m.sticker\",\"url\":\"$mxc\",\"id\":\"$f\"}"
done
echo -n "]}" >> "$packname.json"
echo -n "$json]}" > "$packname.json"
Risitas vanilla np gg
{"title":"Risitas","id":"Risitas","stickers":[{"body":"aya.png","info":{"h":128,"w":128,"thumbnail_url":"mxc://helianthine.solar/TkErqCrcZXJwmLWsTwVTjDvr"},"msgtype":"m.sticker","url":"mxc://helianthine.solar/TkErqCrcZXJwmLWsTwVTjDvr","id":"aya.png"},{"body":"celestin.png","info":{"h":128,"w":128,"thumbnail_url":"mxc://helianthine.solar/ZvNbdUJXxhJmLcsRiMNctvMP"},"msgtype":"m.sticker","url":"mxc://helianthine.solar/ZvNbdUJXxhJmLcsRiMNctvMP","id":"celestin.png"},{"body":"coca.png","info":{"h":128,"w":128,"thumbnail_url":"mxc://helianthine.solar/lwIFeeSQvUAJIEmOwKOYFzrY"},"msgtype":"m.sticker","url":"mxc://helianthine.solar/lwIFeeSQvUAJIEmOwKOYFzrY","id":"coca.png"},{"body":"facho.png","info":{"h":128,"w":128,"thumbnail_url":"mxc://helianthine.solar/rRJUZmHBfoSHucFkvXnUXzqh"},"msgtype":"m.sticker","url":"mxc://helianthine.solar/rRJUZmHBfoSHucFkvXnUXzqh","id":"facho.png"},{"body":"fume.png","info":{"h":128,"w":128,"thumbnail_url":"mxc://helianthine.solar/fVBIwibKsCtjukfnkFSVTxtN"},"msgtype":"m.sticker","url":"mxc://helianthine.solar/fVBIwibKsCtjukfnkFSVTxtN","id":"fume.png"},{"body":"journal.png","info":{"h":128,"w":128,"thumbnail_url":"mxc://helianthine.solar/qjUjJNhCiCjPhSiVxgWZnLSu"},"msgtype":"m.sticker","url":"mxc://helianthine.solar/qjUjJNhCiCjPhSiVxgWZnLSu","id":"journal.png"},{"body":"moustache.png","info":{"h":128,"w":128,"thumbnail_url":"mxc://helianthine.solar/ePiCsrnRLgQHTfeLTExjkxSn"},"msgtype":"m.sticker","url":"mxc://helianthine.solar/ePiCsrnRLgQHTfeLTExjkxSn","id":"moustache.png"},{"body":"old.png","info":{"h":128,"w":128,"thumbnail_url":"mxc://helianthine.solar/WASNZPnMxLXHgaYgRrYlYvDb"},"msgtype":"m.sticker","url":"mxc://helianthine.solar/WASNZPnMxLXHgaYgRrYlYvDb","id":"old.png"},{"body":"osef.png","info":{"h":128,"w":128,"thumbnail_url":"mxc://helianthine.solar/AwZFWDBpUUQSNBRVWQCJWFoX"},"msgtype":"m.sticker","url":"mxc://helianthine.solar/AwZFWDBpUUQSNBRVWQCJWFoX","id":"osef.png"},{"body":"singe.png","info":{"h":128,"w":128,"thumbnail_url":"mxc://helianthine.solar/VByszUqIVhtFhgebDkLazDXF"},"msgtype":"m.sticker","url":"mxc://helianthine.solar/VByszUqIVhtFhgebDkLazDXF","id":"singe.png"},{"body":"sueur.png","info":{"h":128,"w":128,"thumbnail_url":"mxc://helianthine.solar/rRWeOxQfzqHSxaGkjVrqcJmz"},"msgtype":"m.sticker","url":"mxc://helianthine.solar/rRWeOxQfzqHSxaGkjVrqcJmz","id":"sueur.png"},{"body":"tasse.png","info":{"h":128,"w":128,"thumbnail_url":"mxc://helianthine.solar/fXJolYTUoHlcwhTQsrFhgrhu"},"msgtype":"m.sticker","url":"mxc://helianthine.solar/fXJolYTUoHlcwhTQsrFhgrhu","id":"tasse.png"},{"body":"yeslife.png","info":{"h":128,"w":128,"thumbnail_url":"mxc://helianthine.solar/guFxvmHNAEZSCnRsMJYkrNNy"},"msgtype":"m.sticker","url":"mxc://helianthine.solar/guFxvmHNAEZSCnRsMJYkrNNy","id":"yeslife.png"}]}
\ No newline at end of file
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter