Skip to content

Commit

Permalink
Added event logging to Announcer
Browse files Browse the repository at this point in the history
  • Loading branch information
Ellen Fawkes committed Sep 15, 2017
1 parent 007068c commit da9bc3c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions plugins/Announcer/announcer.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ function handleAnnounce(name, _by) {
var channel = bot.channels.find('id', announce.channel);
if (!channel) {
logger.warn("Can't handle announce %s - Unknown channel", name);
PurrplingBot.logEvent(`Announce '${announce.name}' can't be handled! Channel '${name}' is UNKNOWN!'`, "Announce:Handle", "ERROR");
return false;
}
if ((announcerConf.antispam || true) && _by == INTERVAL_TRIGGER && !announce.neverHandled) {
Expand All @@ -90,6 +91,7 @@ function handleAnnounce(name, _by) {
});
if (msgs.length < announcerConf.activityLinesThreshold || 1) {
logger.log("Can't handle announce %s - No activity in #%s", announce.name, channel.name);
PurrplingBot.logEvent(`Announce '${announce.name}' not handled - Channel ${channel.name} is inactive! Adding to queue.`, "Announce:ChannelInactive");
repeater.addToQueue(announce);
return false;
}
Expand All @@ -98,6 +100,7 @@ function handleAnnounce(name, _by) {
announce.lastHandle = new Date();
channel.send(announce.message)
.then(logger.info(`Handled announce: ${announce.name} by: ${_by}`));
PurrplingBot.logEvent(`Announce '${announce.name}' handled! Channel: ${channel.name}`, "Announce:Handle");
return true;
}

Expand Down

0 comments on commit da9bc3c

Please sign in to comment.