summaryrefslogtreecommitdiffstats
path: root/lib/ASM/Util.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ASM/Util.pm')
-rw-r--r--lib/ASM/Util.pm14
1 files changed, 14 insertions, 0 deletions
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]);