5 Commits

Author SHA1 Message Date
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 7 additions and 11 deletions

View File

@ -1,7 +1,7 @@
name: QuotesBot name: QuotesBot
on: on:
schedule: schedule:
- cron '36 */4 * * *' - cron '25 */5 * * *'
permissions: permissions:
contents: read contents: read
jobs: jobs:

View File

@ -1,4 +1,5 @@
# The new [QuotesBot](https://bots.fyrfli.social/@quotesbot) code # 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:
@ -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: - the CSV-Formatted file should include two (2) columns: "quote" and "author" (in that order) like:
``` ```
[ 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"
"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", "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",
"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",
... ...
}
]
``` ```
### Steps ### Steps

2
app.py
View File

@ -17,5 +17,5 @@ if source_object.reason == "OK":
print(choices[0]) print(choices[0])
choice = choices[randint(0, len(choices) - 1)] choice = choices[randint(0, len(choices) - 1)]
headers = {'Authorization': 'Bearer ' + post_token} 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) response = post(post_endpoint, headers=headers, data=payload)