Compare commits

...

2 commits

Author SHA1 Message Date
haui
45816e0239 make bot functional 2026-02-01 20:20:26 +01:00
haui
2c262a8770 get working kde popup 2026-01-30 13:59:20 +01:00
3 changed files with 31 additions and 4 deletions

4
.gitignore vendored
View file

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

9
Dockerfile Normal file
View file

@ -0,0 +1,9 @@
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,8 +1,22 @@
#!/bin/sh
#if json quote list exist
#!/bin/bash
set -x
IdempotencyKey="$(uuidgen)"
. ./.env
Authorization="${UserToken}"
while /bin/true; do
if [ -f "./quotes.txt" ]; then
shuf -n 1 ./quotes.txt
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}"
else
echo "file does not exist!"
fi
sleep 3600
done