Compare commits
5 Commits
V2.0
...
3ed5ef7079
Author | SHA1 | Date | |
---|---|---|---|
3ed5ef7079 | |||
05218ad6b2
|
|||
83662cd415
|
|||
1213e08c7b
|
|||
8605f7f732
|
@ -1,7 +1,7 @@
|
||||
name: QuotesBot
|
||||
on:
|
||||
schedule:
|
||||
- cron '36 */4 * * *'
|
||||
- cron '25 */5 * * *'
|
||||
permissions:
|
||||
contents: read
|
||||
jobs:
|
||||
|
12
README.md
12
README.md
@ -1,4 +1,5 @@
|
||||
# The new [QuotesBot](https://bots.fyrfli.social/@quotesbot) code
|
||||

|
||||
|
||||
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:
|
||||
|
||||
```
|
||||
[
|
||||
{
|
||||
"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
2
app.py
@ -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)
|
||||
|
Reference in New Issue
Block a user