
Improved admin-command for roll Signed-off-by: James Ketrenos <james_eikona@ketrenos.com>
30 lines
653 B
Bash
Executable File
30 lines
653 B
Bash
Executable File
#!/bin/bash
|
|
ADMIN=$(jq -r .admin config/local.json)
|
|
if [[ "${ADMIN}" == "" ]]; then
|
|
echo "You need to set your { 'admin': 'secret' } in config/local.json"
|
|
exit 1
|
|
fi
|
|
|
|
id=$1
|
|
shift
|
|
color=$1
|
|
shift
|
|
dice1=$1
|
|
shift
|
|
if [[ "$1" != "" ]]; then
|
|
dice2=",$1"
|
|
fi
|
|
|
|
if [[ "${id}" == "" ]] || [[ "${color}" == "" ]] || [[ "$dice1" == "" ]]; then
|
|
echo "Usage: roll GAME-ID (red|white|blue|orange) DICE [DICE]"
|
|
exit 1
|
|
fi
|
|
|
|
curl --noproxy '*' -s -L \
|
|
--request PUT \
|
|
--header "PRIVATE-TOKEN: ${ADMIN}" \
|
|
--header "Content-Type: application/json" \
|
|
http://localhost:8930/ketr.ketran/api/v1/games/${id}/roll/${color}?dice=${dice1}${dice2}
|
|
# | jq -r .status
|
|
|