From b94bc040e22560259f7f7ac0dd7a044edf4f6aa5 Mon Sep 17 00:00:00 2001 From: Janik Kleinhoff Date: Sun, 14 Feb 2016 01:26:49 +0000 Subject: ;suppress: don't touch the monitor flag --- lib/ASM/Util.pm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'lib/ASM/Util.pm') diff --git a/lib/ASM/Util.pm b/lib/ASM/Util.pm index e6519de..6372037 100644 --- a/lib/ASM/Util.pm +++ b/lib/ASM/Util.pm @@ -117,6 +117,20 @@ sub speak return 1; } +sub isSuppressed { + my ($module, $chan) = @_; + + # While we set a timer to remove the suppression, this check allows it to Just Work(tm) even across bot restarts. + my $expiration = $::channels->{channel}{lc $chan}{suppress} // 0; + return (($expiration > time) ? $expiration : undef); +} + +sub mayAlert { + my ($module, $chan) = @_; + + return !( ($::channels->{channel}{lc $chan}{monitor} // 'yes') eq 'no' || $module->isSuppressed($chan) ); +} + #this item is a stub, dur sub hostip { return gethostbyname($_[0]); -- cgit v1.2.3