Implemented !хелп, !хэлп, answer 'кто все эти люди?' question, hide notext log message to debug lever
This commit is contained in:
@@ -184,6 +184,8 @@ sub Command {
|
||||
sleep (irand (2) + 1);
|
||||
$msg->replyMd ($reply);
|
||||
return;
|
||||
} elsif (substr ($text, 1) eq 'хэлп') {
|
||||
$reply = 'HALP!!!11';
|
||||
} elsif (substr ($text, 1) eq 'help' || substr ($text, 1) eq 'помощь') {
|
||||
$reply = << "MYHELP";
|
||||
```
|
||||
|
||||
@@ -227,7 +227,7 @@ sub __on_msg {
|
||||
|
||||
# detect and log messages without text, noop here
|
||||
unless (defined $msg->text) {
|
||||
carp sprintf ('[INFO] No text in message from %s', $vis_a_vi);
|
||||
carp sprintf ('[DEBUG] No text in message from %s', $vis_a_vi) if $c->{debug};
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -275,15 +275,30 @@ sub __on_msg {
|
||||
# phrase directed to bot
|
||||
if ((lc ($text) =~ /^${qname}[\,|\:]? (.+)/) or (lc ($text) =~ /^${qtname}[\,|\:]? (.+)/)){
|
||||
$phrase = $1;
|
||||
|
||||
if ($text =~ /^кто +все +эти +люди\?$/i) {
|
||||
$reply = 'Кто здесь?';
|
||||
} else {
|
||||
$reply = $hailo->{$msg->chat->id}->learn_reply ($phrase);
|
||||
}
|
||||
# bot mention by name
|
||||
} elsif ((lc ($text) =~ /.+ ${qname}[\,|\!|\?|\.| ]/) or (lc ($text) =~ / $qname$/)) {
|
||||
$phrase = $text;
|
||||
$reply = $hailo->{$msg->chat->id}->reply($phrase);
|
||||
|
||||
if ($text =~ /^кто +все +эти +люди\?$/i) {
|
||||
$reply = 'Кто здесь?';
|
||||
} else {
|
||||
$reply = $hailo->{$msg->chat->id}->learn_reply ($phrase);
|
||||
}
|
||||
# bot mention by telegram name
|
||||
} elsif ((lc ($text) =~ /.+ ${qtname}[\,|\!|\?|\.| ]/) or (lc ($text) =~ / $qtname$/)) {
|
||||
$phrase = $text;
|
||||
$reply = $hailo->{$msg->chat->id}->reply ($phrase);
|
||||
|
||||
if ($text =~ /^кто +все +эти +люди\?$/i) {
|
||||
$reply = 'Кто здесь?';
|
||||
} else {
|
||||
$reply = $hailo->{$msg->chat->id}->learn_reply ($phrase);
|
||||
}
|
||||
# karma adjustment
|
||||
} elsif (substr ($text, -2) eq '++' || substr ($text, -2) eq '--') {
|
||||
my @arr = split /\n/, $text;
|
||||
@@ -295,10 +310,14 @@ sub __on_msg {
|
||||
$hailo->{$msg->chat->id}->learn ($text);
|
||||
}
|
||||
# just message in chat
|
||||
} else {
|
||||
if ($text =~ /^кто +все +эти +люди\?$/i) {
|
||||
$reply = 'Кто здесь?';
|
||||
} else {
|
||||
$hailo->{$msg->chat->id}->learn ($text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (defined ($reply) && $reply ne '') {
|
||||
# work a bit more on input phrase
|
||||
|
||||
Reference in New Issue
Block a user