IRCv3 Bot
  • Crystal 99.4%
  • Just 0.5%
  • Dockerfile 0.1%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-11-02 12:02:31 +07:00
.forgejo/workflows chore: remove obsolete scripts 2026-10-28 14:00:55 +07:00
scripts chore: remove Bash from justfile, use Crystal for unreachable check 2026-11-02 12:02:31 +07:00
spec feat: add Twonks daily comic 2026-11-01 21:59:53 +07:00
src chore: cleanup duplicated user agent definition 2026-11-02 10:57:23 +07:00
.env.example feat: add Twonks daily comic 2026-11-01 21:59:53 +07:00
.gitignore fix(ci): add empty sources so we can skip generation in ci tests 2026-10-22 07:51:26 +07:00
avatar.jpg chore: add avatar pic 2026-10-17 09:09:34 +07:00
CHANGELOG.md chore(release): v0.12.1 2026-11-02 11:25:14 +07:00
Containerfile feat: add Twonks daily comic 2026-11-01 21:59:53 +07:00
justfile chore: remove Bash from justfile, use Crystal for unreachable check 2026-11-02 12:02:31 +07:00
lefthook.yml feat: first draft 2026-10-17 08:10:46 +07:00
LICENSE feat: first draft 2026-10-17 08:10:46 +07:00
README.md feat: add Twonks daily comic 2026-11-01 21:59:53 +07:00
renovate.json feat: first draft 2026-10-17 08:10:46 +07:00
shard.lock feat: first draft 2026-10-17 08:10:46 +07:00
shard.yml chore(release): v0.12.1 2026-11-02 11:25:14 +07:00

Botium

As the duly-elected mobsters of this union, it's our duty to support the struggle of these proud, lazy slobs.

—Donbot

IRCv3 bot written in Crystal 🔮

Connects over TCP (plain/TLS) or WebSocket, negotiates IRCv3 caps, authenticates via SASL PLAIN, joins the configured channels, answers PINGs with PONG-liveness tracking, and reconnects forever with capped exponential backoff.

Usage

!help in a joined channel (or just help in private) to list the available commands.

Features

Core IRCv3

  • Multi-transport connectivity: plain TCP, TLS (ircs://), and WebSocket (ws:// / wss://)
  • IRCv3 capability negotiation, SASL PLAIN authentication, and draft/metadata-2 avatar advertisement
  • PING/PONG liveness tracking with periodic latency statistics
  • Automatic rejoin of channels after reconnection and reconnect-forever with capped exponential backoff
  • Multiline message handling

Greeting

  • Greets newcomers in a configurable channel (with WHOIS re-verification and a configurable delay)
  • Greeting template with {nick} placeholder; greeted nicks are persisted so repeat visitors aren't re-greeted

Scheduled posts

  • Daily random XKCD comic post at a configurable local time
  • Daily random MonkeyUser comic post, index generated at image build time from the site's own catalog
  • Daily random Dilbert strip post, index generated at image build time from ecstrema/dilbert
  • Daily random Work Chronicles comic post, index generated at image build time from the Substack archive API
  • Daily random Twonks comic post, index generated at image build time from the site's Bluesky feed
  • Daily random programming quote post

Announcements

  • RSS/Atom feed polling with per-feed channel routing, dedup checkpoints (ETag/Last-Modified aware), and configurable announcement template
  • Forgejo repository-activity announcements (releases, pushes, issues, ...) supporting multiple Forgejo instances, per-repo channel routing, and per-repo ignore lists

Interactive commands

  • Central !command registry with help output (!help), plus !xkcd, !quote, !monkeyuser, !dilbert, !twonks and !workchronicles on demand
  • Channels only accept !-prefixed commands; private messages accept bare verbs too

HTTP webhook

  • Bearer-token-authenticated POST /v1/send endpoint for pushing messages to joined channels
  • Public GET /v1/health for uptime monitoring and telemetry

Operations

  • Configuration via environment variables or a .env file
  • Persistent JSON state files (greeted nicks, shown comics/quotes, feed checkpoints)
  • Structured logging with configurable level; health-check endpoint
  • E2E test suite against a real Ergo server in a podman container

Install

Either via Crystal (Shards) build:

shards build --release botium   # compiles the binary under `./bin/botium`

or run the container directly, e.g.:

podman run --rm --env-file .env forge.l3x.in/alex/botium:latest

Development

Commits follow the Conventional Commits specification (feat:, fix:, chore:, ...), which drives both the changelog and versioning: feat bumps the minor version, fix (and everything else) the patch, and breaking changes (feat!: or a BREAKING CHANGE: footer) the major one.

Releasing is automated — bump, changelog, tag, container build and deploy all stem from it:

just release

This derives the next version from the commits since the last tag, updates shard.yml and CHANGELOG.md, commits, tags and pushes. The v* tag then triggers the release workflow, which validates, publishes the container image (v<version> + latest), creates the Forgejo release with the changelog section as notes, and redeploys the service.

Requires:

Run just to list all available commands:

just  # available commands

End-to-end validation

spec/e2e_spec.cr runs the IRC client against a real Ergo server in a podman testcontainer (anonymous registration + cap negotiation, SASL PLAIN, channel PRIVMSG round trip, WebSocket transport):

E2E=1 crystal spec spec/e2e_spec.cr   # requires podman + the ergo image
# or simply:
just e2e

Configuration is via environment variables or a .env file (see .env.example).

Running dev

cp .env.example .env    # edit
just run