From 9fc11c7cf49f007edf47e6e3413444dff853b067 Mon Sep 17 00:00:00 2001 From: eleksir Date: Tue, 23 Feb 2021 19:00:00 +0300 Subject: [PATCH] Admin censor: voice messages are special --- lib/botlib.pm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/botlib.pm b/lib/botlib.pm index 2d7799a..483f2ba 100644 --- a/lib/botlib.pm +++ b/lib/botlib.pm @@ -263,8 +263,15 @@ sub isCensored { my $forbidden = getForbiddenTypes ($msg->chat->id); + # voice messages are special + if (defined ($msg->voice) && defined ($msg->voice->duration) && ($msg->voice->duration > 0)) { + if ($forbidden->{'voice'}) { + return 1; + } + } + foreach (keys %{$forbidden}) { - if ($forbidden->{$_} && $msg->can ($_) && (defined $msg->{$_})) { + if ($forbidden->{$_} && (defined $msg->{$_})) { return 1; } }