IRC bot written in golang

mouz 58b3899937 16 types of tea 2 months ago
app f51af88ac1 bump major version number to 4 2 months ago
irc b9f7ec762a do not ask chanserv to invite to channel 2 months ago
plugins 58b3899937 16 types of tea 2 months ago
LICENSE 6b0525a39d Extend LICENCE 2 months ago
Makefile 6aec7fd4e4 More detailed uptime in output of !versie. 2 months ago 67f1b1eda9 SSL connections better explanation 2 months ago
bot.go 25207974b6 Update documentation for one connection per bot. 2 months ago
bot.service de40e27982 Describe how to reset systemd restart limit counters. 2 months ago
client.go 25207974b6 Update documentation for one connection per bot. 2 months ago
main.go 11f79c110c Minor edits (function renames). 2 months ago
pre-commit e244d487a9 Adds pre-commit script 2 months ago
request.go a891dfc68f Replace references to old repository 2 months ago


This program is a simple IRC bot written in golang.

Its development started as a clone of autimaat. Changes since cloning:

  • removal of code not in use
  • another weather server
  • reminder plugin extended with extra commands
  • help command extended with list of commands in PM


$ go get


First, create a new profile directory and configuration file:

$ bot -new /path/to/profile

Edit the newly created configuration file to your liking:

$ nano /path/to/profile/profile.cfg

Relaunch the bot to use the new profile:

$ bot /path/to/profile

In order to have the bot automatically re-launch after shutdown, an external supervisor like systemd is required. The bot will create a PID file at /path/to/profile/, in case the supervisor requires it.

The bot will fork itself once, after it has been launched. This is done to play nice with things like systemd. Manually forking the bot Can be done through the command:

$ kill -s USR1 `pidof bot`

This tells the bot to fork itself, while passing along any existing connections. The old process then shuts itself down. This mechanism allows the bot to be binary-patched, without downtime.

weather and owm plugins

The weather and owm plugins provide bindings for weather related APIs. These services require registration of accounts in order to get the needed API keys.

These keys should put in a separate weather.cfg file, with the following contents:

  "WundergroundAPIKey": "xxxxx"
  "OwmAPIKey": "xxxxxxxxxxxxxx"

URL plugin

The url plugin uses the YouTube Data API v3 to fetch playback durations for videos being linked in a channel. This API requires the registration of a Google Developer API key at:

The API key you receive should be assigned to the YoutubeApiKey field in the bot profile.

The key should put in a separate url.cfg file, with the following contents:

  "YoutubeApiKey": "xxxxx"


The bot version is made up of 3 numbers:

  • Major version: This number only changes if the bot itself changes in a way that makes it incompatible with previous versions. Changes to the format of configuration files increment this number. Changes to the way user commands are implemented do not.
  • Minor version: This number changes whenever one of the plugin APIs change or commands are added/removed.
  • Revision: This is the unix timestamp of the last commit. This number changes whenever any kind of change occurs in any of the code. Including small bug fixes. This number is updated through a go build flag in the included Makefile.

String translations

The output of the bot to IRC channels/users is done in a specific language. Translations for all used strings can be found in the various strings.go files, included in all plugins, as well as the cmd package. Basically, you should find . -name strings.go to get them all. Then edit them as needed.


Unless otherwise noted, the contents of this project are subject to a 1-clause BSD license. Its contents can be found in the enclosed LICENSE file.

SSL connections

The bot is not SSL aware. SSL connections can be created with the help of the stunnel tool. Configure stunnel to connect to the SSL port of the IRC server. Let it serve on some local port. Then configure the bot to connect to the local port. On my debian server this is a working /etc/stunnel/stunnel.conf:

setuid = stunnel4
setgid = stunnel4
pid = /var/run/stunnel4/
output = /var/log/stunnel4/stunnel.log

client = yes
accept =
connect =