Lint Teapot::Bot with perlcritic

* Use List::Util' any instead of grep in Base.pm
* Use croak() in Base.pm
This commit is contained in:
eleksir
2020-10-31 13:20:27 +03:00
parent a480786afa
commit 97eddd414d
35 changed files with 227 additions and 164 deletions

View File

@@ -17,7 +17,7 @@ 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 width height duration file_name mime_type file_size/],
'Teapot::Bot::Object::PhotoSize' => [qw/thumb/],
};
}
@@ -33,13 +33,14 @@ __END__
=head1 NAME
Teapot::Bot::Object::Animation - The base class for Telegram message 'Animation' type.
Teapot::Bot::Object::Animation - The base class for Telegram message 'Animation' type
=head1 VERSION
version 0.021
=head1 DESCRIPTION
The base class for Telegram message 'Animation' type.
See L<https://core.telegram.org/bots/api#animation> for details of the
attributes available for L<Teapot::Bot::Object::Animation> objects.
@@ -48,7 +49,7 @@ attributes available for L<Teapot::Bot::Object::Animation> objects.
Justin Hawkins <justin@eatmorecode.com>
=head1 COPYRIGHT AND LICENSE
=head1 LICENSE AND COPYRIGHT
This software is copyright (c) 2019 by Justin Hawkins.

View File

@@ -14,7 +14,7 @@ has 'file_size';
has 'thumb'; #PhotoSize
sub fields {
return { scalar => [qw/file_id duration performer title mime_type file_size/],
return { scalar => [qw/file_id duration performer title mime_type file_size/],
'Teapot::Bot::Object::PhotoSize' => [qw/thumb/],
};
}
@@ -36,6 +36,7 @@ Teapot::Bot::Object::Audio - The base class for Telegram 'Audio' type objects
version 0.021
=head1 DESCRIPTION
The base class for Telegram 'Audio' type objects.
See L<https://core.telegram.org/bots/api#audio> for details of the
attributes available for L<Teapot::Bot::Object::Audio> objects.
@@ -44,7 +45,7 @@ attributes available for L<Teapot::Bot::Object::Audio> objects.
Justin Hawkins <justin@eatmorecode.com>
=head1 COPYRIGHT AND LICENSE
=head1 LICENSE AND COPYRIGHT
This software is copyright (c) 2019 by Justin Hawkins.

View File

@@ -2,28 +2,30 @@ package Teapot::Bot::Object::Base;
# ABSTRACT: The base class for all Teapot::Bot::Object objects.
use Mojo::Base -base;
use List::Util qw/any/;
use Carp qw/croak/;
$Teapot::Bot::Object::Base::VERSION = '0.021';
has '_brain'; # a reference to our brain
sub arrays { qw// } # override if needed
sub arrays { return qw// } # override if needed
sub _field_is_array {
my $self = shift;
my $field = shift;
if (grep /^$field$/, $self->arrays) {
if (any { /^$field$/ } $self->arrays) {
return 1;
}
return;
}
sub array_of_arrays { qw// } #override if needed
sub array_of_arrays { return qw// } #override if needed
sub _field_is_array_of_arrays {
my $self = shift;
my $field = shift;
if (grep /^$field$/, $self->array_of_arrays) {
if (any { /^$field$/ } $self->array_of_arrays) {
return 1;
}
return;
@@ -35,7 +37,7 @@ sub _field_is_array_of_arrays {
sub create_from_hash {
my $class = shift;
my $hash = shift;
my $brain = shift || die "no brain supplied";
my $brain = shift || croak 'No brain supplied to create_from_hash()';
my $obj = $class->new(_brain => $brain);
# deal with each type of field
@@ -60,7 +62,7 @@ sub create_from_hash {
$obj->$field($val);
}
elsif ($obj->_field_is_array_of_arrays) {
die "not yet implemented for scalars";
croak 'Not yet implemented for scalars';
}
else {
my $val = $hash->{$field};
@@ -81,7 +83,7 @@ sub create_from_hash {
$obj->$field(\@sub_array);
}
elsif ($obj->_field_is_array_of_arrays) {
die "not yet implemented for scalars";
croak 'Not yet implemented for scalars';
}
else {
$obj->$field($type->create_from_hash($hash->{$field}, $brain));
@@ -129,7 +131,7 @@ __END__
=head1 NAME
Teapot::Bot::Object::Base - The base class for all Telegram::Bot::Object objects.
Teapot::Bot::Object::Base - The base class for all Telegram::Bot::Object objects
=head1 VERSION
@@ -137,6 +139,8 @@ version 0.021
=head1 DESCRIPTION
The base class for all Telegram::Bot::Object objects.
This class should not be instantiated itself. Instead, instantiate a sub-class.
You should generally not need to instantiate objects of sub-classes of L<Teapot::Bot::Object::Base>,
@@ -170,7 +174,7 @@ Return this object as a hashref.
Justin Hawkins <justin@eatmorecode.com>
=head1 COPYRIGHT AND LICENSE
=head1 LICENSE AND COPYRIGHT
This software is copyright (c) 2019 by Justin Hawkins.

View File

@@ -1,9 +1,8 @@
package Teapot::Bot::Object::CallbackGame;
$Teapot::Bot::Object::CallbackGame::VERSION = '0.021';
# ABSTRACT: The base class for Telegram message 'CallbackGame' type.
use Mojo::Base 'Teapot::Bot::Object::Base';
$Teapot::Bot::Object::CallbackGame::VERSION = '0.021';
# https://core.telegram.org/bots/api#callbackgame
# "A placeholder, currently holds no information. Use BotFather to set up your game"
@@ -22,13 +21,14 @@ __END__
=head1 NAME
Teapot::Bot::Object::CallbackGame - The base class for Telegram message 'CallbackGame' type.
Teapot::Bot::Object::CallbackGame - The base class for Telegram message 'CallbackGame' type
=head1 VERSION
version 0.021
=head1 DESCRIPTION
The base class for Telegram message 'CallbackGame' type.
See L<https://core.telegram.org/bots/api#callbackgame> for details of the
attributes available for L<Teapot::Bot::Object::CallbackGame> objects.
@@ -37,7 +37,7 @@ attributes available for L<Teapot::Bot::Object::CallbackGame> objects.
Justin Hawkins <justin@eatmorecode.com>
=head1 COPYRIGHT AND LICENSE
=head1 LICENSE AND COPYRIGHT
This software is copyright (c) 2019 by Justin Hawkins.

View File

@@ -62,6 +62,7 @@ Teapot::Bot::Object::Chat - The base class for Telegram 'Chat' type objects
version 0.021
=head1 DESCRIPTION
The base class for Telegram 'Chat' type objects.
See L<https://core.telegram.org/bots/api#chat> for details of the
attributes available for L<Teapot::Bot::Object::Chat> objects.
@@ -80,7 +81,7 @@ Returns true if this is a chat is a group.
Justin Hawkins <justin@eatmorecode.com>
=head1 COPYRIGHT AND LICENSE
=head1 LICENSE AND COPYRIGHT
This software is copyright (c) 2019 by Justin Hawkins.

View File

@@ -53,6 +53,7 @@ Teapot::Bot::Object::ChatMember - The base class for Telegram 'ChatMember' type
version 0.021
=head1 DESCRIPTION
The base class for Telegram 'ChatMember' type objects.
See L<https://core.telegram.org/bots/api#chatmember> for details of the
attributes available for L<Teapot::Bot::Object::ChatMember> objects.
@@ -61,7 +62,7 @@ attributes available for L<Teapot::Bot::Object::ChatMember> objects.
Sergei Fedosov <eleksir@gmail.com>
=head1 COPYRIGHT AND LICENSE
=head1 LICENSE AND COPYRIGHT
This software is copyright (c) 2020 by Sergei Fedosov <eleksir@gmail.com>

View File

@@ -25,7 +25,7 @@ sub fields {
'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/]
};
};
}
1;
@@ -45,6 +45,7 @@ Teapot::Bot::Object::ChatPermissions - The base class for Telegram 'ChatPermissi
version 0.021
=head1 DESCRIPTION
The base class for Telegram 'ChatPermissions' type objects.
See L<https://core.telegram.org/bots/api#chatpermissions> for details of the
attributes available for L<Teapot::Bot::Object::ChatPermissions> objects.
@@ -53,7 +54,7 @@ attributes available for L<Teapot::Bot::Object::ChatPermissions> objects.
Sergei Fedosov <eleksir@gmail.com>
=head1 COPYRIGHT AND LICENSE
=head1 LICENSE AND COPYRIGHT
This software is copyright (c) 2020 Sergei Fedosov <eleksir@gmail.com>.

View File

@@ -10,8 +10,8 @@ has 'big_file_id';
sub fields {
return {
'scalar' => [qw/small_file_id big_file_id/],
};
'scalar' => [qw/small_file_id big_file_id/],
};
}
1;
@@ -31,6 +31,7 @@ Teapot::Bot::Object::ChatPhoto - The base class for Telegram 'ChatPhoto' type ob
version 0.021
=head1 DESCRIPTION
The base class for Telegram 'ChatPhoto' type objects.
See L<https://core.telegram.org/bots/api#chatphoto> for details of the
attributes available for L<Teapot::Bot::Object::ChatPhoto> objects.
@@ -39,7 +40,7 @@ attributes available for L<Teapot::Bot::Object::ChatPhoto> objects.
Justin Hawkins <justin@eatmorecode.com>
=head1 COPYRIGHT AND LICENSE
=head1 LICENSE AND COPYRIGHT
This software is copyright (c) 2019 by Justin Hawkins.

View File

@@ -11,7 +11,8 @@ has 'last_name';
has 'user_id';
sub fields {
return { scalar => [qw/phone_number first_name last_name user_id/],
return {
scalar => [qw/phone_number first_name last_name user_id/],
};
}
@@ -25,22 +26,23 @@ __END__
=head1 NAME
Teapot::Bot::Object::Contact - The base class for Telegram 'Contact' objects.
Teapot::Bot::Object::Contact - The base class for Telegram 'Contact' objects
=head1 VERSION
version 0.021
=head1 DESCRIPTION
The base class for Telegram 'Contact' objects.
See L<https://core.telegram.org/bots/api#chat> for details of the
See L<https://core.telegram.org/bots/api#contact> for details of the
attributes available for L<Teapot::Bot::Object::Contact> objects.
=head1 AUTHOR
Justin Hawkins <justin@eatmorecode.com>
=head1 COPYRIGHT AND LICENSE
=head1 LICENSE AND COPYRIGHT
This software is copyright (c) 2019 by Justin Hawkins.

View File

@@ -14,7 +14,8 @@ has 'mime_type';
has 'file_size';
sub fields {
return { scalar => [qw/file_id file_name mime_type file_size/],
return {
scalar => [qw/file_id file_name mime_type file_size/],
'Teapot::Bot::Object::PhotoSize' => [qw/thumb/]
};
}
@@ -36,6 +37,7 @@ Teapot::Bot::Object::Document - The base class for Telegram 'Document' objects
version 0.021
=head1 DESCRIPTION
The base class for Telegram 'Document' objects.
See L<https://core.telegram.org/bots/api#document> for details of the
attributes available for L<Teapot::Bot::Object::Document> objects.
@@ -44,7 +46,7 @@ attributes available for L<Teapot::Bot::Object::Document> objects.
Justin Hawkins <justin@eatmorecode.com>
=head1 COPYRIGHT AND LICENSE
=head1 LICENSE AND COPYRIGHT
This software is copyright (c) 2019 by Justin Hawkins.

View File

@@ -30,6 +30,7 @@ Teapot::Bot::Object::EncryptedCredentials - The base class for Telegram 'Encrypt
version 0.021
=head1 DESCRIPTION
The base class for Telegram 'EncryptedCredentials' type objects.
See L<https://core.telegram.org/bots/api#encryptedcredentials> for details of the
attributes available for L<Teapot::Bot::Object::EncryptedCredentials> objects.
@@ -38,7 +39,7 @@ attributes available for L<Teapot::Bot::Object::EncryptedCredentials> objects.
Justin Hawkins <justin@eatmorecode.com>
=head1 COPYRIGHT AND LICENSE
=head1 LICENSE AND COPYRIGHT
This software is copyright (c) 2019 by Justin Hawkins.

View File

@@ -36,6 +36,7 @@ Teapot::Bot::Object::EncryptedPassportElement - The base class for Telegram 'Enc
version 0.021
=head1 DESCRIPTION
The base class for Telegram 'EncryptedPassportElement' type objects.
See L<https://core.telegram.org/bots/api#encryptedpassportelement> for details of the
attributes available for L<Teapot::Bot::Object::EncryptedPassportElement> objects.
@@ -46,7 +47,7 @@ Note that this type is not yet fully implemented.
Justin Hawkins <justin@eatmorecode.com>
=head1 COPYRIGHT AND LICENSE
=head1 LICENSE AND COPYRIGHT
This software is copyright (c) 2019 by Justin Hawkins.

View File

@@ -17,7 +17,8 @@ has 'text_entities'; #Array of MessageEntity
has 'animation'; #Animation
sub fields {
return { scalar => [qw/title description text/],
return {
scalar => [qw/title description text/],
'Teapot::Bot::Object::PhotoSize' => [qw/photo/],
'Teapot::Bot::Object::MessageEntity' => [qw/text_entities/],
'Teapot::Bot::Object::Animation' => [qw/animation/],
@@ -36,13 +37,14 @@ __END__
=head1 NAME
Teapot::Bot::Object::Game - The base class for Telegram message 'Game' type.
Teapot::Bot::Object::Game - The base class for Telegram message 'Game' type
=head1 VERSION
version 0.021
=head1 DESCRIPTION
The base class for Telegram message 'Game' type.
See L<https://core.telegram.org/bots/api#game> for details of the
attributes available for L<Teapot::Bot::Object::Game> objects.
@@ -51,7 +53,7 @@ attributes available for L<Teapot::Bot::Object::Game> objects.
Justin Hawkins <justin@eatmorecode.com>
=head1 COPYRIGHT AND LICENSE
=head1 LICENSE AND COPYRIGHT
This software is copyright (c) 2019 by Justin Hawkins.

View File

@@ -17,11 +17,11 @@ has 'callback_game'; # CallbackGame
has 'pay';
sub fields {
return { 'scalar' => [qw/text url callback_data switch_inline_query
switch_inline_query_current_chat switch_inline_query_current_chat
pay/],
'Teapot::Bot::Object::LoginUrl' => [qw/login_url/],
'Teapot::Bot::Object::CallbackGame'=> [qw/callback_game/],
return { 'scalar' => [qw/text url callback_data switch_inline_query
switch_inline_query_current_chat switch_inline_query_current_chat
pay/],
'Teapot::Bot::Object::LoginUrl' => [qw/login_url/],
'Teapot::Bot::Object::CallbackGame' => [qw/callback_game/],
};
}
@@ -42,6 +42,7 @@ Teapot::Bot::Object::InlineKeyboardButton - The base class for Telegram 'InlineK
version 0.021
=head1 DESCRIPTION
The base class for Telegram 'InlineKeyboardButton' type objects.
See L<https://core.telegram.org/bots/api#inlinekeyboardbutton> for details of the
attributes available for L<Teapot::Bot::Object::InlineKeyboardButton> objects.
@@ -50,7 +51,7 @@ attributes available for L<Teapot::Bot::Object::InlineKeyboardButton> objects.
Justin Hawkins <justin@eatmorecode.com>
=head1 COPYRIGHT AND LICENSE
=head1 LICENSE AND COPYRIGHT
This software is copyright (c) 2019 by Justin Hawkins.

View File

@@ -9,12 +9,11 @@ $Teapot::Bot::Object::InlineKeyboardMarkup::VERSION = '0.021';
has 'inline_keyboard';
sub fields {
return { 'Teapot::Bot::Object::InlineKeyboardButton' => [qw/inline_keyboard/],
};
return { 'Teapot::Bot::Object::InlineKeyboardButton' => [qw/inline_keyboard/] };
}
sub array_of_arrays {
qw/inline_keyboard/;
return qw/inline_keyboard/;
}
1;
@@ -34,6 +33,7 @@ Teapot::Bot::Object::InlineKeyboardMarkup - The base class for Telegram 'InlineK
version 0.021
=head1 DESCRIPTION
The base class for Telegram 'InlineKeyboardMarkup' type objects.
See L<https://core.telegram.org/bots/api#inlinekeyboardmarkup> for details of the
attributes available for L<Teapot::Bot::Object::InlineKeyboardMarkup> objects.
@@ -42,7 +42,7 @@ attributes available for L<Teapot::Bot::Object::InlineKeyboardMarkup> objects.
Justin Hawkins <justin@eatmorecode.com>
=head1 COPYRIGHT AND LICENSE
=head1 LICENSE AND COPYRIGHT
This software is copyright (c) 2019 by Justin Hawkins.

View File

@@ -12,8 +12,7 @@ has 'currency';
has 'total_amount';
sub fields {
return { scalar => [qw/title description start_parameter currency total_amount/],
};
return { scalar => [qw/title description start_parameter currency total_amount/] };
}
1;
@@ -33,6 +32,7 @@ Teapot::Bot::Object::Invoice - The base class for Telegram 'Invoice' type object
version 0.021
=head1 DESCRIPTION
The base class for Telegram 'Invoice' type objects.
See L<https://core.telegram.org/bots/api#invoice> for details of the
attributes available for L<Teapot::Bot::Object::Invoice> objects.
@@ -41,7 +41,7 @@ attributes available for L<Teapot::Bot::Object::Invoice> objects.
Justin Hawkins <justin@eatmorecode.com>
=head1 COPYRIGHT AND LICENSE
=head1 LICENSE AND COPYRIGHT
This software is copyright (c) 2019 by Justin Hawkins.

View File

@@ -9,8 +9,7 @@ has 'longitude';
has 'latitude';
sub fields {
return { scalar => [qw/longitude latitude/],
};
return { scalar => [qw/longitude latitude/] };
}
1;
@@ -23,13 +22,14 @@ __END__
=head1 NAME
Teapot::Bot::Object::Location - The base class for Telegram message 'Location' type.
Teapot::Bot::Object::Location - The base class for Telegram message 'Location' type
=head1 VERSION
version 0.021
=head1 DESCRIPTION
The base class for Telegram message 'Location' type.
See L<https://core.telegram.org/bots/api#location> for details of the
attributes available for L<Teapot::Bot::Object::Location> objects.
@@ -38,7 +38,7 @@ attributes available for L<Teapot::Bot::Object::Location> objects.
Justin Hawkins <justin@eatmorecode.com>
=head1 COPYRIGHT AND LICENSE
=head1 LICENSE AND COPYRIGHT
This software is copyright (c) 2019 by Justin Hawkins.

View File

@@ -31,6 +31,7 @@ Teapot::Bot::Object::LoginUrl - The base class for Telegram 'LoginUrl' type obje
version 0.021
=head1 DESCRIPTION
The base class for Telegram 'LoginUrl' type objects.
See L<https://core.telegram.org/bots/api#loginurl> for details of the
attributes available for L<Teapot::Bot::Object::LoginUrl> objects.
@@ -39,7 +40,7 @@ attributes available for L<Teapot::Bot::Object::LoginUrl> objects.
Justin Hawkins <justin@eatmorecode.com>
=head1 COPYRIGHT AND LICENSE
=head1 LICENSE AND COPYRIGHT
This software is copyright (c) 2019 by Justin Hawkins.

View File

@@ -152,31 +152,38 @@ __END__
=head1 NAME
Teapot::Bot::Object::Message - The base class for the Telegram type "Message".
Teapot::Bot::Object::Message - The base class for the Telegram type "Message"
=head1 VERSION
version 0.021
=head1 DESCRIPTION
The base class for the Telegram type "Message".
See L<https://core.telegram.org/bots/api#message> for details of the
attributes available for L<Teapot::Bot::Object::Message> objects.
=head1 METHODS
=head2
=head2 reply
A convenience method to reply to a message with text.
Will return the L<Teapot::Bot::Object::Message> object representing the message
sent.
=head2 typing
Sends notification to chat that bot is "typing" something.
Returns nothing that should be checked.
=head1 AUTHOR
Justin Hawkins <justin@eatmorecode.com>
=head1 COPYRIGHT AND LICENSE
=head1 LICENSE AND COPYRIGHT
This software is copyright (c) 2019 by Justin Hawkins.

View File

@@ -15,9 +15,9 @@ has 'language'; # Optional. For “pre” only, the programming language of the
sub fields {
return {
'scalar' => [qw/type offset length url language/],
'Teapot::Bot::Object::User' => [qw/user/],
};
'scalar' => [qw/type offset length url language/],
'Teapot::Bot::Object::User' => [qw/user/],
};
}
1;
@@ -37,6 +37,7 @@ Teapot::Bot::Object::MessageEntity - The base class for Telegram 'MessageEntity'
version 0.021
=head1 DESCRIPTION
The base class for Telegram 'MessageEntity' type objects.
See L<https://core.telegram.org/bots/api#messageentity> for details of the
attributes available for L<Teapot::Bot::Object::MessageEntity> objects.
@@ -45,7 +46,7 @@ attributes available for L<Teapot::Bot::Object::MessageEntity> objects.
Justin Hawkins <justin@eatmorecode.com>
=head1 COPYRIGHT AND LICENSE
=head1 LICENSE AND COPYRIGHT
This software is copyright (c) 2019 by Justin Hawkins.

View File

@@ -11,8 +11,9 @@ has 'data'; # Array of EncryptedPassportElement
has 'credentials'; # EncryptedCredentials
sub fields {
return { 'Teapot::Bot::Object::EncryptedPassportElement' => [qw/data/],
'Teapot::Bot::Object::EncryptedCredentials' => [qw/credentials/],
return {
'Teapot::Bot::Object::EncryptedPassportElement' => [qw/data/],
'Teapot::Bot::Object::EncryptedCredentials' => [qw/credentials/],
};
}
@@ -37,6 +38,7 @@ Teapot::Bot::Object::PassportData - The base class for Telegram 'PassportData' t
version 0.021
=head1 DESCRIPTION
The base class for Telegram 'PassportData' type objects.
See L<https://core.telegram.org/bots/api#passportdata> for details of the
attributes available for L<Teapot::Bot::Object::PassportData> objects.
@@ -45,7 +47,7 @@ attributes available for L<Teapot::Bot::Object::PassportData> objects.
Justin Hawkins <justin@eatmorecode.com>
=head1 COPYRIGHT AND LICENSE
=head1 LICENSE AND COPYRIGHT
This software is copyright (c) 2019 by Justin Hawkins.

View File

@@ -12,8 +12,7 @@ has 'height';
has 'file_size';
sub fields {
return { scalar => [qw/file_id width height file_size/]
};
return { scalar => [qw/file_id width height file_size/] };
}
1;
@@ -26,13 +25,14 @@ __END__
=head1 NAME
Teapot::Bot::Object::PhotoSize - The base class for Telegram message 'PhotoSize' type.
Teapot::Bot::Object::PhotoSize - The base class for Telegram message 'PhotoSize' type
=head1 VERSION
version 0.021
=head1 DESCRIPTION
The base class for Telegram message 'PhotoSize' type.
See L<https://core.telegram.org/bots/api#photosize> for details of the
attributes available for L<Teapot::Bot::Object::PhotoSize> objects.
@@ -41,7 +41,7 @@ attributes available for L<Teapot::Bot::Object::PhotoSize> objects.
Justin Hawkins <justin@eatmorecode.com>
=head1 COPYRIGHT AND LICENSE
=head1 LICENSE AND COPYRIGHT
This software is copyright (c) 2019 by Justin Hawkins.

View File

@@ -12,9 +12,9 @@ has 'options'; # Array of PollOption
has 'is_closed';
sub fields {
return { scalar => [qw/id question is_closed/],
'Teapot::Bot::Object::PollOption' => [qw/options /],
return {
scalar => [qw/id question is_closed/],
'Teapot::Bot::Object::PollOption' => [qw/options/],
};
}
@@ -39,6 +39,7 @@ Teapot::Bot::Object::Poll - The base class for Telegram 'Poll' type objects
version 0.021
=head1 DESCRIPTION
The base class for Telegram 'Poll' type objects
See L<https://core.telegram.org/bots/api#poll> for details of the
attributes available for L<Teapot::Bot::Object::Poll> objects.
@@ -47,7 +48,7 @@ attributes available for L<Teapot::Bot::Object::Poll> objects.
Justin Hawkins <justin@eatmorecode.com>
=head1 COPYRIGHT AND LICENSE
=head1 LICENSE AND COPYRIGHT
This software is copyright (c) 2019 by Justin Hawkins.

View File

@@ -9,8 +9,7 @@ has 'text';
has 'voter_count';
sub fields {
return { scalar => [qw/text voter_count/],
};
return { scalar => [qw/text voter_count/] };
}
1;
@@ -30,6 +29,7 @@ Teapot::Bot::Object::PollOption - The base class for Telegram 'PollOption' type
version 0.021
=head1 DESCRIPTION
The base class for Telegram 'PollOption' type objects.
See L<https://core.telegram.org/bots/api#polloption> for details of the
attributes available for L<Teapot::Bot::Object::PollOption> objects.
@@ -38,7 +38,7 @@ attributes available for L<Teapot::Bot::Object::PollOption> objects.
Justin Hawkins <justin@eatmorecode.com>
=head1 COPYRIGHT AND LICENSE
=head1 LICENSE AND COPYRIGHT
This software is copyright (c) 2019 by Justin Hawkins.

View File

@@ -16,8 +16,8 @@ has 'set_name';
has 'file_size';
sub fields {
return { scalar => [qw/file_id width height emoji
set_name file_size /],
return {
scalar => [ qw/file_id width height emoji set_name file_size/ ],
'Teapot::Bot::Object::PhotoSize' => [ qw/thumb/ ],
};
}
@@ -32,13 +32,14 @@ __END__
=head1 NAME
Teapot::Bot::Object::Sticker - The base class for Telegram message 'Sticker' type.
Teapot::Bot::Object::Sticker - The base class for Telegram message 'Sticker' type
=head1 VERSION
version 0.021
=head1 DESCRIPTION
The base class for Telegram message 'Sticker' type.
See L<https://core.telegram.org/bots/api#sticker> for details of the
attributes available for L<Teapot::Bot::Object::Sticker> objects.
@@ -47,7 +48,7 @@ attributes available for L<Teapot::Bot::Object::Sticker> objects.
Justin Hawkins <justin@eatmorecode.com>
=head1 COPYRIGHT AND LICENSE
=head1 LICENSE AND COPYRIGHT
This software is copyright (c) 2019 by Justin Hawkins.

View File

@@ -15,10 +15,10 @@ has 'telegram_payment_charge_id';
has 'provider_payment_charge_id';
sub fields {
return { scalar => [qw/currency total_amount invoice_payload shipping_option_id
telegram_payment_charge_id provider_payment_charge_id/],
# 'Teapot::Bot::Object::OrderInfo' => [qw/order_info/],
return {
scalar => [qw/currency total_amount invoice_payload shipping_option_id
telegram_payment_charge_id provider_payment_charge_id/],
# 'Teapot::Bot::Object::OrderInfo' => [qw/order_info/],
};
}
@@ -39,6 +39,7 @@ Teapot::Bot::Object::SuccessfulPayment - The base class for Telegram 'Successful
version 0.021
=head1 DESCRIPTION
The base class for Telegram 'SuccessfulPayment' type objects.
See L<https://core.telegram.org/bots/api#successfulpayment> for details of the
attributes available for L<Teapot::Bot::Object::SuccessfulPayment> objects.
@@ -47,7 +48,7 @@ attributes available for L<Teapot::Bot::Object::SuccessfulPayment> objects.
Justin Hawkins <justin@eatmorecode.com>
=head1 COPYRIGHT AND LICENSE
=head1 LICENSE AND COPYRIGHT
This software is copyright (c) 2019 by Justin Hawkins.

View File

@@ -17,7 +17,8 @@ has 'can_read_all_group_messages';# optional, only for getMe() method
has 'supports_inline_queries'; # optional, only for getMe() method
sub fields {
return { scalar => [qw/id is_bot first_name last_name username language_code can_join_groups
return {
scalar => [qw/id is_bot first_name last_name username language_code can_join_groups
can_read_all_group_messages supports_inline_queries/]
};
}
@@ -32,13 +33,14 @@ __END__
=head1 NAME
Teapot::Bot::Object::User - The base class for Telegram message 'User' type.
Teapot::Bot::Object::User - The base class for Telegram message 'User' type
=head1 VERSION
version 0.021
=head1 DESCRIPTION
The base class for Telegram message 'User' type.
See L<https://core.telegram.org/bots/api#user> for details of the
attributes available for L<Teapot::Bot::Object::User> objects.
@@ -47,7 +49,7 @@ attributes available for L<Teapot::Bot::Object::User> objects.
Justin Hawkins <justin@eatmorecode.com>
=head1 COPYRIGHT AND LICENSE
=head1 LICENSE AND COPYRIGHT
This software is copyright (c) 2019 by Justin Hawkins.

View File

@@ -13,9 +13,10 @@ has 'foursquare_id';
has 'foursquare_type';
sub fields {
return { 'scalar' => [qw/title address
foursquare_id foursquare_type/],
'Teapot::Bot::Object::Location' => [qw/location/] };
return {
'scalar' => [qw/title address foursquare_id foursquare_type/],
'Teapot::Bot::Object::Location' => [qw/location/]
};
}
@@ -36,6 +37,7 @@ Teapot::Bot::Object::Venue - The base class for Telegram 'LoginUrl' type objects
version 0.021
=head1 DESCRIPTION
The base class for Telegram 'LoginUrl' type objects.
See L<https://core.telegram.org/bots/api#venue> for details of the
attributes available for L<Teapot::Bot::Object::Venue> objects.
@@ -44,7 +46,7 @@ attributes available for L<Teapot::Bot::Object::Venue> objects.
Justin Hawkins <justin@eatmorecode.com>
=head1 COPYRIGHT AND LICENSE
=head1 LICENSE AND COPYRIGHT
This software is copyright (c) 2019 by Justin Hawkins.

View File

@@ -15,8 +15,8 @@ has 'mime_type';
has 'file_size';
sub fields {
return { scalar => [qw/file_id width height duration
mime_type file_size /],
return {
scalar => [qw/file_id width height duration mime_type file_size/],
'Teapot::Bot::Object::PhotoSize' => [qw/thumb/]
};
}
@@ -31,13 +31,14 @@ __END__
=head1 NAME
Teapot::Bot::Object::Video - The base class for Telegram 'Video' object.
Teapot::Bot::Object::Video - The base class for Telegram 'Video' object
=head1 VERSION
version 0.021
=head1 DESCRIPTION
The base class for Telegram 'Video' object.
See L<https://core.telegram.org/bots/api#video> for details of the
attributes available for L<Teapot::Bot::Object::Video> objects.
@@ -46,7 +47,7 @@ attributes available for L<Teapot::Bot::Object::Video> objects.
Justin Hawkins <justin@eatmorecode.com>
=head1 COPYRIGHT AND LICENSE
=head1 LICENSE AND COPYRIGHT
This software is copyright (c) 2019 by Justin Hawkins.

View File

@@ -15,9 +15,9 @@ has 'thumb'; #PhotoSize
has 'file_size';
sub fields {
return { scalar => [qw/file_id length duration mime_type file_size/],
return {
scalar => [qw/file_id length duration mime_type file_size/],
'Teapot::Bot::Object::PhotoSize' => [qw/thumb /],
};
}
@@ -38,6 +38,7 @@ Teapot::Bot::Object::VideoNote - The base class for Telegram 'VideoNote' type ob
version 0.021
=head1 DESCRIPTION
The base class for Telegram 'VideoNote' type object.
See L<https://core.telegram.org/bots/api#videonote> for details of the
attributes available for L<Teapot::Bot::Object::VideoNote> objects.
@@ -46,7 +47,7 @@ attributes available for L<Teapot::Bot::Object::VideoNote> objects.
Justin Hawkins <justin@eatmorecode.com>
=head1 COPYRIGHT AND LICENSE
=head1 LICENSE AND COPYRIGHT
This software is copyright (c) 2019 by Justin Hawkins.

View File

@@ -11,8 +11,7 @@ has 'mime_type';
has 'file_size';
sub fields {
return { scalar => [qw/file_id duration mime_type file_size/]
};
return { scalar => [qw/file_id duration mime_type file_size/] };
}
1;
@@ -32,6 +31,7 @@ Teapot::Bot::Object::Voice - The base class for Telegram 'Voice' type objects
version 0.021
=head1 DESCRIPTION
The base class for Telegram 'Voice' type objects.
See L<https://core.telegram.org/bots/api#voice> for details of the
attributes available for L<Teapot::Bot::Object::Voice> objects.
@@ -40,7 +40,7 @@ attributes available for L<Teapot::Bot::Object::Voice> objects.
Justin Hawkins <justin@eatmorecode.com>
=head1 COPYRIGHT AND LICENSE
=head1 LICENSE AND COPYRIGHT
This software is copyright (c) 2019 by Justin Hawkins.