From b8c3f4957c95f61fd7865cce6a5818b4a3720748 Mon Sep 17 00:00:00 2001 From: eleksir Date: Sat, 1 May 2021 00:40:18 +0300 Subject: [PATCH] Update objects of Teapot::Bot according Bot API docs. Add missing fields. + Add missing fields some of existing objects * Fix copy-paste errors in Teapot::Bot::Object::PollAnswer --- lib/Teapot/Bot/Object/Animation.pm | 4 ++- lib/Teapot/Bot/Object/Chat.pm | 39 ++++++++++++++++------------- lib/Teapot/Bot/Object/Contact.pm | 3 ++- lib/Teapot/Bot/Object/Document.pm | 3 ++- lib/Teapot/Bot/Object/PhotoSize.pm | 3 ++- lib/Teapot/Bot/Object/PollAnswer.pm | 14 +++++------ lib/Teapot/Bot/Object/VideoNote.pm | 3 ++- lib/Teapot/Bot/Object/Voice.pm | 3 ++- 8 files changed, 41 insertions(+), 31 deletions(-) diff --git a/lib/Teapot/Bot/Object/Animation.pm b/lib/Teapot/Bot/Object/Animation.pm index c7e3670..03c95fe 100644 --- a/lib/Teapot/Bot/Object/Animation.pm +++ b/lib/Teapot/Bot/Object/Animation.pm @@ -8,6 +8,7 @@ use Carp qw/croak/; $Teapot::Bot::Object::Animation::VERSION = '0.022'; has 'file_id'; +has 'file_unique_id'; has 'width'; has 'height'; has 'duration'; @@ -17,7 +18,8 @@ has 'mime_type'; has 'file_size'; sub fields { - return { scalar => [qw/file_id width height duration file_name mime_type file_size/], + return { scalar => [qw/file_id file_unique_id width height duration file_name mime_type + file_size/], 'Teapot::Bot::Object::PhotoSize' => [qw/thumb/], }; } diff --git a/lib/Teapot/Bot/Object/Chat.pm b/lib/Teapot/Bot/Object/Chat.pm index 8bec271..d312f36 100644 --- a/lib/Teapot/Bot/Object/Chat.pm +++ b/lib/Teapot/Bot/Object/Chat.pm @@ -11,27 +11,30 @@ $Teapot::Bot::Object::Chat::VERSION = '0.022'; has 'id'; has 'type'; -has 'title'; # Optional. -has 'username'; # Optional. -has 'first_name'; # Optional. -has 'last_name'; # Optional. -has 'photo'; # Teapot::Bot::Object::ChatPhoto. Optional. 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 -has 'permissions'; # Teapot::Bot::Object::ChatPermissions. Optional. Default chat member permissions, for - # groups and supergroups. Returned only in getChat. -has 'slow_mode_delay'; # Optional. 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 -has 'location'; # Optional. Returned only in getChat. +has 'title'; # Optional. +has 'username'; # Optional. +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 'description'; # Optional. Returned only in getChat. +has 'invite_link'; # Optional. Returned only in getChat. +has 'pinned_message'; # Teapot::Bot::Object::Message +has 'permissions'; # Teapot::Bot::Object::ChatPermissions. Optional. Default chat member permissions, for + # groups and supergroups. Returned only in getChat. +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 '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 +has 'location'; # Optional. Returned only in getChat. sub fields { return { - 'scalar' => [qw/id type title username first_name last_name description - invite_link slow_mode_delay sticker_set_name - can_set_sticker_set linked_chat_id/], + 'scalar' => [qw/id type title username first_name last_name bio description + invite_link slow_mode_delay message_auto_delete_time + sticker_set_name can_set_sticker_set linked_chat_id/], 'Teapot::Bot::Object::ChatPhoto' => [qw/photo/], 'Teapot::Bot::Object::Message' => [qw/pinned_message/], 'Teapot::Bot::Object::ChatPermissions' => [qw/permissions/], diff --git a/lib/Teapot/Bot/Object/Contact.pm b/lib/Teapot/Bot/Object/Contact.pm index a3aad1a..9d0989e 100644 --- a/lib/Teapot/Bot/Object/Contact.pm +++ b/lib/Teapot/Bot/Object/Contact.pm @@ -9,10 +9,11 @@ has 'phone_number'; has 'first_name'; has 'last_name'; has 'user_id'; +has 'vcard'; sub fields { return { - scalar => [qw/phone_number first_name last_name user_id/], + scalar => [qw/phone_number first_name last_name user_id vcard/], }; } diff --git a/lib/Teapot/Bot/Object/Document.pm b/lib/Teapot/Bot/Object/Document.pm index 3e4082c..45976dd 100644 --- a/lib/Teapot/Bot/Object/Document.pm +++ b/lib/Teapot/Bot/Object/Document.pm @@ -8,6 +8,7 @@ use Teapot::Bot::Object::PhotoSize; $Teapot::Bot::Object::Document::VERSION = '0.022'; has 'file_id'; +has 'file_unique_id'; has 'thumb'; #PhotoSize has 'file_name'; has 'mime_type'; @@ -15,7 +16,7 @@ has 'file_size'; sub fields { return { - scalar => [qw/file_id file_name mime_type file_size/], + scalar => [qw/file_id file_unique_id file_name mime_type file_size/], 'Teapot::Bot::Object::PhotoSize' => [qw/thumb/] }; } diff --git a/lib/Teapot/Bot/Object/PhotoSize.pm b/lib/Teapot/Bot/Object/PhotoSize.pm index 4ce99ed..ff61593 100644 --- a/lib/Teapot/Bot/Object/PhotoSize.pm +++ b/lib/Teapot/Bot/Object/PhotoSize.pm @@ -7,12 +7,13 @@ use Carp qw/croak/; $Teapot::Bot::Object::PhotoSize::VERSION = '0.022'; has 'file_id'; +has 'file_unique_id'; has 'width'; has 'height'; has 'file_size'; sub fields { - return { scalar => [qw/file_id width height file_size/] }; + return { scalar => [qw/file_id file_unique_id width height file_size/] }; } 1; diff --git a/lib/Teapot/Bot/Object/PollAnswer.pm b/lib/Teapot/Bot/Object/PollAnswer.pm index c3dfe8a..3369c27 100644 --- a/lib/Teapot/Bot/Object/PollAnswer.pm +++ b/lib/Teapot/Bot/Object/PollAnswer.pm @@ -1,9 +1,9 @@ -package Teapot::Bot::Object::PollOption; +package Teapot::Bot::Object::PollAnswer; # ABSTRACT: The base class for Telegram 'PollOption' type objects use Mojo::Base 'Teapot::Bot::Object::Base'; -$Teapot::Bot::Object::PollOption::VERSION = '0.022'; +$Teapot::Bot::Object::PollAnswer::VERSION = '0.022'; has 'poll_id'; has 'user'; @@ -30,17 +30,17 @@ __END__ =head1 NAME -Teapot::Bot::Object::PollOption - The base class for Telegram 'PollOption' type objects +Teapot::Bot::Object::PollAnswer - The base class for Telegram 'PollAnswer' type objects =head1 VERSION version 0.022 =head1 DESCRIPTION -The base class for Telegram 'PollOption' type objects. +The base class for Telegram 'PollAnswer' type objects. -See L for details of the -attributes available for L objects. +See L for details of the +attributes available for L objects. =head1 AUTHOR @@ -48,7 +48,7 @@ Sergei Fedosov =head1 LICENSE AND COPYRIGHT -This software is copyright (c) 2020 Sergei Fedosov . +This software is copyright (c) 2021 Sergei Fedosov . This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. diff --git a/lib/Teapot/Bot/Object/VideoNote.pm b/lib/Teapot/Bot/Object/VideoNote.pm index 0c62688..40a18ee 100644 --- a/lib/Teapot/Bot/Object/VideoNote.pm +++ b/lib/Teapot/Bot/Object/VideoNote.pm @@ -8,6 +8,7 @@ use Teapot::Bot::Object::PhotoSize; $Teapot::Bot::Object::VideoNote::VERSION = '0.022'; has 'file_id'; +has 'file_unique_id'; has 'length'; has 'duration'; has 'mime_type'; @@ -16,7 +17,7 @@ has 'file_size'; sub fields { return { - scalar => [qw/file_id length duration mime_type file_size/], + scalar => [qw/file_id file_unique_id length duration mime_type file_size/], 'Teapot::Bot::Object::PhotoSize' => [qw/thumb /], }; } diff --git a/lib/Teapot/Bot/Object/Voice.pm b/lib/Teapot/Bot/Object/Voice.pm index 923d9f2..72fe4f0 100644 --- a/lib/Teapot/Bot/Object/Voice.pm +++ b/lib/Teapot/Bot/Object/Voice.pm @@ -6,12 +6,13 @@ use Mojo::Base 'Teapot::Bot::Object::Base'; $Teapot::Bot::Object::Voice::VERSION = '0.022'; has 'file_id'; +has 'file_unique_id'; has 'duration'; has 'mime_type'; has 'file_size'; sub fields { - return { scalar => [qw/file_id duration mime_type file_size/] }; + return { scalar => [qw/file_id file_unique_id duration mime_type file_size/] }; } 1;