diff --git a/lib/BotLib.pm b/lib/BotLib.pm index fc3f35b..ab705bf 100644 --- a/lib/BotLib.pm +++ b/lib/BotLib.pm @@ -102,6 +102,12 @@ sub Command { } elsif (length ($text) >= 2 && (substr ($text, 1, 2) eq 'w ' || substr ($text, 1, 2) eq 'п ')) { my $city = substr $text, 3; $reply = Weather $city; + } elsif (substr ($text, 1, 7) eq 'погода ') { + my $city = substr $text, 7; + $reply = Weather $city; + } elsif ((substr ($text, 1, 8) eq 'погодка ') || (substr ($text, 1, 8) eq 'погадка ') || (substr ($text, 1, 8) eq 'weather ')){ + my $city = substr $text, 8; + $reply = Weather $city; } elsif (substr ($text, 1) eq 'buni') { $msg->typing (); $reply = Buni (); @@ -178,11 +184,11 @@ sub Command { $msg->replyMd ($reply); return; } elsif ( - substr ($text, 1) eq 'tits' || - substr ($text, 1) eq 'boobs' || + substr ($text, 1) eq 'tits' || + substr ($text, 1) eq 'boobs' || substr ($text, 1) eq 'tities' || - substr ($text, 1) eq 'boobies' || - substr ($text, 1) eq 'сиси' || + substr ($text, 1) eq 'boobies' || + substr ($text, 1) eq 'сиси' || substr ($text, 1) eq 'сисечки' ) { if (PluginEnabled $chatid, 'oboobs') { @@ -195,8 +201,8 @@ sub Command { return; } elsif ( substr ($text, 1) eq 'butt' || - substr ($text, 1) eq 'booty' || - substr ($text, 1) eq 'ass' || + substr ($text, 1) eq 'booty' || + substr ($text, 1) eq 'ass' || substr ($text, 1) eq 'попа' || substr ($text, 1) eq 'попка' ) { @@ -271,6 +277,10 @@ ${csign}roll | ${csign}dice | ${csign}кости - бросить кост ${csign}snail | ${csign}улитка - улитка ${csign}ver | ${csign}version | ${csign}версия - что-то про версию ПО ${csign}w город | ${csign}п город - погода в указанном городе +${csign}weather город - погода в указанном городе +${csign}погода город - погода в указанном городе +${csign}погодка город - погода в указанном городе +${csign}погадка город - погода в указанном городе ${csign}xkcd - рандомный стрип с сайта xkcd.ru ${csign}karma фраза | ${csign}карма фраза - посмотреть карму фразы фраза-- | фраза++ - убавить или добавить карму фразе diff --git a/lib/BotLib/Admin.pm b/lib/BotLib/Admin.pm index c5ecf5b..672f4d6 100644 --- a/lib/BotLib/Admin.pm +++ b/lib/BotLib/Admin.pm @@ -206,6 +206,11 @@ sub PluginEnabled (@) { my $chatid = shift; my $plugin = shift; + # seems that we have point to return always true if chat is private + if ($chatid > 0) { + return 1; + } + my $cache = CHI->new ( driver => 'BerkeleyDB', root_dir => $cachedir, diff --git a/lib/Teapot/Bot/Brain.pm b/lib/Teapot/Bot/Brain.pm index bfb0feb..717b5ee 100644 --- a/lib/Teapot/Bot/Brain.pm +++ b/lib/Teapot/Bot/Brain.pm @@ -458,6 +458,9 @@ sub sendChatAction { elsif ($args->{action} eq 'upload_video_note') { $send_args->{action} = 'upload_video_note'; } + elsif ($args->{action} eq 'choose_sticker') { + $send_args->{action} = 'choose_sticker'; + } else { $send_args->{action} = 'typing'; } diff --git a/lib/Teapot/Bot/Object/Chat.pm b/lib/Teapot/Bot/Object/Chat.pm index d312f36..c63ad77 100644 --- a/lib/Teapot/Bot/Object/Chat.pm +++ b/lib/Teapot/Bot/Object/Chat.pm @@ -17,6 +17,9 @@ has 'first_name'; # Optional. has 'last_name'; # Optional. has 'photo'; # Teapot::Bot::Object::ChatPhoto. Optional. Returned only in getChat. has 'bio'; # Optional. Bio of the other party in a private chat. Returned only in getChat. +has 'has_private_forwards'; # Optional. True, if privacy settings of the other party in the private chat allows to + # use tg://user?id= links only in chats with the user. + # Returned only in getChat. has 'description'; # Optional. Returned only in getChat. has 'invite_link'; # Optional. Returned only in getChat. has 'pinned_message'; # Teapot::Bot::Object::Message @@ -25,6 +28,8 @@ has 'permissions'; # Teapot::Bot::Object::ChatPermissions. Optional has 'slow_mode_delay'; # Optional. Returned only in getChat. has 'message_auto_delete_time'; # Optional. The time after which all messages sent to the chat will be automatically # deleted; in seconds. Returned only in getChat. +has 'has_protected_content'; # Optional. True, if messages from the chat can't be forwarded to other chats. + # Returned only in getChat. has 'sticker_set_name'; # Optional. Returned only in getChat. has 'can_set_sticker_set'; # Optional. Returned only in getChat. has 'linked_chat_id'; # Optional. greater than 32 bits, smaller than 52 bits @@ -32,8 +37,9 @@ has 'location'; # Optional. Returned only in getChat. sub fields { return { - 'scalar' => [qw/id type title username first_name last_name bio description - invite_link slow_mode_delay message_auto_delete_time + 'scalar' => [qw/id type title username first_name last_name bio + has_private_forwards description invite_link slow_mode_delay + message_auto_delete_time has_protected_content sticker_set_name can_set_sticker_set linked_chat_id/], 'Teapot::Bot::Object::ChatPhoto' => [qw/photo/], 'Teapot::Bot::Object::Message' => [qw/pinned_message/], diff --git a/lib/Teapot/Bot/Object/ChatInviteLink.pm b/lib/Teapot/Bot/Object/ChatInviteLink.pm index a7842bb..7618e96 100644 --- a/lib/Teapot/Bot/Object/ChatInviteLink.pm +++ b/lib/Teapot/Bot/Object/ChatInviteLink.pm @@ -8,15 +8,19 @@ $Teapot::Bot::Object::ChatInviteLink::VERSION = '0.022'; has 'invite_link'; has 'creator'; +has 'creates_join_request'; has 'is_primary'; has 'is_revoked'; +has 'name'; has 'expire_date'; # Optional. Point in time (Unix timestamp) when the link will expire or has been expired has 'member_limit'; # Optional. Maximum number of users that can be members of the chat simultaneously after joining # the chat via this invite link; 1-99999 +has 'pending_join_request_count'; sub fields { return { - 'scalar' => [qw/invite_link is_primary is_revoked expire_date expire_date member_limit/], + 'scalar' => [qw/invite_link creates_join_request is_primary is_revoked name expire_date + member_limit pending_join_request_count/], 'Teapot::Bot::Object::User' => [qw/creator/], }; } diff --git a/lib/Teapot/Bot/Object/Message.pm b/lib/Teapot/Bot/Object/Message.pm index 6861c86..b5bf6ae 100644 --- a/lib/Teapot/Bot/Object/Message.pm +++ b/lib/Teapot/Bot/Object/Message.pm @@ -52,9 +52,11 @@ has 'forward_from_message_id'; has 'forward_signature'; has 'forward_sender_name'; has 'forward_date'; +has 'is_automatic_forward'; has 'reply_to_message'; # Message has 'via_bot'; # User has 'edit_date'; +has 'has_protected_content'; has 'media_group_id'; has 'author_signature'; has 'text'; @@ -102,8 +104,8 @@ sub fields { return { 'scalar' => [qw/message_id date forward_from_message_id forward_signature forward_sender_name - forward_date edit_date media_group_id - author_signature text caption + forward_date is_automatic_forward edit_date has_protected_content + media_group_id author_signature text caption new_chat_title delete_chat_photo group_chat_created supergroup_chat_created channel_chat_created migrate_to_chat_id diff --git a/lib/TelegramBot.pm b/lib/TelegramBot.pm index d6d0c37..01af484 100644 --- a/lib/TelegramBot.pm +++ b/lib/TelegramBot.pm @@ -201,20 +201,32 @@ sub __on_msg { } if ($just_message_in_chat) { - my $str = $hailo->{$msg->chat->id}->learn_reply ($text); + if ($text =~ /^кто +все +эти +люди *\?$/i) { + $reply = 'Какие люди? Мы здесь вдвоём, только ты и я.'; + } elsif ($text =~ /покажи +(сиськи|сиси|титьки) *$/i) { + $reply = Oboobs (); + } elsif ($text =~ /show +(titts|tities|boobs) *$/i) { + $reply = Oboobs (); + } elsif ($text =~ /покажи +(попку|попу) *$/i) { + $reply = Obutts (); + } elsif ($text =~ /show +(ass|butt|butty) *$/i) { + $reply = Obutts (); + } else { + my $str = $hailo->{$msg->chat->id}->learn_reply ($text); - if (defined ($str) && $str ne '') { - $reply = $str; - $phrase = trim $text; + if (defined ($str) && $str ne '') { + $reply = $str; + $phrase = trim $text; - while ($phrase =~ /[\.|\,|\?|\!]$/) { - chop $phrase; - } + while ($phrase =~ /[\.|\,|\?|\!]$/) { + chop $phrase; + } - $phrase = lc $phrase; + $phrase = lc $phrase; - if (fmatch (lc ($reply), $phrase)) { - $reply = RandomCommonPhrase (); + if (fmatch (lc ($reply), $phrase)) { + $reply = RandomCommonPhrase (); + } } } }