make bot functional
This commit is contained in:
parent
2c262a8770
commit
45816e0239
3 changed files with 29 additions and 6 deletions
22
main.sh
22
main.sh
|
|
@ -1,12 +1,22 @@
|
|||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
set -x
|
||||
IdempotencyKey="$(uuidgen)"
|
||||
. ./.env
|
||||
Authorization="${UserToken}"
|
||||
while /bin/true; do
|
||||
#if json quote list exist
|
||||
if [ -f "./quotes.txt" ]; then
|
||||
CurrentQuote=$(shuf -n 1 ./quotes.txt)
|
||||
#echo ${CurrentQuote}
|
||||
kdialog --passivepopup "${CurrentQuote}"
|
||||
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 300
|
||||
sleep 3600
|
||||
done
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue