This IRC bot runs a series of pre-determined irc commands on a schedule. It also accepts new commands from trusted users. These users need to be passed to the bot via an env var, and the bot restarted because:
The permissions the bot potentially needs (like chanops for setting topics) means the bot could be easily abused
Restarting the bot is a conscious decision, and so is less likely to be done accidentally/ through security flaw
These commands are useful for a number of reasons:
We can update topics regularly
We can send daily messages, like news headlines, or daily calendar updates
Things to consider:
Predetermined commands are hardcoded to a file
Ephemeral commands (as in: added via irc) are not persisted: they will go away when the bot restarts.
Changes/ new commands require the bot to be restarted
Configuration
Configuration comes from the environment:
SCHEDULE_TOML - see below; a toml file containing pre-determined commands
SASL_USER and SASL_PASSWORD - username/password combo for your IRC server
SERVER - IRC server to connect to, in irc://servr:port / ircs://server:port form
VERIFY_TLS - whether, on TLS enabled servers, to verify certs; useful for self-signed localhost server
TZ - timezone to apply schedules to, in Asia/Seoul / Europe/London form; if empty, loads UTC
ALLOW_LIST - comma seperated list of nicks which are allowed to update schedules
Predetermined commands
Consider the file schedule.toml, which is determined by the env var SCHEDULE_TOML
[set-topic]
schedule: "@midnight"
command: "TOPIC"
target: "#my-chan"
args: "Welcome to my channel. The date is {{ .Date }}"