diff --git a/.gitignore b/.gitignore index b8dc55d..4fe0dc9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,2 @@ quotes.json quotes.txt -.env -Credentials -docker-compose.yml -oauth.sh diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index a7be026..0000000 --- a/Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -FROM bash:5 -WORKDIR /usr/local/quotebot - -COPY main.sh ./ - -RUN adduser -S quotebot --disabled-password --uid 1000 && apk add curl && apk add uuidgen -USER quotebot - -ENTRYPOINT ["bash", "/usr/local/quotebot/main.sh"] diff --git a/main.sh b/main.sh index 73b2225..6e62af4 100755 --- a/main.sh +++ b/main.sh @@ -1,22 +1,8 @@ -#!/bin/bash -set -x -IdempotencyKey="$(uuidgen)" -. ./.env -Authorization="${UserToken}" -while /bin/true; do +#!/bin/sh + +#if json quote list exist if [ -f "./quotes.txt" ]; then -status=$(shuf -n 1 ./quotes.txt) - -result=$(curl -X POST \ - -H "Authorization: Bearer ${Authorization}" \ - -H "Idempotency-Key: ${IdempotencyKey}" \ - -d "status=${status}" \ - "https://mastodon.giftedmc.com/api/v1/statuses") # HTTP/1.1 - -echo "${result}" - +shuf -n 1 ./quotes.txt else echo "file does not exist!" fi -sleep 3600 -done