1

Телеграмбот теперь реагирует на своё имя в любом регистре

This commit is contained in:
eleksir
2020-01-15 21:37:18 +03:00
parent 457d289f1c
commit 1385a107bf

View File

@@ -53,13 +53,13 @@ sub __on_msg {
} }
# phrase directed to bot # phrase directed to bot
if (($text =~ /^${qname}[\,|\:]? (.+)/) or ($text =~ /^${qtname}[\,|\:]? (.+)/)){ if ((lc($text) =~ /^${qname}[\,|\:]? (.+)/) or (lc($text) =~ /^${qtname}[\,|\:]? (.+)/)){
$reply = $hailo->learn_reply(decode('utf-8', $1)); $reply = $hailo->learn_reply(decode('utf-8', $1));
# bot mention by name # bot mention by name
} elsif (($text =~ /.+ ${qname}[\,|\!|\?|\.| ]/) or ($text =~ / $qname$/)) { } elsif ((lc($text) =~ /.+ ${qname}[\,|\!|\?|\.| ]/) or (lc($text) =~ / $qname$/)) {
$reply = $hailo->reply(decode('utf-8', $text)); $reply = $hailo->reply(decode('utf-8', $text));
# bot mention by teleram name # bot mention by teleram name
} elsif (($text =~ /.+ ${qtname}[\,|\!|\?|\.| ]/) or ($text =~ / $qtname$/)) { } elsif ((lc($text) =~ /.+ ${qtname}[\,|\!|\?|\.| ]/) or (lc($text) =~ / $qtname$/)) {
$reply = $hailo->reply(decode('utf-8', $text)); $reply = $hailo->reply(decode('utf-8', $text));
# just message in chat # just message in chat
} else { } else {