here's another one of my incredibly simple bots
I really like the music of bill wurtz. in July 2023, inspired by a similar They Might Be Giants lyric–posting bot, I downloaded his truly eye-popping lyrics page and did some semi-manual data massaging to split each song into a separate plaintext file. the rest was quite easy and resulted in @BillWurtzLyrics@www.librepunk.club
the code
#!/usr/bin/env bash
while true; do
date # prints out a timestamp for monitoring purposes
# here we pick a song to take lyrics from. (this code is run in the directory where all the lyric files are)
song="$(ls *.txt | shuf -n 1)" # you're not supposed to parse the output of ls but all the filenames are sanitized slugs
# this command gets 1-6 lines starting from a random position in the song
lyrics="$(tail -n +$(shuf -i 1-$(wc -l "$song" | cut -d' ' -f1) -n 1) "$song" | head -n $(shuf -i 1-6 -n 1))"
echo "$lyrics"
~/.local/bin/toot post --using BillWurtzLyrics@www.librepunk.club -v unlisted "$lyrics"
sleep 6h
done
It just runs in a tmux window. Nothing fancy because this is about all I know how to make the computer do