7 Commits

Author SHA1 Message Date
9b00d5d6ee tweaks 2025-06-05 05:36:27 -05:00
467defdffe error in field name 2025-06-05 05:35:07 -05:00
3ed5ef7079 Update .gitea/workflows/deploy.yml 2025-06-05 05:19:17 -05:00
05218ad6b2 update README 2025-06-05 05:15:20 -05:00
83662cd415 error in field name 2025-06-05 05:12:59 -05:00
1213e08c7b forgot the hashtags 2025-06-05 05:09:27 -05:00
8605f7f732 add a badge; not sure if it works yet 2025-06-05 05:08:11 -05:00
3 changed files with 8 additions and 14 deletions

View File

@ -1,9 +1,7 @@
name: QuotesBot
on:
schedule:
- cron '36 */4 * * *'
permissions:
contents: read
- cron '41 */5 * * *'
jobs:
deploy:
runs: ubuntu-latest

View File

@ -1,6 +1,7 @@
# The new [QuotesBot](https://bots.fyrfli.social/@quotesbot) code
![](https://fyrfli.dev/fyrfli/quotesbot/actions/workflows/deploy/badge.svg?branch=main&event=run)
In the neverending quest to improve my coding skills, I often check out the code that other bots employ Last night, I decided to check out the code for the [ThursdayBot](https://github.com/devashishp/thursday) and realised something really neat:
In the neverending quest to improve my coding skills, I often check out the code that other bots employ. Last night, I decided to check out the code for the [ThursdayBot](https://github.com/devashishp/thursday) and realised something really neat:
>[!IMPORTANT]
>***there is a way to make the bot completely foolproof!!!***
@ -25,15 +26,10 @@ Posts a quote every 4 hours from a file that you specify.
- the CSV-Formatted file should include two (2) columns: "quote" and "author" (in that order) like:
```
[
{
"quote": "Amet lorem voluptatem tempore sint quod? Nam porro aliquid aspernatur assumenda fugiat A odit excepturi facere vero nihil Nulla voluptate accusantium vero recusandae nulla Obcaecati nemo dolor non reprehenderit excepturi23",
"author": "Example Author",
"quote": "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla",
"author": "Author Exemplaris",
...
}
]
quote,author
"Amet lorem voluptatem tempore sint quod? Nam porro aliquid aspernatur assumenda fugiat A odit excepturi facere vero nihil Nulla voluptate accusantium vero recusandae nulla Obcaecati nemo dolor non reprehenderit excepturi23", "Example Author"
"Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla","Author Exemplaris",
...
```
### Steps

2
app.py
View File

@ -17,5 +17,5 @@ if source_object.reason == "OK":
print(choices[0])
choice = choices[randint(0, len(choices) - 1)]
headers = {'Authorization': 'Bearer ' + post_token}
payload = {'status': f"{choice['quote']}\n\n - {choice['author']}", 'privacy': 'public'}
payload = {'status': f"{choice['quote']}\n\n - {choice['author']}\n\n#RandomQuote #quotes #quote #bot", 'visibility': 'public'}
response = post(post_endpoint, headers=headers, data=payload)