agafnd

what's all this then

I've got a mastodon bot running at @AbsurdistAscensions@botsin.space. Following is an explanation of how it works.

the code

#!/usr/bin/env bash

while true; do # infinite loop
    date # just for monitoring purposes
    words="$(head -n 1 two_words.txt)" # get the first line from two_words.txt. more on that file later
    tail -n +2 two_words.txt | sponge two_words.txt # remove the first line from two_words.txt
    phrase="$(shuf -n 1 finally.txt)" # get a random line from finally.txt. more on that file later
    phrase="${phrase//XYZ/$words}" # replace the letters "XYZ" in the random phrase with the two words
    phrase="${phrase//ABC/$(< last_words.txt)}" # if there's ABC in the selected phrase, replace that with the last two words used
    echo "$words" > last_words.txt # set up the last two words file
    echo "$phrase" # for monitoring purposes
    toot post --using AbsurdistAscensions@botsin.space "$phrase" # post it to the account!
    sleep 5h # this bot posts every 5 hours plus however long it takes to do all of that
done

What is two words.txt

I ran

for i in {1..2000}; do echo $(shuf -n 2 /usr/share/dict/words | tr [a-z] [A-Z]) >> two_words.txt ; done

and started manually curating entries. Sometime I'd like to get some good wordlists and generate non sequiturs automatically; but at a rate of one post every five hours, I think this is sustainable for the time being.

What is finally.txt

It's a list of phrases that the bot can use, you can read it here. It's a bit short at the moment, go ahead and mention or DM the bot with suggestions if you want.