The new 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 and realised something really neat:

Important

there is a way to make the bot completely foolproof!!!

Without delay, I tested it out for myself and when I was satisfied, updated this repository to take over from the cronjob I was using. The old code is still available under the .archive subdirectory and will be for a few weeks.

What does it do?

Posts a quote every 4 hours from a file that you specify.

To do

  • enable using a software forge to store the CSV-formatted text file with your list of quotes.
  • maybe use a secret to customise the run schedule

Customising for your own use

Requirements

  • an account on an ActivityPub instance like Mastodon
  • a developer token (which can be issued from your settings page - on Mastodon that is https://your-instance.url/settings/applications)
  • a CSV-Formatted file stored online somewhere
  • 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",
        ...
    }
]

Steps

  • clone the repository to any software forge that supoorts the use of Github-style action.
    • you will need an account of your own
    • the ones that I know of right now are:
  • create your secrets:
    • POST_TOKEN: an API development token from your Mastodon API-compatible ActivityPub software instance
    • POST_ENDPOINT: https://your-instance.url/api/v1/statuses
    • SOURCE_ENDPOINT: a link to an online text file in CSV format
  • wait and watch your bot account for posts

Enjoy!!

Bug fixes Latest
2025-06-05 14:30:06 -05:00
Languages
Python 100%