Move IsCensored to Admin.pm

This commit is contained in:
eleksir
2022-12-12 17:26:50 +03:00
parent d43cb5995b
commit b84f8bb245
3 changed files with 27 additions and 25 deletions

View File

@@ -15,7 +15,7 @@ use URI::URL qw (url);
use version; our $VERSION = qw (1.0);
use Exporter qw (import);
our @EXPORT_OK = qw (trim urlencode fmatch utf2b64 utf2sha1 BotSleep Highlight IsCensored RandomCommonPhrase);
our @EXPORT_OK = qw (trim urlencode fmatch utf2b64 utf2sha1 BotSleep Highlight RandomCommonPhrase);
sub trim {
my $str = shift;
@@ -124,27 +124,6 @@ sub Highlight {
return ($userid, $username, $fullname, $highlight, $visavi);
}
sub IsCensored {
my $msg = shift;
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->{$_} && (defined $msg->{$_})) {
return 1;
}
}
return 0;
}
sub RandomCommonPhrase {
my @myphrase = (
'Так, блядь...',