Add support for Bot API 6.3
This commit is contained in:
@@ -28,6 +28,7 @@ my $c = LoadConf ();
|
||||
my $csign = $c->{telegrambot}->{csign};
|
||||
|
||||
my $redismsg->{from} = 'telegram';
|
||||
$redismsg->{threadid} = '';
|
||||
$redismsg->{plugin} = 'telegram';
|
||||
$redismsg->{misc}->{answer} = 1;
|
||||
$redismsg->{misc}->{csign} = "$c->{telegrambot}->{csign}";
|
||||
@@ -130,6 +131,15 @@ sub Command {
|
||||
}
|
||||
}
|
||||
|
||||
# Если тип группы supergroup, в ней могут быть треды, попробуем найти message_thread_id, если таковой есть
|
||||
if ($msg->chat->type eq 'supergroup') {
|
||||
if ($msg->can ('is_topic_message') && $msg->is_topic_message) {
|
||||
if ($msg->can ('message_thread_id') && $msg->message_thread_id ne '') {
|
||||
$rmsg->{threadid} = "$msg->message_thread_id";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Если соединения с редиской нету, ждём, пока оно появится. Своего рода костыль на всякий случай.
|
||||
{
|
||||
do {
|
||||
|
||||
@@ -51,6 +51,9 @@ sub redis_parse_message {
|
||||
}
|
||||
|
||||
$message->{text} = "$m->{message}";
|
||||
if (defined ($m->{threadid}) && $m->{threadid} ne '') {
|
||||
$message->{message_thread_id} = 0 + $m->{threadid};
|
||||
}
|
||||
|
||||
my $can_talk = Teapot::Bot::Object::ChatPermissions->canTalk ($main::TGM, 0 + $m->{chatid});
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ use Teapot::Bot::Object::Chat ();
|
||||
use Teapot::Bot::Object::ChatMember ();
|
||||
use Teapot::Bot::Object::ChatInviteLink ();
|
||||
|
||||
$Teapot::Bot::Brain::VERSION = '0.023';
|
||||
$Teapot::Bot::Brain::VERSION = '0.024';
|
||||
|
||||
# base class for building telegram robots with Mojolicious
|
||||
has longpoll_time => 60;
|
||||
@@ -298,6 +298,10 @@ sub sendMessage {
|
||||
|
||||
$send_args->{chat_id} = $args->{chat_id};
|
||||
|
||||
if (defined $args->{message_thread_id}) {
|
||||
$send_args->{message_thread_id} = $args->{message_thread_id};
|
||||
}
|
||||
|
||||
unless ($args->{text}) {
|
||||
cluck 'No text supplied in sendMessage()';
|
||||
return {'error' => 1};
|
||||
@@ -351,6 +355,10 @@ sub forwardMessage {
|
||||
|
||||
$send_args->{chat_id} = $args->{chat_id};
|
||||
|
||||
if (defined $args->{message_thread_id}) {
|
||||
$send_args->{message_thread_id} = $args->{message_thread_id};
|
||||
}
|
||||
|
||||
unless ($args->{from_chat_id}) {
|
||||
cluck 'No from_chat_id supplied in forwardMessage()';
|
||||
return {'error' => 1};
|
||||
@@ -419,6 +427,10 @@ sub sendPhoto {
|
||||
my $args = shift || {};
|
||||
my $send_args = {};
|
||||
|
||||
if (defined $args->{message_thread_id}) {
|
||||
$send_args->{message_thread_id} = $args->{message_thread_id};
|
||||
}
|
||||
|
||||
unless ($args->{chat_id}) {
|
||||
cluck 'No chat_id supplied to sendPhoto()';
|
||||
return {'error' => 1};
|
||||
@@ -755,7 +767,7 @@ Teapot::Bot::Brain - A base class to make your very own Telegram bot
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.023
|
||||
version 0.024
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ use utf8;
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
use Teapot::Bot::Object::PhotoSize ();
|
||||
|
||||
$Teapot::Bot::Object::Animation::VERSION = '0.023';
|
||||
$Teapot::Bot::Object::Animation::VERSION = '0.024';
|
||||
|
||||
has 'file_id';
|
||||
has 'file_unique_id';
|
||||
@@ -43,7 +43,7 @@ Teapot::Bot::Object::Animation - The base class for Telegram message 'Animation'
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.023
|
||||
version 0.024
|
||||
|
||||
=head1 DESCRIPTION
|
||||
The base class for Telegram message 'Animation' type.
|
||||
|
||||
@@ -8,7 +8,7 @@ use utf8;
|
||||
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
|
||||
$Teapot::Bot::Object::Audio::VERSION = '0.023';
|
||||
$Teapot::Bot::Object::Audio::VERSION = '0.024';
|
||||
|
||||
has 'file_id';
|
||||
has 'file_unique_id';
|
||||
@@ -41,7 +41,7 @@ Teapot::Bot::Object::Audio - The base class for Telegram 'Audio' type objects
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.023
|
||||
version 0.024
|
||||
|
||||
=head1 DESCRIPTION
|
||||
The base class for Telegram 'Audio' type objects.
|
||||
|
||||
@@ -13,7 +13,7 @@ use List::Util qw/any/;
|
||||
|
||||
use Mojo::Base -base;
|
||||
|
||||
$Teapot::Bot::Object::Base::VERSION = '0.023';
|
||||
$Teapot::Bot::Object::Base::VERSION = '0.024';
|
||||
|
||||
has '_brain'; # a reference to our brain
|
||||
|
||||
@@ -187,7 +187,7 @@ Teapot::Bot::Object::Base - The base class for all Telegram::Bot::Object objects
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.023
|
||||
version 0.024
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ use 5.018; ## no critic (ProhibitImplicitImport)
|
||||
use utf8;
|
||||
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
$Teapot::Bot::Object::CallbackGame::VERSION = '0.023';
|
||||
$Teapot::Bot::Object::CallbackGame::VERSION = '0.024';
|
||||
|
||||
# https://core.telegram.org/bots/api#callbackgame
|
||||
# "A placeholder, currently holds no information. Use BotFather to set up your game"
|
||||
@@ -30,7 +30,7 @@ Teapot::Bot::Object::CallbackGame - The base class for Telegram message 'Callbac
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.023
|
||||
version 0.024
|
||||
|
||||
=head1 DESCRIPTION
|
||||
The base class for Telegram message 'CallbackGame' type.
|
||||
|
||||
@@ -12,7 +12,7 @@ use Teapot::Bot::Object::Message ();
|
||||
use Teapot::Bot::Object::ChatPermissions ();
|
||||
use Teapot::Bot::Object::ChatLocation ();
|
||||
|
||||
$Teapot::Bot::Object::Chat::VERSION = '0.023';
|
||||
$Teapot::Bot::Object::Chat::VERSION = '0.024';
|
||||
|
||||
has 'id';
|
||||
has 'type';
|
||||
@@ -20,7 +20,12 @@ has 'title'; # Optional.
|
||||
has 'username'; # Optional.
|
||||
has 'first_name'; # Optional.
|
||||
has 'last_name'; # Optional.
|
||||
has 'is_forum'; # Optional. True, if the supergroup chat is a forum (has topics enabled)
|
||||
has 'photo'; # Teapot::Bot::Object::ChatPhoto. Optional. Returned only in getChat.
|
||||
has 'active_usernames'; # Optional. If non-empty, the list of all active chat usernames; for private chats,
|
||||
# supergroups and channels. Returned only in getChat.
|
||||
has 'emoji_status_custom_emoji_id'; # Optional. Custom emoji identifier of emoji status of the other party in a private
|
||||
# chat. 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=<user_id> links only in chats with the user.
|
||||
@@ -42,7 +47,8 @@ has 'location'; # Optional. Returned only in getChat.
|
||||
|
||||
sub fields {
|
||||
return {
|
||||
'scalar' => [qw/id type title username first_name last_name bio
|
||||
'scalar' => [qw/id type title username first_name last_name is_forum
|
||||
emoji_status_custom_emoji_id 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/],
|
||||
@@ -53,6 +59,9 @@ sub fields {
|
||||
};
|
||||
}
|
||||
|
||||
sub arrays {
|
||||
return qw/active_usernames/;
|
||||
}
|
||||
|
||||
sub is_user {
|
||||
return shift->id > 0;
|
||||
@@ -77,7 +86,7 @@ Teapot::Bot::Object::Chat - The base class for Telegram 'Chat' type objects
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.023
|
||||
version 0.024
|
||||
|
||||
=head1 DESCRIPTION
|
||||
The base class for Telegram 'Chat' type objects.
|
||||
|
||||
@@ -9,7 +9,7 @@ use utf8;
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
use Teapot::Bot::Object::User ();
|
||||
|
||||
$Teapot::Bot::Object::ChatInviteLink::VERSION = '0.023';
|
||||
$Teapot::Bot::Object::ChatInviteLink::VERSION = '0.024';
|
||||
|
||||
has 'invite_link';
|
||||
has 'creator';
|
||||
@@ -44,7 +44,7 @@ Teapot::Bot::Object::ChatInviteLink - The base class for Telegram message 'ChatI
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.023
|
||||
version 0.024
|
||||
|
||||
=head1 DESCRIPTION
|
||||
The base class for Telegram message 'ChatInviteLink' type.
|
||||
|
||||
@@ -8,7 +8,7 @@ use utf8;
|
||||
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
|
||||
$Teapot::Bot::Object::ChatLocation::VERSION = '0.023';
|
||||
$Teapot::Bot::Object::ChatLocation::VERSION = '0.024';
|
||||
|
||||
has 'location';
|
||||
has 'address';
|
||||
@@ -34,7 +34,7 @@ Teapot::Bot::Object::ChatLocation - The base class for Telegram message 'ChatLoc
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.023
|
||||
version 0.024
|
||||
|
||||
=head1 DESCRIPTION
|
||||
The base class for Telegram message 'ChatLocation' type.
|
||||
|
||||
@@ -12,7 +12,7 @@ use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
use Teapot::Bot::Object::User ();
|
||||
|
||||
|
||||
$Teapot::Bot::Object::ChatMember::VERSION = '0.023';
|
||||
$Teapot::Bot::Object::ChatMember::VERSION = '0.024';
|
||||
|
||||
# ChatMemberOwner
|
||||
has 'user';
|
||||
@@ -39,7 +39,8 @@ has 'can_promote_members'; # optional. Administrators only.
|
||||
has 'can_change_info'; # optional. Administrators and restricted only.
|
||||
has 'can_invite_users'; # optional. Administrators and restricted only.
|
||||
has 'can_pin_messages'; # optional. Administrators and restricted only.
|
||||
|
||||
has 'can_manage_topics'; # Optional. True, if the user is allowed to create, rename, close, and reopen forum
|
||||
# topics; supergroups only
|
||||
# ChatMemberMember
|
||||
# has 'status';
|
||||
# has 'user';
|
||||
@@ -57,6 +58,7 @@ has 'can_send_polls'; # optional. Restricted only.
|
||||
has 'can_send_other_messages'; # optional. Restricted only.
|
||||
has 'can_add_web_page_previews'; # optional. Restricted only.
|
||||
has 'until_date'; # optional. Restricted and kicked only.
|
||||
# has 'can_manage_topics';
|
||||
|
||||
# ChatMemberLeft
|
||||
# has 'status';
|
||||
@@ -73,7 +75,7 @@ sub fields {
|
||||
can_edit_messages can_delete_messages can_manage_voice_chats can_restrict_members
|
||||
can_promote_members can_change_info can_invite_users can_pin_messages is_member
|
||||
can_send_messages can_send_media_messages can_send_polls can_send_other_messages
|
||||
can_add_web_page_previews until_date/],
|
||||
can_add_web_page_previews until_date can_manage_topics/],
|
||||
'Teapot::Bot::Object::User' => [qw/user/],
|
||||
};
|
||||
}
|
||||
@@ -145,7 +147,7 @@ Teapot::Bot::Object::ChatMember - The base class for Telegram 'ChatMember' type
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.023
|
||||
version 0.024
|
||||
|
||||
=head1 DESCRIPTION
|
||||
The base class for Telegram 'ChatMember' type objects.
|
||||
|
||||
@@ -13,7 +13,7 @@ use Teapot::Bot::Object::ChatMember ();
|
||||
use Teapot::Bot::Object::ChatInviteLink ();
|
||||
use Teapot::Bot::Object::Voice ();
|
||||
|
||||
$Teapot::Bot::Object::ChatMemberUpdated::VERSION = '0.023';
|
||||
$Teapot::Bot::Object::ChatMemberUpdated::VERSION = '0.024';
|
||||
|
||||
has 'chat';
|
||||
has 'from';
|
||||
@@ -50,7 +50,7 @@ Teapot::Bot::Object::ChatMemberUpdated - The base class for Telegram 'ChatMember
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.023
|
||||
version 0.024
|
||||
|
||||
=head1 DESCRIPTION
|
||||
The base class for Telegram 'ChatMemberUpdated' type objects.
|
||||
|
||||
@@ -10,7 +10,7 @@ use Carp qw(carp);
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
use Teapot::Bot::Brain ();
|
||||
|
||||
$Teapot::Bot::Object::ChatPermissions::VERSION = '0.023';
|
||||
$Teapot::Bot::Object::ChatPermissions::VERSION = '0.024';
|
||||
|
||||
# all fields are optional
|
||||
# N.B. Some of the fields "overlaps" other, so in order to guess valid set of permissions you should check all of them
|
||||
@@ -26,12 +26,14 @@ has 'can_change_info'; # True, if the user is allowed to change the ch
|
||||
# Ignored in public supergroups
|
||||
has 'can_invite_users'; # True, if the user is allowed to invite new users to the chat
|
||||
has 'can_pin_messages'; # True, if the user is allowed to pin messages. Ignored in public supergroups
|
||||
has 'can_manage_topics'; # Optional. True, if the user is allowed to create forum topics. If omitted defaults to
|
||||
# the value of can_pin_messages
|
||||
|
||||
sub fields {
|
||||
return {
|
||||
'scalar' => [qw/can_send_messages can_send_media_messages can_send_polls
|
||||
can_send_other_messages can_add_web_page_previews can_change_info
|
||||
can_invite_users can_pin_messages/],
|
||||
can_invite_users can_pin_messages can_manage_topics/],
|
||||
};
|
||||
}
|
||||
|
||||
@@ -98,7 +100,7 @@ Teapot::Bot::Object::ChatPermissions - The base class for Telegram 'ChatPermissi
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.023
|
||||
version 0.024
|
||||
|
||||
=head1 DESCRIPTION
|
||||
The base class for Telegram 'ChatPermissions' type objects.
|
||||
|
||||
@@ -8,7 +8,7 @@ use utf8;
|
||||
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
|
||||
$Teapot::Bot::Object::ChatPhoto::VERSION = '0.023';
|
||||
$Teapot::Bot::Object::ChatPhoto::VERSION = '0.024';
|
||||
|
||||
has 'small_file_id';
|
||||
has 'small_file_unique_id';
|
||||
@@ -35,7 +35,7 @@ Teapot::Bot::Object::ChatPhoto - The base class for Telegram 'ChatPhoto' type ob
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.023
|
||||
version 0.024
|
||||
|
||||
=head1 DESCRIPTION
|
||||
The base class for Telegram 'ChatPhoto' type objects.
|
||||
|
||||
@@ -8,7 +8,7 @@ use utf8;
|
||||
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
|
||||
$Teapot::Bot::Object::Contact::VERSION = '0.023';
|
||||
$Teapot::Bot::Object::Contact::VERSION = '0.024';
|
||||
|
||||
has 'phone_number';
|
||||
has 'first_name';
|
||||
@@ -36,7 +36,7 @@ Teapot::Bot::Object::Contact - The base class for Telegram 'Contact' objects
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.023
|
||||
version 0.024
|
||||
|
||||
=head1 DESCRIPTION
|
||||
The base class for Telegram 'Contact' objects.
|
||||
|
||||
@@ -8,7 +8,7 @@ use utf8;
|
||||
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
|
||||
$Teapot::Bot::Object::Dice::VERSION = '0.023';
|
||||
$Teapot::Bot::Object::Dice::VERSION = '0.024';
|
||||
|
||||
has 'emoji';
|
||||
has 'value';
|
||||
@@ -31,7 +31,7 @@ Teapot::Bot::Object::Dice - The base class for Telegram message 'Dice' type
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.023
|
||||
version 0.024
|
||||
|
||||
=head1 DESCRIPTION
|
||||
The base class for Telegram message 'Dice' type.
|
||||
|
||||
@@ -9,7 +9,7 @@ use utf8;
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
use Teapot::Bot::Object::PhotoSize ();
|
||||
|
||||
$Teapot::Bot::Object::Document::VERSION = '0.023';
|
||||
$Teapot::Bot::Object::Document::VERSION = '0.024';
|
||||
|
||||
has 'file_id';
|
||||
has 'file_unique_id';
|
||||
@@ -39,7 +39,7 @@ Teapot::Bot::Object::Document - The base class for Telegram 'Document' objects
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.023
|
||||
version 0.024
|
||||
|
||||
=head1 DESCRIPTION
|
||||
The base class for Telegram 'Document' objects.
|
||||
|
||||
@@ -8,7 +8,7 @@ use utf8;
|
||||
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
|
||||
$Teapot::Bot::Object::EncryptedCredentials::VERSION = '0.023';
|
||||
$Teapot::Bot::Object::EncryptedCredentials::VERSION = '0.024';
|
||||
|
||||
has 'data';
|
||||
has 'hash';
|
||||
@@ -32,7 +32,7 @@ Teapot::Bot::Object::EncryptedCredentials - The base class for Telegram 'Encrypt
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.023
|
||||
version 0.024
|
||||
|
||||
=head1 DESCRIPTION
|
||||
The base class for Telegram 'EncryptedCredentials' type objects.
|
||||
|
||||
@@ -8,7 +8,7 @@ use utf8;
|
||||
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
|
||||
$Teapot::Bot::Object::EncryptedPassportElement::VERSION = '0.023';
|
||||
$Teapot::Bot::Object::EncryptedPassportElement::VERSION = '0.024';
|
||||
|
||||
# XXX Implement rest of this
|
||||
# https://core.telegram.org/bots/api#encryptedpassportelement
|
||||
@@ -38,7 +38,7 @@ Teapot::Bot::Object::EncryptedPassportElement - The base class for Telegram 'Enc
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.023
|
||||
version 0.024
|
||||
|
||||
=head1 DESCRIPTION
|
||||
The base class for Telegram 'EncryptedPassportElement' type objects.
|
||||
|
||||
51
lib/Teapot/Bot/Object/ForumTopicClosed.pm
Normal file
51
lib/Teapot/Bot/Object/ForumTopicClosed.pm
Normal file
@@ -0,0 +1,51 @@
|
||||
package Teapot::Bot::Object::ForumTopicClosed;
|
||||
# ABSTRACT: The base class for Telegram message 'ForumTopicClosed' type.
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use 5.018; ## no critic (ProhibitImplicitImport)
|
||||
use utf8;
|
||||
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
|
||||
$Teapot::Bot::Object::ForumTopicClosed::VERSION = '0.024';
|
||||
|
||||
|
||||
sub fields {
|
||||
return { };
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=pod
|
||||
|
||||
=encoding utf8
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Teapot::Bot::Object::ForumTopicClosed - The base class for Telegram message 'ForumTopicClosed' type
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.024
|
||||
|
||||
=head1 DESCRIPTION
|
||||
The base class for Telegram message 'ForumTopicClosed' type.
|
||||
|
||||
See L<https://core.telegram.org/bots/api#forumtopicclosed> for details of the
|
||||
attributes available for C<Teapot::Bot::Object::ForumTopicClosed> objects.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Sergei Fedosov <eleksir@gmail.com>
|
||||
|
||||
=head1 LICENSE AND COPYRIGHT
|
||||
|
||||
This software is copyright (c) 2022 by Sergei Fedosov <eleksir@gmail.com>.
|
||||
|
||||
This is free software; you can redistribute it and/or modify it under
|
||||
the same terms as the Perl 5 programming language system itself.
|
||||
|
||||
=cut
|
||||
54
lib/Teapot/Bot/Object/ForumTopicCreated.pm
Normal file
54
lib/Teapot/Bot/Object/ForumTopicCreated.pm
Normal file
@@ -0,0 +1,54 @@
|
||||
package Teapot::Bot::Object::ForumTopicCreated;
|
||||
# ABSTRACT: The base class for Telegram message 'ForumTopicCreated' type.
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use 5.018; ## no critic (ProhibitImplicitImport)
|
||||
use utf8;
|
||||
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
|
||||
$Teapot::Bot::Object::ForumTopicCreated::VERSION = '0.024';
|
||||
|
||||
has 'name';
|
||||
has 'icon_color';
|
||||
has 'icon_custom_emoji_id';
|
||||
|
||||
sub fields {
|
||||
return { scalar => [qw/name icon_color icon_custom_emoji_id/] };
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=pod
|
||||
|
||||
=encoding utf8
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Teapot::Bot::Object::ForumTopicCreated - The base class for Telegram message 'ForumTopicCreated' type
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.024
|
||||
|
||||
=head1 DESCRIPTION
|
||||
The base class for Telegram message 'ForumTopicCreated' type.
|
||||
|
||||
See L<https://core.telegram.org/bots/api#forumtopiccreated> for details of the
|
||||
attributes available for C<Teapot::Bot::Object::ForumTopicCreated> objects.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Sergei Fedosov <eleksir@gmail.com>
|
||||
|
||||
=head1 LICENSE AND COPYRIGHT
|
||||
|
||||
This software is copyright (c) 2022 by Sergei Fedosov <eleksir@gmail.com>.
|
||||
|
||||
This is free software; you can redistribute it and/or modify it under
|
||||
the same terms as the Perl 5 programming language system itself.
|
||||
|
||||
=cut
|
||||
51
lib/Teapot/Bot/Object/ForumTopicReopened.pm
Normal file
51
lib/Teapot/Bot/Object/ForumTopicReopened.pm
Normal file
@@ -0,0 +1,51 @@
|
||||
package Teapot::Bot::Object::ForumTopicReopened;
|
||||
# ABSTRACT: The base class for Telegram message 'ForumTopicReopened' type.
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use 5.018; ## no critic (ProhibitImplicitImport)
|
||||
use utf8;
|
||||
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
|
||||
$Teapot::Bot::Object::ForumTopicReopened::VERSION = '0.024';
|
||||
|
||||
|
||||
sub fields {
|
||||
return { };
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=pod
|
||||
|
||||
=encoding utf8
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Teapot::Bot::Object::ForumTopicReopened - The base class for Telegram message 'ForumTopicReopened' type
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.024
|
||||
|
||||
=head1 DESCRIPTION
|
||||
The base class for Telegram message 'ForumTopicReopened' type.
|
||||
|
||||
See L<https://core.telegram.org/bots/api#forumtopicreopened> for details of the
|
||||
attributes available for C<Teapot::Bot::Object::ForumTopicReopened> objects.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Sergei Fedosov <eleksir@gmail.com>
|
||||
|
||||
=head1 LICENSE AND COPYRIGHT
|
||||
|
||||
This software is copyright (c) 2022 by Sergei Fedosov <eleksir@gmail.com>.
|
||||
|
||||
This is free software; you can redistribute it and/or modify it under
|
||||
the same terms as the Perl 5 programming language system itself.
|
||||
|
||||
=cut
|
||||
@@ -11,7 +11,7 @@ use Teapot::Bot::Object::PhotoSize ();
|
||||
use Teapot::Bot::Object::Animation ();
|
||||
use Teapot::Bot::Object::MessageEntity ();
|
||||
|
||||
$Teapot::Bot::Object::Game::VERSION = '0.023';
|
||||
$Teapot::Bot::Object::Game::VERSION = '0.024';
|
||||
|
||||
has 'title';
|
||||
has 'description';
|
||||
@@ -45,7 +45,7 @@ Teapot::Bot::Object::Game - The base class for Telegram message 'Game' type
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.023
|
||||
version 0.024
|
||||
|
||||
=head1 DESCRIPTION
|
||||
The base class for Telegram message 'Game' type.
|
||||
|
||||
@@ -10,7 +10,7 @@ use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
use Teapot::Bot::Object::LoginUrl ();
|
||||
use Teapot::Bot::Object::CallbackGame ();
|
||||
|
||||
$Teapot::Bot::Object::InlineKeyboardButton::VERSION = '0.023';
|
||||
$Teapot::Bot::Object::InlineKeyboardButton::VERSION = '0.024';
|
||||
|
||||
has 'text';
|
||||
has 'url';
|
||||
@@ -43,7 +43,7 @@ Teapot::Bot::Object::InlineKeyboardButton - The base class for Telegram 'InlineK
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.023
|
||||
version 0.024
|
||||
|
||||
=head1 DESCRIPTION
|
||||
The base class for Telegram 'InlineKeyboardButton' type objects.
|
||||
|
||||
@@ -9,7 +9,7 @@ use utf8;
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
use Teapot::Bot::Object::InlineKeyboardButton ();
|
||||
|
||||
$Teapot::Bot::Object::InlineKeyboardMarkup::VERSION = '0.023';
|
||||
$Teapot::Bot::Object::InlineKeyboardMarkup::VERSION = '0.024';
|
||||
|
||||
has 'inline_keyboard';
|
||||
|
||||
@@ -35,7 +35,7 @@ Teapot::Bot::Object::InlineKeyboardMarkup - The base class for Telegram 'InlineK
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.023
|
||||
version 0.024
|
||||
|
||||
=head1 DESCRIPTION
|
||||
The base class for Telegram 'InlineKeyboardMarkup' type objects.
|
||||
|
||||
@@ -8,7 +8,7 @@ use utf8;
|
||||
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
|
||||
$Teapot::Bot::Object::Invoice::VERSION = '0.023';
|
||||
$Teapot::Bot::Object::Invoice::VERSION = '0.024';
|
||||
|
||||
has 'title';
|
||||
has 'description';
|
||||
@@ -34,7 +34,7 @@ Teapot::Bot::Object::Invoice - The base class for Telegram 'Invoice' type object
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.023
|
||||
version 0.024
|
||||
|
||||
=head1 DESCRIPTION
|
||||
The base class for Telegram 'Invoice' type objects.
|
||||
|
||||
@@ -8,7 +8,7 @@ use utf8;
|
||||
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
|
||||
$Teapot::Bot::Object::Location::VERSION = '0.023';
|
||||
$Teapot::Bot::Object::Location::VERSION = '0.024';
|
||||
|
||||
has 'longitude';
|
||||
has 'latitude';
|
||||
@@ -35,7 +35,7 @@ Teapot::Bot::Object::Location - The base class for Telegram message 'Location' t
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.023
|
||||
version 0.024
|
||||
|
||||
=head1 DESCRIPTION
|
||||
The base class for Telegram message 'Location' type.
|
||||
|
||||
@@ -8,7 +8,7 @@ use utf8;
|
||||
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
|
||||
$Teapot::Bot::Object::LoginUrl::VERSION = '0.023';
|
||||
$Teapot::Bot::Object::LoginUrl::VERSION = '0.024';
|
||||
|
||||
has 'url';
|
||||
has 'forward_text';
|
||||
@@ -33,7 +33,7 @@ Teapot::Bot::Object::LoginUrl - The base class for Telegram 'LoginUrl' type obje
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.023
|
||||
version 0.024
|
||||
|
||||
=head1 DESCRIPTION
|
||||
The base class for Telegram 'LoginUrl' type objects.
|
||||
|
||||
@@ -8,7 +8,7 @@ use utf8;
|
||||
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
|
||||
$Teapot::Bot::Object::MaskPosition::VERSION = '0.023';
|
||||
$Teapot::Bot::Object::MaskPosition::VERSION = '0.024';
|
||||
|
||||
has 'point';
|
||||
has 'x_shift';
|
||||
@@ -33,7 +33,7 @@ Teapot::Bot::Object::MaskPosition - The base class for Telegram 'MaskPosition' t
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.023
|
||||
version 0.024
|
||||
|
||||
=head1 DESCRIPTION
|
||||
The base class for Telegram 'MaskPosition' type objects.
|
||||
|
||||
@@ -40,10 +40,12 @@ use Teapot::Bot::Object::VideoChatStarted ();
|
||||
use Teapot::Bot::Object::VideoChatEnded ();
|
||||
use Teapot::Bot::Object::VideoChatParticipantsInvited ();
|
||||
|
||||
$Teapot::Bot::Object::Message::VERSION = '0.023';
|
||||
$Teapot::Bot::Object::Message::VERSION = '0.024';
|
||||
|
||||
# basic message stuff
|
||||
has 'message_id';
|
||||
has 'message_thread_id'; # Optional. Unique identifier of a message thread to which the message belongs;
|
||||
# for supergroups only
|
||||
has 'from'; # User
|
||||
has 'sender_chat'; # Chat
|
||||
has 'date';
|
||||
@@ -54,6 +56,7 @@ has 'forward_from_message_id';
|
||||
has 'forward_signature';
|
||||
has 'forward_sender_name';
|
||||
has 'forward_date';
|
||||
has 'is_topic_message'; # Optional. True, if the message is sent to a forum topic
|
||||
has 'is_automatic_forward';
|
||||
has 'reply_to_message'; # Message
|
||||
has 'via_bot'; # User
|
||||
@@ -96,6 +99,9 @@ has 'successful_payment'; # SuccessfulPayment
|
||||
has 'connected_website';
|
||||
has 'passport_data'; # PassportData
|
||||
has 'proximity_alert_triggered';
|
||||
has 'forum_topic_created'; # ForumTopicCreated
|
||||
has 'forum_topic_closed'; # ForumTopicClosed
|
||||
has 'forum_topic_reopened'; # ForumTopicReopened
|
||||
has 'video_chat_scheduled';
|
||||
has 'video_chat_started';
|
||||
has 'video_chat_ended';
|
||||
@@ -105,11 +111,11 @@ has 'reply_markup'; # Array of InlineKeyboardMarkup
|
||||
|
||||
sub fields {
|
||||
return {
|
||||
'scalar' => [qw/message_id date forward_from_message_id
|
||||
forward_signature forward_sender_name
|
||||
forward_date is_automatic_forward edit_date has_protected_content
|
||||
media_group_id author_signature text caption
|
||||
new_chat_title delete_chat_photo
|
||||
'scalar' => [qw/message_id message_thread_id date forward_from_message_id
|
||||
forward_signature forward_sender_name forward_date
|
||||
is_topic_message 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
|
||||
migrate_from_chat_id connected_website/],
|
||||
@@ -138,6 +144,9 @@ sub fields {
|
||||
'Teapot::Bot::Object::Invoice' => [qw/invoice/],
|
||||
'Teapot::Bot::Object::SuccessfulPayment' => [qw/successful_payment/],
|
||||
'Teapot::Bot::Object::PassportData' => [qw/passport_data/],
|
||||
'Teapot::Bot::Object::ForumTopicCreated' => [qw/forum_topic_created/],
|
||||
'Teapot::Bot::Object::ForumTopicClosed' => [qw/forum_topic_closed/],
|
||||
'Teapot::Bot::Object::ForumTopicReopened' => [qw/forum_topic_reopened/],
|
||||
'Teapot::Bot::Object::InlineKeyboardMarkup' => [qw/reply_markup/],
|
||||
'Teapot::Bot::Object::ProximityAlertTriggered' => [qw/proximity_alert_triggered/],
|
||||
'Teapot::Bot::Object::Dice' => [qw/dice/],
|
||||
@@ -160,10 +169,15 @@ sub reply {
|
||||
my $text = shift;
|
||||
|
||||
my $chatid = $self->chat->id;
|
||||
my $message_thread_id = eval {$self->message_thread_id};
|
||||
|
||||
if (Teapot::Bot::Object::ChatPermissions->canTalk($self, $chatid)) {
|
||||
if (defined $message_thread_id && $message_thread_id ne '') {
|
||||
return $self->_brain->sendMessage({chat_id => $chatid, message_thread_id => $message_thread_id, text => $text});
|
||||
} else {
|
||||
return $self->_brain->sendMessage({chat_id => $chatid, text => $text});
|
||||
}
|
||||
}
|
||||
|
||||
return {'error' => 1};
|
||||
}
|
||||
@@ -173,13 +187,14 @@ sub replyMd {
|
||||
my $text = shift;
|
||||
|
||||
my $chatid = $self->chat->id;
|
||||
my $message_thread_id = eval {$self->message_thread_id};
|
||||
|
||||
if (Teapot::Bot::Object::ChatPermissions->canTalk ($self, $chatid)) {
|
||||
my $send_args;
|
||||
$send_args->{text} = $text;
|
||||
$send_args->{parse_mode} = 'Markdown';
|
||||
$send_args->{chat_id} = $chatid;
|
||||
|
||||
$send_args->{message_thread_id} = $message_thread_id if (defined $message_thread_id);
|
||||
return $self->_brain->sendMessage($send_args);
|
||||
}
|
||||
|
||||
@@ -212,7 +227,7 @@ Teapot::Bot::Object::Message - The base class for the Telegram type "Message"
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.023
|
||||
version 0.024
|
||||
|
||||
=head1 DESCRIPTION
|
||||
The base class for the Telegram type "Message".
|
||||
|
||||
@@ -8,7 +8,7 @@ use utf8;
|
||||
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
|
||||
$Teapot::Bot::Object::MessageAutoDeleteTimerChanged::VERSION = '0.023';
|
||||
$Teapot::Bot::Object::MessageAutoDeleteTimerChanged::VERSION = '0.024';
|
||||
|
||||
has 'message_auto_delete_time';
|
||||
|
||||
@@ -32,7 +32,7 @@ Teapot::Bot::Object::MessageAutoDeleteTimerChanged - The base class for Telegram
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.023
|
||||
version 0.024
|
||||
|
||||
=head1 DESCRIPTION
|
||||
The base class for Telegram 'MessageAutoDeleteTimerChanged' type objects.
|
||||
|
||||
@@ -9,7 +9,7 @@ use utf8;
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
use Teapot::Bot::Object::User ();
|
||||
|
||||
$Teapot::Bot::Object::MessageEntity::VERSION = '0.023';
|
||||
$Teapot::Bot::Object::MessageEntity::VERSION = '0.024';
|
||||
|
||||
has 'type';
|
||||
has 'offset';
|
||||
@@ -39,7 +39,7 @@ Teapot::Bot::Object::MessageEntity - The base class for Telegram 'MessageEntity'
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.023
|
||||
version 0.024
|
||||
|
||||
=head1 DESCRIPTION
|
||||
The base class for Telegram 'MessageEntity' type objects.
|
||||
|
||||
@@ -10,7 +10,7 @@ use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
use Teapot::Bot::Object::EncryptedPassportElement ();
|
||||
use Teapot::Bot::Object::EncryptedCredentials ();
|
||||
|
||||
$Teapot::Bot::Object::PassportData::VERSION = '0.023';
|
||||
$Teapot::Bot::Object::PassportData::VERSION = '0.024';
|
||||
|
||||
has 'data'; # Array of EncryptedPassportElement
|
||||
has 'credentials'; # EncryptedCredentials
|
||||
@@ -40,7 +40,7 @@ Teapot::Bot::Object::PassportData - The base class for Telegram 'PassportData' t
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.023
|
||||
version 0.024
|
||||
|
||||
=head1 DESCRIPTION
|
||||
The base class for Telegram 'PassportData' type objects.
|
||||
|
||||
@@ -8,7 +8,7 @@ use utf8;
|
||||
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
|
||||
$Teapot::Bot::Object::PhotoSize::VERSION = '0.023';
|
||||
$Teapot::Bot::Object::PhotoSize::VERSION = '0.024';
|
||||
|
||||
has 'file_id';
|
||||
has 'file_unique_id';
|
||||
@@ -34,7 +34,7 @@ Teapot::Bot::Object::PhotoSize - The base class for Telegram message 'PhotoSize'
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.023
|
||||
version 0.024
|
||||
|
||||
=head1 DESCRIPTION
|
||||
The base class for Telegram message 'PhotoSize' type.
|
||||
|
||||
@@ -9,7 +9,7 @@ use utf8;
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
use Teapot::Bot::Object::PollOption ();
|
||||
|
||||
$Teapot::Bot::Object::Poll::VERSION = '0.023';
|
||||
$Teapot::Bot::Object::Poll::VERSION = '0.024';
|
||||
|
||||
has 'id';
|
||||
has 'question';
|
||||
@@ -52,7 +52,7 @@ Teapot::Bot::Object::Poll - The base class for Telegram 'Poll' type objects
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.023
|
||||
version 0.024
|
||||
|
||||
=head1 DESCRIPTION
|
||||
The base class for Telegram 'Poll' type objects
|
||||
|
||||
@@ -8,7 +8,7 @@ use utf8;
|
||||
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
|
||||
$Teapot::Bot::Object::PollAnswer::VERSION = '0.023';
|
||||
$Teapot::Bot::Object::PollAnswer::VERSION = '0.024';
|
||||
|
||||
has 'poll_id';
|
||||
has 'user';
|
||||
@@ -39,7 +39,7 @@ Teapot::Bot::Object::PollAnswer - The base class for Telegram 'PollAnswer' type
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.023
|
||||
version 0.024
|
||||
|
||||
=head1 DESCRIPTION
|
||||
The base class for Telegram 'PollAnswer' type objects.
|
||||
|
||||
@@ -8,7 +8,7 @@ use utf8;
|
||||
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
|
||||
$Teapot::Bot::Object::PollOption::VERSION = '0.023';
|
||||
$Teapot::Bot::Object::PollOption::VERSION = '0.024';
|
||||
|
||||
has 'text';
|
||||
has 'voter_count';
|
||||
@@ -31,7 +31,7 @@ Teapot::Bot::Object::PollOption - The base class for Telegram 'PollOption' type
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.023
|
||||
version 0.024
|
||||
|
||||
=head1 DESCRIPTION
|
||||
The base class for Telegram 'PollOption' type objects.
|
||||
|
||||
@@ -8,7 +8,7 @@ use utf8;
|
||||
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
|
||||
$Teapot::Bot::Object::ProximityAlertTriggered::VERSION = '0.023';
|
||||
$Teapot::Bot::Object::ProximityAlertTriggered::VERSION = '0.024';
|
||||
|
||||
has 'traveler'; # User
|
||||
has 'watcher'; # User
|
||||
@@ -35,7 +35,7 @@ Teapot::Bot::Object::ProximityAlertTriggered - The base class for Telegram messa
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.023
|
||||
version 0.024
|
||||
|
||||
=head1 DESCRIPTION
|
||||
The base class for Telegram message 'ProximityAlertTriggered' type.
|
||||
|
||||
@@ -10,7 +10,7 @@ use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
use Teapot::Bot::Object::PhotoSize ();
|
||||
use Teapot::Bot::Object::MaskPosition ();
|
||||
|
||||
$Teapot::Bot::Object::Sticker::VERSION = '0.023';
|
||||
$Teapot::Bot::Object::Sticker::VERSION = '0.024';
|
||||
|
||||
has 'file_id';
|
||||
has 'file_unique_id';
|
||||
@@ -46,7 +46,7 @@ Teapot::Bot::Object::Sticker - The base class for Telegram message 'Sticker' typ
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.023
|
||||
version 0.024
|
||||
|
||||
=head1 DESCRIPTION
|
||||
The base class for Telegram message 'Sticker' type.
|
||||
|
||||
@@ -9,7 +9,7 @@ use utf8;
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
# use Teapot::Bot::Object::OrderInfo;
|
||||
|
||||
$Teapot::Bot::Object::SuccessfulPayment::VERSION = '0.023';
|
||||
$Teapot::Bot::Object::SuccessfulPayment::VERSION = '0.024';
|
||||
|
||||
has 'currency';
|
||||
has 'total_amount';
|
||||
@@ -41,7 +41,7 @@ Teapot::Bot::Object::SuccessfulPayment - The base class for Telegram 'Successful
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.023
|
||||
version 0.024
|
||||
|
||||
=head1 DESCRIPTION
|
||||
The base class for Telegram 'SuccessfulPayment' type objects.
|
||||
|
||||
@@ -8,7 +8,7 @@ use utf8;
|
||||
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
|
||||
$Teapot::Bot::Object::User::VERSION = '0.023';
|
||||
$Teapot::Bot::Object::User::VERSION = '0.024';
|
||||
|
||||
has 'id';
|
||||
has 'is_bot';
|
||||
@@ -41,7 +41,7 @@ Teapot::Bot::Object::User - The base class for Telegram message 'User' type
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.023
|
||||
version 0.024
|
||||
|
||||
=head1 DESCRIPTION
|
||||
The base class for Telegram message 'User' type.
|
||||
|
||||
@@ -9,7 +9,7 @@ use utf8;
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
use Teapot::Bot::Object::Location ();
|
||||
|
||||
$Teapot::Bot::Object::Venue::VERSION = '0.023';
|
||||
$Teapot::Bot::Object::Venue::VERSION = '0.024';
|
||||
|
||||
has 'location'; #Location
|
||||
has 'title';
|
||||
@@ -41,7 +41,7 @@ Teapot::Bot::Object::Venue - The base class for Telegram 'LoginUrl' type objects
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.023
|
||||
version 0.024
|
||||
|
||||
=head1 DESCRIPTION
|
||||
The base class for Telegram 'LoginUrl' type objects.
|
||||
|
||||
@@ -9,7 +9,7 @@ use utf8;
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
use Teapot::Bot::Object::PhotoSize ();
|
||||
|
||||
$Teapot::Bot::Object::Video::VERSION = '0.023';
|
||||
$Teapot::Bot::Object::Video::VERSION = '0.024';
|
||||
|
||||
has 'file_id';
|
||||
has 'file_unique_id';
|
||||
@@ -43,7 +43,7 @@ Teapot::Bot::Object::Video - The base class for Telegram 'Video' object
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.023
|
||||
version 0.024
|
||||
|
||||
=head1 DESCRIPTION
|
||||
The base class for Telegram 'Video' object.
|
||||
|
||||
@@ -8,7 +8,7 @@ use utf8;
|
||||
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
|
||||
$Teapot::Bot::Object::VideoChatEnded::VERSION = '0.023';
|
||||
$Teapot::Bot::Object::VideoChatEnded::VERSION = '0.024';
|
||||
|
||||
# This object represents a service message about a Video chat started in the chat. Currently holds no information.
|
||||
has 'duration';
|
||||
@@ -31,7 +31,7 @@ Teapot::Bot::Object::VideoChatEnded - The base class for Telegram message 'Video
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.023
|
||||
version 0.024
|
||||
|
||||
=head1 DESCRIPTION
|
||||
The base class for Telegram message 'VideoChatEnded' type.
|
||||
|
||||
@@ -9,7 +9,7 @@ use utf8;
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
use Teapot::Bot::Object::User ();
|
||||
|
||||
$Teapot::Bot::Object::VideoChatParticipantsInvited::VERSION = '0.023';
|
||||
$Teapot::Bot::Object::VideoChatParticipantsInvited::VERSION = '0.024';
|
||||
|
||||
# This object represents a service message about a Video chat started in the chat. Currently holds no information.
|
||||
has 'users';
|
||||
@@ -36,7 +36,7 @@ Teapot::Bot::Object::VideoChatParticipantsInvited - The base class for Telegram
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.023
|
||||
version 0.024
|
||||
|
||||
=head1 DESCRIPTION
|
||||
The base class for Telegram message 'VideoChatParticipantsInvited' type.
|
||||
|
||||
@@ -8,7 +8,7 @@ use utf8;
|
||||
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
|
||||
$Teapot::Bot::Object::VideoChatScheduled::VERSION = '0.023';
|
||||
$Teapot::Bot::Object::VideoChatScheduled::VERSION = '0.024';
|
||||
|
||||
# This object represents a service message about a video chat started in the chat. Currently holds no information.
|
||||
has 'start_date';
|
||||
@@ -31,7 +31,7 @@ Teapot::Bot::Object::VideoChatScheduled - The base class for Telegram message 'V
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.023
|
||||
version 0.024
|
||||
|
||||
=head1 DESCRIPTION
|
||||
The base class for Telegram message 'VideoChatScheduled' type.
|
||||
|
||||
@@ -8,7 +8,7 @@ use utf8;
|
||||
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
|
||||
$Teapot::Bot::Object::VideoChatStarted::VERSION = '0.023';
|
||||
$Teapot::Bot::Object::VideoChatStarted::VERSION = '0.024';
|
||||
|
||||
# This object represents a service message about a Video chat started in the chat. Currently holds no information.
|
||||
has 'stub';
|
||||
@@ -31,7 +31,7 @@ Teapot::Bot::Object::VideoChatStarted - The base class for Telegram message 'Vid
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.023
|
||||
version 0.024
|
||||
|
||||
=head1 DESCRIPTION
|
||||
The base class for Telegram message 'VideoChatStarted' type.
|
||||
|
||||
@@ -9,7 +9,7 @@ use utf8;
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
use Teapot::Bot::Object::PhotoSize ();
|
||||
|
||||
$Teapot::Bot::Object::VideoNote::VERSION = '0.023';
|
||||
$Teapot::Bot::Object::VideoNote::VERSION = '0.024';
|
||||
|
||||
has 'file_id';
|
||||
has 'file_unique_id';
|
||||
@@ -40,7 +40,7 @@ Teapot::Bot::Object::VideoNote - The base class for Telegram 'VideoNote' type ob
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.023
|
||||
version 0.024
|
||||
|
||||
=head1 DESCRIPTION
|
||||
The base class for Telegram 'VideoNote' type object.
|
||||
|
||||
@@ -8,7 +8,7 @@ use utf8;
|
||||
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
|
||||
$Teapot::Bot::Object::Voice::VERSION = '0.023';
|
||||
$Teapot::Bot::Object::Voice::VERSION = '0.024';
|
||||
|
||||
has 'file_id';
|
||||
has 'file_unique_id';
|
||||
@@ -34,7 +34,7 @@ Teapot::Bot::Object::Voice - The base class for Telegram 'Voice' type objects
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.023
|
||||
version 0.024
|
||||
|
||||
=head1 DESCRIPTION
|
||||
The base class for Telegram 'Voice' type objects.
|
||||
|
||||
@@ -8,7 +8,7 @@ use utf8;
|
||||
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
|
||||
$Teapot::Bot::Object::WebAppData::VERSION = '0.023';
|
||||
$Teapot::Bot::Object::WebAppData::VERSION = '0.024';
|
||||
|
||||
has 'data';
|
||||
has 'button_text';
|
||||
@@ -31,7 +31,7 @@ Teapot::Bot::Object::WebAppData - The base class for Telegram 'WebAppData' type
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.023
|
||||
version 0.024
|
||||
|
||||
=head1 DESCRIPTION
|
||||
The base class for Telegram 'WebAppData' type objects.
|
||||
|
||||
@@ -42,6 +42,7 @@ my @introduce_greet = (
|
||||
);
|
||||
|
||||
my $redismsg->{from} = 'telegram';
|
||||
$redismsg->{threadid} = '';
|
||||
$redismsg->{plugin} = 'telegram';
|
||||
$redismsg->{misc}->{answer} = 1;
|
||||
$redismsg->{misc}->{csign} = "$c->{telegrambot}->{csign}";
|
||||
@@ -362,6 +363,15 @@ sub __on_msg {
|
||||
$rmsg->{chatid} = "$chatid";
|
||||
$rmsg->{misc}->{answer} = 1;
|
||||
|
||||
# Если тип группы supergroup, в ней могут быть треды, попробуем найти message_thread_id, если таковой есть
|
||||
if ($msg->chat->type eq 'supergroup') {
|
||||
if ($msg->can ('is_topic_message') && $msg->is_topic_message) {
|
||||
if ($msg->can ('message_thread_id') && $msg->message_thread_id ne '') {
|
||||
$rmsg->{threadid} = "$msg->message_thread_id";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
do {
|
||||
my $ready = eval { $main::RCONN->is_connected; };
|
||||
@@ -402,6 +412,15 @@ sub __on_msg {
|
||||
$rmsg->{chatid} = "$chatid";
|
||||
$rmsg->{misc}->{answer} = 1;
|
||||
|
||||
# Если тип группы supergroup, в ней могут быть треды, попробуем найти message_thread_id, если таковой есть
|
||||
if ($msg->chat->type eq 'supergroup') {
|
||||
if ($msg->can ('is_topic_message') && $msg->is_topic_message) {
|
||||
if ($msg->can ('message_thread_id') && $msg->message_thread_id ne '') {
|
||||
$rmsg->{threadid} = "$msg->message_thread_id";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Сообщение обращено к боту
|
||||
if ((lc ($text) =~ /^${qname}[\,|\:]? (.+)/) or (lc ($text) =~ /^${qtname}[\,|\:]? (.+)/)){
|
||||
$phrase = $1;
|
||||
@@ -454,10 +473,20 @@ sub __on_msg {
|
||||
|
||||
$msg->typing ();
|
||||
sleep (irand 2);
|
||||
$log->debug (sprintf ('[DEBUG] In public chat %s (%s) bot reply to %s: %s', $chatname, $chatid, $vis_a_vi, $reply));
|
||||
$log->debug (
|
||||
sprintf (
|
||||
'[DEBUG] In public chat %s (%s) bot reply to %s: %s',
|
||||
$chatname, $chatid, $vis_a_vi, $reply,
|
||||
)
|
||||
);
|
||||
$msg->reply ($reply);
|
||||
} else {
|
||||
$log->debug (sprintf ('[DEBUG] In public chat %s (%s) bot is not required to reply to %s', $chatname, $chatid, $vis_a_vi));
|
||||
$log->debug (
|
||||
sprintf (
|
||||
'[DEBUG] In public chat %s (%s) bot is not required to reply to %s',
|
||||
$chatname, $chatid, $vis_a_vi,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
# should be channel, so we can't talk
|
||||
|
||||
Reference in New Issue
Block a user