Also adopt interface for querying time information, so it can be faked
properly during at test time
Signed-off-by: Luca Bigliardi <shammash@google.com>
Make sure the underlying library context cancellation happens only
after the session has been shutdown.
Signed-off-by: Luca Bigliardi <shammash@google.com>
Use newly added ConnectContext function.
Note: This is using a yet-to-be-released goirc module version obtained
with "go get -u github.com/fluffle/goirc@master"
Signed-off-by: Luca Bigliardi <shammash@google.com>
Make sure the session is up before consuming alert messages.
Also, split main run loop for readability.
Signed-off-by: Luca Bigliardi <shammash@google.com>
Use nonexistent irc server and empty channel list as default config
options to avoid unwanted surprises when testing the bot.
Addresses https://github.com/google/alertmanager-irc-relay/issues/5
Signed-off-by: Luca Bigliardi <shammash@google.com>
Add `use_privmsg` config option to deliver alerts with PRIVMSG instead
of the default NOTICE.
This addresses a use case described in
https://github.com/google/alertmanager-irc-relay/pull/1 .
Signed-off-by: Luca Bigliardi <shammash@google.com>
Use a more generic name as there is soon going to be support for PRIVMSG
(see https://github.com/google/alertmanager-irc-relay/pull/1 for
background).
This introduces a backward-incompatible change in the config file for
these two parameters:
- notice_template -> msg_template
- notice_once_per_alert_group -> msg_once_per_alert_group
I am not introducing the new parameters with a deprecation plan since
both parameters are relatively secondary to the core functioning of the
bot (and this is a free time project after all).
Signed-off-by: Luca Bigliardi <shammash@google.com>