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 comes from the environment:
SCHEDULE_TOML
- see below; a toml file containing pre-determined commandsSASL_USER
andSASL_PASSWORD
- username/password combo for your IRC serverSERVER
- IRC server to connect to, inirc://servr:port
/ircs://server:port
formVERIFY_TLS
- whether, on TLS enabled servers, to verify certs; useful for self-signed localhost serverTZ
- timezone to apply schedules to, inAsia/Seoul
/Europe/London
form; if empty, loads UTCALLOW_LIST
- comma seperated list of nicks which are allowed to update schedules
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 }}"