From 31e077c219f01601f02be9c1879579ae2d93a58b Mon Sep 17 00:00:00 2001 From: eleksir Date: Sat, 25 Dec 2021 14:27:30 +0300 Subject: [PATCH] Add easter egg phrases in private and group conversations, fix previous addition of private phrases a bit --- lib/TelegramBot.pm | 39 +++++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/lib/TelegramBot.pm b/lib/TelegramBot.pm index 0eac493..d2247c2 100644 --- a/lib/TelegramBot.pm +++ b/lib/TelegramBot.pm @@ -21,6 +21,7 @@ use BotLib::Admin qw (FortuneToggleList); use BotLib qw (RandomCommonPhrase Command Highlight BotSleep IsCensored); use BotLib::Conf qw (LoadConf); use BotLib::Fortune qw (Fortune); +use BotLib::Image qw (Oboobs Obutts); use BotLib::Karma qw (KarmaSet); use BotLib::Util qw (trim fmatch); use RedisLib qw (redis_parse_message); @@ -200,16 +201,22 @@ sub __on_msg { } else { $just_message_in_chat = 1; } + } else { + $just_message_in_chat = 1; } if ($just_message_in_chat) { - if ($text =~ /^кто +все +эти +люди *\?$/i) { - $reply = 'Какие люди? Мы здесь вдвоём, только ты и я.'; - } elsif ($text =~ /покажи +(сиськи|сиси|титьки) *$/i) { + if ($text =~ /^ *кто +все +эти +люди *\?$/ui) { + $reply = 'Какие "люди"? Мы здесь вдвоём, только ты и я.'; + } elsif ($text =~ /^ *кто +я *\?$/ui) { + $reply = 'Где?'; + } elsif ($text =~ /^ *кто +(здесь|тут) *\?$/ui) { + $reply = 'Ты да я, да мы с тобой.'; + } elsif ($text =~ /покажи +(сиськи|сиси|титьки) *$/ui) { $reply = Oboobs (); } elsif ($text =~ /show +(titts|tities|boobs) *$/i) { $reply = Oboobs (); - } elsif ($text =~ /покажи +(попку|попу) *$/i) { + } elsif ($text =~ /покажи +(попку|попу) *$/ui) { $reply = Obutts (); } elsif ($text =~ /show +(ass|butt|butty) *$/i) { $reply = Obutts (); @@ -300,8 +307,12 @@ sub __on_msg { if ((lc ($text) =~ /^${qname}[\,|\:]? (.+)/) or (lc ($text) =~ /^${qtname}[\,|\:]? (.+)/)){ $phrase = $1; - if ($phrase =~ /^кто +все +эти +люди *\?$/i) { + if ($phrase =~ /^ *кто +все +эти +люди *\?$/ui) { $reply = 'Кто здесь?'; + } elsif ($phrase =~ /^ *кто +я *?$/ui){ + $reply = 'Где?'; + } elsif ($phrase =~ /^ *кто +(здесь|тут) *\?$/ui) { + $reply = 'Здесь все: Никита, Стас, Гена, Турбо и Дюша Метёлкин.'; } else { $reply = $hailo->{$msg->chat->id}->learn_reply ($phrase); } @@ -309,8 +320,12 @@ sub __on_msg { } elsif ((lc ($text) =~ /.+ ${qname}[\,|\!|\?|\.| ]/) or (lc ($text) =~ / $qname$/)) { $phrase = $text; - if ($phrase =~ /^кто +все +эти +люди *\?$/i) { + if ($phrase =~ /^ *кто +все +эти +люди *\?$/ui) { $reply = 'Кто здесь?'; + } elsif ($phrase =~ /^ *кто +я *?$/ui){ + $reply = 'Где?'; + } elsif ($phrase =~ /^ *кто +(здесь|тут) *\?$/ui) { + $reply = 'Здесь все: Никита, Стас, Гена, Турбо и Дюша Метёлкин.'; } else { $reply = $hailo->{$msg->chat->id}->learn_reply ($phrase); } @@ -318,8 +333,12 @@ sub __on_msg { } elsif ((lc ($text) =~ /.+ ${qtname}[\,|\!|\?|\.| ]/) or (lc ($text) =~ / $qtname$/)) { $phrase = $text; - if ($phrase =~ /^кто +все +эти +люди *\?$/i) { + if ($phrase =~ /^ *кто +все +эти +люди *\?$/ui) { $reply = 'Кто здесь?'; + } elsif ($phrase =~ /^ *кто +я *?$/ui){ + $reply = 'Где?'; + } elsif ($phrase =~ /^ *кто +(здесь|тут) *\?$/ui) { + $reply = 'Здесь все: Никита, Стас, Гена, Турбо и Дюша Метёлкин.'; } else { $reply = $hailo->{$msg->chat->id}->learn_reply ($phrase); } @@ -335,8 +354,12 @@ sub __on_msg { } # just message in chat } else { - if ($text =~ /^кто +все +эти +люди *\?$/i) { + if ($text =~ /^ *кто +все +эти +люди *\?$/ui) { $reply = 'Кто здесь?'; + } elsif ($phrase =~ /^ *кто +я *?$/ui){ + $reply = 'Где?'; + } elsif ($phrase =~ /^ *кто +(здесь|тут) *\?$/ui) { + $reply = 'Здесь все: Никита, Стас, Гена, Турбо и Дюша Метёлкин.'; } else { $hailo->{$msg->chat->id}->learn ($text); }