Compare commits

..

No commits in common. "45816e02395c3c5584564d7089bc9a7bff8438ca" and "5d20c07a54b8354d9c4b15a5a4ac3a89026a39b3" have entirely different histories.

3 changed files with 4 additions and 31 deletions

4
.gitignore vendored
View file

@ -1,6 +1,2 @@
quotes.json
quotes.txt
.env
Credentials
docker-compose.yml
oauth.sh

View file

@ -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"]

22
main.sh
View file

@ -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