Ported my @covidsewage bot over to Mastodon

Every morning it posts an image with the latest Covid sewage charts for various locations around the San Francisco Bay Area - because the sewage charts are the only figures I still trust!

The sewage doesn't lie

The screenshots come from https://covid19.sccgov.org/dashboard-wastewater - here's the latest image:

The bot runs entirely from this GitHub scheduled actions workflow: https://github.com/simonw/covidsewage-bot/blob/main/.github/workflows/toot.yml

It uses my https://shot-scraper.datasette.io/ CLI screenshot automation tool and the excellent https://toot.readthedocs.io/ Mastodon CLI utility

covidsewage-bot/toot.yml at main · simonw/covidsewage-bot

The @covidsewage bot. Contribute to simonw/covidsewage-bot development by creating an account on GitHub.

GitHub
Amusingly, I found toot because I sat down to build myself a CLI tool for posting to Mastodon (an equivalent of my existing https://github.com/simonw/tweet-images tool) and checked PyPI to see if the name "toot" was available... and it had already been taken by a tool that did EXACTLY what I wanted to do
GitHub - simonw/tweet-images: Send tweets with images from the command line

Send tweets with images from the command line. Contribute to simonw/tweet-images development by creating an account on GitHub.

GitHub
Here's a TIL describing how the new Mastodon bot works - should be handy for anyone else who wants to create their own bots too: https://til.simonwillison.net/mastodon/mastodon-bots-github-actions
Building Mastodon bots with GitHub Actions and toot

Twitter [announced today](https://twitter.com/TwitterDev/status/1621026986784337922) that they'll be ending free API access for bots. My [@covidsewage](https://twitter.com/covidsewage) Twitter bot po

@simon for some reason, Ivory just sits here spinning? Any other Ivory app users here able to Follow this new bot account?
@case how odd! I just unfollowed and followed in Ivory and it worked OK
@simon got it working. I’d pasted the https link and was relying on Ivory to parse the “user” URL, which has worked in the past. Maybe there’s a subtle bug in there somewhere.

@simon
Thanks for sharing!

I realized my bot built with https://cheapbotsdonequick.com/ will likely die soon, along with the access to the "source code" (mostly text). Have you used this, and know of any way to migrate from there to Mastodon?

My bot https://twitter.com/homerlines just posts a random line of text from a big list, and needs to avoid obvious duplicates. I don't know how to store the necessary state with GitHub Actions...

Cheap Bots, Done Quick!

@bassistance easiest way to store state in a GitHub Actions run is to commit a text file back to the repo itself

@simon
Makes sense! I can put the text input in one file, and reference the last x published lines in another, than find a good shuffle algorithm that would also work for a song playlist...

Or just shuffle the input once, then store the current line and roll over from the end back to the beginning... (and shuffle again?)

@bassistance i just heard of https://cheapbotstootsweet.com/ could it be of use?
Cheap Bots, Toot Sweet!

@marcoshuerta that looks perfect, thanks! I'll try it once my botsin.space account gets approved 🤞

@simon I kept seeing Toot CLI in the client application _name data and I was confused. I though it was like a pine/elm/nano thing.

I didn’t think that people would of course use it to make bots! Seems obvious now.

(I’ve been using the `mastodon.py` module)