tuxothy/README.md

5.7 KiB

Tuxothy

Tuxothy is the daily question bot for the <Linux> guild on WoW: Forever. He posts one question a day in a terminal-mail block, and the question bank is plain text files so it can grow forever. Commands are locked to the root role (server admins also pass).

  • Daily post: one question per day at a set time, in a channel you choose.
  • No repeats: every question is served once before any comes back. When the whole bank has been asked, it reshuffles from the top, never repeating the previous day's question.
  • Terminal style: each post is a fake mail header in an ansi code block — the fake sender, the date, a subject line, and the question.
  • Root only: /tux commands check for the configured role on every use.
  • Grows easily: ask an AI for more questions in the same style, drop them in a topic file, /tux reload — or add one live with /tux add.

Current bank

Topic file Questions
wow 237
gaming 248
tech 359
music 239
movies 225
heroes 177
life 244
food 276
total 2005

That's roughly five and a half years of daily posts before the bank wraps around.

Files

Path Purpose
tux.py the whole bot
questions/*.txt one question per line, # lines are comments, filename = topic
.env secrets + config (never committed)
state.json what's been asked (never committed, holds the rotation)
deploy/tuxothy.service systemd user unit for the VPS

One-time Discord setup

  1. Go to https://discord.com/developers/applications → New Application, name it Tuxothy (or Tuxothy <Linux>, whatever reads best in the member list).
  2. Left sidebar → Bot → Reset Token → copy it. That's BOT_TOKEN. Paste it into .env on the VPS (never into the repo, never in chat).
  3. Sidebar → Installation (or OAuth2 → URL Generator on older layouts). Scopes: bot and applications.commands. Bot permissions: Send Messages (that's it; no privileged intents needed — the bot uses slash commands only).
  4. Open the generated invite URL, pick your server, approve.
  5. Optional but recommended: on the Bot page turn Public Bot off so nobody else can invite him.

Invite URL by hand:

https://discord.com/oauth2/authorize?client_id=YOUR_APP_ID&scope=bot%20applications.commands&permissions=2048

Deploy on a server

Works on any Linux box with Python 3.11+ and systemd (user services need loginctl enable-linger).

ssh you@your-server
git clone <this repo's ssh url> tuxothy
cd tuxothy
python3 -m venv .venv
.venv/bin/pip install -r requirements.txt
cp .env.example .env
nano .env                      # paste BOT_TOKEN
mkdir -p ~/.config/systemd/user
cp deploy/tuxothy.service ~/.config/systemd/user/
systemctl --user daemon-reload
systemctl --user enable --now tuxothy
journalctl --user -u tuxothy -f

Log line tuxothy online as ... guilds: <Linux> (id) means he's connected. Slash commands appear within a minute or so; if you set GUILD_ID they register instantly for that server.

To update later: cd ~/tuxothy && git pull && systemctl --user restart tuxothy.

If git pull says Permission denied (publickey), add the VPS key — cat ~/.ssh/id_ed25519.pub — as a write-enabled deploy key in the repo settings (Settings → Deploy Keys). Until then, update the server by copying files over rsync from wherever the repo was pushed.

Commands (root role or server admin)

Command What it does
/tux ask [topic] post a question immediately; also sets the daily-post channel if unset
/tux add <question> [topic] append a question to a topic file (creates the topic if new)
/tux topics question count per topic
/tux status post count, bank size, schedule, channel
/tux schedule <HH:MM|off> set the daily time (24h clock) or turn auto-post off
/tux reload re-read question files from disk (after git pull or edits)

/tux ask in the channel you want the daily post to land in is the quickest way to set everything up.

Adding more questions

Fast way: /tux add <question> topic:wow in Discord. Then, when convenient, commit it:

cd ~/tuxothy && git add -A && git commit -m "add questions" && git push

Batch way: append lines to any questions/<topic>.txt (one per line, # comments okay), then /tux reload. Same rules as the existing bank:

  • one question per line, ends with ?, plain ASCII, max 200 characters
  • general and answerable by anyone in a sentence or three — no trivia, no quizzes
  • vary the openings; no duplicates (the bot skips exact repeats on load anyway)

To add a brand-new topic, just use a new filename; topics and status pick it up.

Configuration

Env var Default Meaning
BOT_TOKEN — required
ADMIN_ROLE root role that may run /tux commands
QOTD_TZ America/New_York timezone for the schedule
QOTD_TIME 17:00 default daily post time (state file overrides after /tux schedule)
QOTD_CHANNEL unset channel id for the daily post; /tux ask sets it too
GUILD_ID unset server id for instant command sync
QUESTIONS_DIR ./questions where the bank lives
STATE_FILE ./state.json rotation state

Notes

  • The schedule lives in state.json; /tux schedule updates it, the env default only seeds the first run.
  • If Discord is unreachable or the token is wrong, systemd retries every 10 seconds; check journalctl --user -u tuxothy -n 50.
  • The fake sender is Tuxothy <theone@linux.na>. Cosmetic only.
  • Nickname him Tuxothy in the server for the full effect.