Now Telegram::Bot is Teapot::Bot
This commit is contained in:
58
lib/Teapot/Bot/Object/Animation.pm
Normal file
58
lib/Teapot/Bot/Object/Animation.pm
Normal file
@@ -0,0 +1,58 @@
|
||||
package Teapot::Bot::Object::Animation;
|
||||
$Teapot::Bot::Object::Animation::VERSION = '0.021';
|
||||
# ABSTRACT: The base class for Telegram message 'Animation' type.
|
||||
|
||||
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
use Teapot::Bot::Object::PhotoSize;
|
||||
use Carp qw/croak/;
|
||||
|
||||
has 'file_id';
|
||||
has 'width';
|
||||
has 'height';
|
||||
has 'duration';
|
||||
has 'thumb'; #PhotoSize
|
||||
has 'file_name';
|
||||
has 'mime_type';
|
||||
has 'file_size';
|
||||
|
||||
sub fields {
|
||||
return { scalar => [qw/file_id width height duration file_name mime_type file_size/],
|
||||
'Teapot::Bot::Object::PhotoSize' => [qw/thumb/],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=pod
|
||||
|
||||
=encoding UTF-8
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Teapot::Bot::Object::Animation - The base class for Telegram message 'Animation' type.
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.021
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
See L<https://core.telegram.org/bots/api#animation> for details of the
|
||||
attributes available for L<Teapot::Bot::Object::Animation> objects.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Justin Hawkins <justin@eatmorecode.com>
|
||||
|
||||
=head1 COPYRIGHT AND LICENSE
|
||||
|
||||
This software is copyright (c) 2019 by Justin Hawkins.
|
||||
|
||||
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/Audio.pm
Normal file
54
lib/Teapot/Bot/Object/Audio.pm
Normal file
@@ -0,0 +1,54 @@
|
||||
package Teapot::Bot::Object::Audio;
|
||||
$Teapot::Bot::Object::Audio::VERSION = '0.021';
|
||||
# ABSTRACT: The base class for Telegram 'Audio' type objects
|
||||
|
||||
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
|
||||
has 'file_id';
|
||||
has 'duration';
|
||||
has 'performer';
|
||||
has 'title';
|
||||
has 'mime_type';
|
||||
has 'file_size';
|
||||
has 'thumb'; #PhotoSize
|
||||
|
||||
sub fields {
|
||||
return { scalar => [qw/file_id duration performer title mime_type file_size/],
|
||||
'Teapot::Bot::Object::PhotoSize' => [qw/thumb/],
|
||||
};
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=pod
|
||||
|
||||
=encoding UTF-8
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Teapot::Bot::Object::Audio - The base class for Telegram 'Audio' type objects
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.021
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
See L<https://core.telegram.org/bots/api#audio> for details of the
|
||||
attributes available for L<Teapot::Bot::Object::Audio> objects.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Justin Hawkins <justin@eatmorecode.com>
|
||||
|
||||
=head1 COPYRIGHT AND LICENSE
|
||||
|
||||
This software is copyright (c) 2019 by Justin Hawkins.
|
||||
|
||||
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
|
||||
180
lib/Teapot/Bot/Object/Base.pm
Normal file
180
lib/Teapot/Bot/Object/Base.pm
Normal file
@@ -0,0 +1,180 @@
|
||||
package Teapot::Bot::Object::Base;
|
||||
$Teapot::Bot::Object::Base::VERSION = '0.021';
|
||||
# ABSTRACT: The base class for all Teapot::Bot::Object objects.
|
||||
|
||||
|
||||
use Mojo::Base -base;
|
||||
|
||||
has '_brain'; # a reference to our brain
|
||||
|
||||
|
||||
sub arrays { qw// } # override if needed
|
||||
sub _field_is_array {
|
||||
my $self = shift;
|
||||
my $field = shift;
|
||||
if (grep /^$field$/, $self->arrays) {
|
||||
return 1;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
sub array_of_arrays { qw// } #override if needed
|
||||
sub _field_is_array_of_arrays {
|
||||
my $self = shift;
|
||||
my $field = shift;
|
||||
if (grep /^$field$/, $self->array_of_arrays) {
|
||||
return 1;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
# create an object from a hash. Needs to deal with the nested types, and
|
||||
# arrays
|
||||
sub create_from_hash {
|
||||
my $class = shift;
|
||||
my $hash = shift;
|
||||
my $brain = shift || die "no brain supplied";
|
||||
my $obj = $class->new(_brain => $brain);
|
||||
|
||||
# deal with each type of field
|
||||
foreach my $type (keys %{ $class->fields }) {
|
||||
my @fields_of_this_type = @{ $class->fields->{$type} };
|
||||
|
||||
foreach my $field (@fields_of_this_type) {
|
||||
|
||||
# ignore fields for which we have no value in the hash
|
||||
next if (! defined $hash->{$field} );
|
||||
|
||||
# warn "type: $type field $field\n";
|
||||
if ($type eq 'scalar') {
|
||||
if ($obj->_field_is_array($field)) {
|
||||
# simple scalar array ref, so just copy it
|
||||
my $val = $hash->{$field};
|
||||
# deal with boolean stuff so we don't pollute our object
|
||||
# with JSON
|
||||
if (ref($val) eq 'JSON::PP::Boolean') {
|
||||
$val = !!$val;
|
||||
}
|
||||
$obj->$field($val);
|
||||
}
|
||||
elsif ($obj->_field_is_array_of_arrays) {
|
||||
die "not yet implemented for scalars";
|
||||
}
|
||||
else {
|
||||
my $val = $hash->{$field};
|
||||
if (ref($val) eq 'JSON::PP::Boolean') {
|
||||
$val = 0+$val;
|
||||
|
||||
}
|
||||
$obj->$field($val);
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
if ($obj->_field_is_array($field)) {
|
||||
my @sub_array;
|
||||
foreach my $data ( @{ $hash->{$field} } ) {
|
||||
push @sub_array, $type->create_from_hash($data, $brain);
|
||||
}
|
||||
$obj->$field(\@sub_array);
|
||||
}
|
||||
elsif ($obj->_field_is_array_of_arrays) {
|
||||
die "not yet implemented for scalars";
|
||||
}
|
||||
else {
|
||||
$obj->$field($type->create_from_hash($hash->{$field}, $brain));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $obj;
|
||||
}
|
||||
|
||||
|
||||
sub as_hashref {
|
||||
my $self = shift;
|
||||
my $hash = {};
|
||||
# add the simple scalar values
|
||||
foreach my $type ( keys %{ $self->fields }) {
|
||||
my @fields = @{ $self->fields->{$type} };
|
||||
foreach my $field (@fields) {
|
||||
if ($type eq 'scalar') {
|
||||
$hash->{$field} = $self->$field;
|
||||
}
|
||||
else {
|
||||
# non array types
|
||||
$hash->{$field} = $self->$field->as_hashref
|
||||
if (ref($self->$field) ne 'ARRAY' && defined $self->$field);
|
||||
# array types
|
||||
$hash->{$field} = [
|
||||
map { $_->as_hashref } @{ $self->$field }
|
||||
] if (ref($self->$field) eq 'ARRAY');
|
||||
}
|
||||
}
|
||||
}
|
||||
return $hash;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=pod
|
||||
|
||||
=encoding UTF-8
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Teapot::Bot::Object::Base - The base class for all Telegram::Bot::Object objects.
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.021
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
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>,
|
||||
instead the appropriate objects will be created from an incoming request via
|
||||
L<Teapot::Bot::Brain>.
|
||||
|
||||
You can then use the methods referenced below on those objects.
|
||||
|
||||
=head1 METHODS
|
||||
|
||||
=head2 arrays
|
||||
|
||||
Should be overridden by subclasses, returning an array listing of which fields
|
||||
for the object are arrays.
|
||||
|
||||
=head2 array_of_arrays
|
||||
|
||||
Should be overridden by subclasses, returning an array listing od which fields
|
||||
for the object are arrays of arrays.
|
||||
|
||||
=head2 create_from_hash
|
||||
|
||||
Create an object of the appropriate class, including any sub-objects of
|
||||
other types, as needed.
|
||||
|
||||
=head2 as_hashref
|
||||
|
||||
Return this object as a hashref.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Justin Hawkins <justin@eatmorecode.com>
|
||||
|
||||
=head1 COPYRIGHT AND LICENSE
|
||||
|
||||
This software is copyright (c) 2019 by Justin Hawkins.
|
||||
|
||||
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
|
||||
47
lib/Teapot/Bot/Object/CallbackGame.pm
Normal file
47
lib/Teapot/Bot/Object/CallbackGame.pm
Normal file
@@ -0,0 +1,47 @@
|
||||
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';
|
||||
|
||||
# https://core.telegram.org/bots/api#callbackgame
|
||||
# "A placeholder, currently holds no information. Use BotFather to set up your game"
|
||||
|
||||
sub fields {
|
||||
return { },
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=pod
|
||||
|
||||
=encoding UTF-8
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Teapot::Bot::Object::CallbackGame - The base class for Telegram message 'CallbackGame' type.
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.021
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
See L<https://core.telegram.org/bots/api#callbackgame> for details of the
|
||||
attributes available for L<Teapot::Bot::Object::CallbackGame> objects.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Justin Hawkins <justin@eatmorecode.com>
|
||||
|
||||
=head1 COPYRIGHT AND LICENSE
|
||||
|
||||
This software is copyright (c) 2019 by Justin Hawkins.
|
||||
|
||||
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
|
||||
87
lib/Teapot/Bot/Object/Chat.pm
Normal file
87
lib/Teapot/Bot/Object/Chat.pm
Normal file
@@ -0,0 +1,87 @@
|
||||
package Teapot::Bot::Object::Chat;
|
||||
$Teapot::Bot::Object::Chat::VERSION = '0.021';
|
||||
# ABSTRACT: The base class for Telegram 'Chat' type objects
|
||||
|
||||
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
use Teapot::Bot::Object::ChatPhoto;
|
||||
use Teapot::Bot::Object::Message;
|
||||
|
||||
has 'id';
|
||||
has 'type';
|
||||
has 'title';
|
||||
has 'username';
|
||||
has 'first_name';
|
||||
has 'last_name';
|
||||
has 'all_members_are_administrators';
|
||||
has 'photo'; #ChatPhoto
|
||||
has 'description';
|
||||
has 'invite_link';
|
||||
has 'pinned_message'; #Message
|
||||
has 'sticker_set_name';
|
||||
has 'can_set_sticker_set';
|
||||
|
||||
sub fields {
|
||||
return {
|
||||
'scalar' => [qw/id type title username first_name
|
||||
last_name all_members_are_administrators
|
||||
description invite_link sticker_set_name
|
||||
can_set_sticker_set/],
|
||||
'Teapot::Bot::Object::ChatPhoto' => [qw/photo/],
|
||||
'Teapot::Bot::Object::Message' => [qw/pinned_message/],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
sub is_user {
|
||||
shift->id > 0;
|
||||
}
|
||||
|
||||
|
||||
sub is_group {
|
||||
shift->id < 0;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=pod
|
||||
|
||||
=encoding UTF-8
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Teapot::Bot::Object::Chat - The base class for Telegram 'Chat' type objects
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.021
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
See L<https://core.telegram.org/bots/api#chat> for details of the
|
||||
attributes available for L<Teapot::Bot::Object::Chat> objects.
|
||||
|
||||
=head1 METHODS
|
||||
|
||||
=head2 is_user
|
||||
|
||||
Returns true is this is a chat is a single user.
|
||||
|
||||
=head2 is_group
|
||||
|
||||
Returns true if this is a chat is a group.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Justin Hawkins <justin@eatmorecode.com>
|
||||
|
||||
=head1 COPYRIGHT AND LICENSE
|
||||
|
||||
This software is copyright (c) 2019 by Justin Hawkins.
|
||||
|
||||
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
|
||||
49
lib/Teapot/Bot/Object/ChatPhoto.pm
Normal file
49
lib/Teapot/Bot/Object/ChatPhoto.pm
Normal file
@@ -0,0 +1,49 @@
|
||||
package Teapot::Bot::Object::ChatPhoto;
|
||||
$Teapot::Bot::Object::ChatPhoto::VERSION = '0.021';
|
||||
# ABSTRACT: The base class for Telegram 'ChatPhoto' type objects
|
||||
|
||||
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
|
||||
has 'small_file_id';
|
||||
has 'big_file_id';
|
||||
|
||||
sub fields {
|
||||
return {
|
||||
'scalar' => [qw/small_file_id big_file_id/],
|
||||
};
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=pod
|
||||
|
||||
=encoding UTF-8
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Teapot::Bot::Object::ChatPhoto - The base class for Telegram 'ChatPhoto' type objects
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.021
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
See L<https://core.telegram.org/bots/api#chatphoto> for details of the
|
||||
attributes available for L<Teapot::Bot::Object::ChatPhoto> objects.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Justin Hawkins <justin@eatmorecode.com>
|
||||
|
||||
=head1 COPYRIGHT AND LICENSE
|
||||
|
||||
This software is copyright (c) 2019 by Justin Hawkins.
|
||||
|
||||
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
|
||||
50
lib/Teapot/Bot/Object/Contact.pm
Normal file
50
lib/Teapot/Bot/Object/Contact.pm
Normal file
@@ -0,0 +1,50 @@
|
||||
package Teapot::Bot::Object::Contact;
|
||||
$Teapot::Bot::Object::Contact::VERSION = '0.021';
|
||||
# ABSTRACT: The base class for Telegram 'Contact' objects.
|
||||
|
||||
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
|
||||
has 'phone_number';
|
||||
has 'first_name';
|
||||
has 'last_name';
|
||||
has 'user_id';
|
||||
|
||||
sub fields {
|
||||
return { scalar => [qw/phone_number first_name last_name user_id/],
|
||||
};
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=pod
|
||||
|
||||
=encoding UTF-8
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Teapot::Bot::Object::Contact - The base class for Telegram 'Contact' objects.
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.021
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
See L<https://core.telegram.org/bots/api#chat> for details of the
|
||||
attributes available for L<Teapot::Bot::Object::Contact> objects.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Justin Hawkins <justin@eatmorecode.com>
|
||||
|
||||
=head1 COPYRIGHT AND LICENSE
|
||||
|
||||
This software is copyright (c) 2019 by Justin Hawkins.
|
||||
|
||||
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/Document.pm
Normal file
54
lib/Teapot/Bot/Object/Document.pm
Normal file
@@ -0,0 +1,54 @@
|
||||
package Teapot::Bot::Object::Document;
|
||||
$Teapot::Bot::Object::Document::VERSION = '0.021';
|
||||
# ABSTRACT: The base class for Telegram 'Document' objects
|
||||
|
||||
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
|
||||
use Teapot::Bot::Object::PhotoSize;
|
||||
|
||||
has 'file_id';
|
||||
has 'thumb'; #PhotoSize
|
||||
has 'file_name';
|
||||
has 'mime_type';
|
||||
has 'file_size';
|
||||
|
||||
sub fields {
|
||||
return { scalar => [qw/file_id file_name mime_type file_size/],
|
||||
'Teapot::Bot::Object::PhotoSize' => [qw/thumb/]
|
||||
};
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=pod
|
||||
|
||||
=encoding UTF-8
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Teapot::Bot::Object::Document - The base class for Telegram 'Document' objects
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.021
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
See L<https://core.telegram.org/bots/api#document> for details of the
|
||||
attributes available for L<Teapot::Bot::Object::Document> objects.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Justin Hawkins <justin@eatmorecode.com>
|
||||
|
||||
=head1 COPYRIGHT AND LICENSE
|
||||
|
||||
This software is copyright (c) 2019 by Justin Hawkins.
|
||||
|
||||
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
|
||||
48
lib/Teapot/Bot/Object/EncryptedCredentials.pm
Normal file
48
lib/Teapot/Bot/Object/EncryptedCredentials.pm
Normal file
@@ -0,0 +1,48 @@
|
||||
package Teapot::Bot::Object::EncryptedCredentials;
|
||||
$Teapot::Bot::Object::EncryptedCredentials::VERSION = '0.021';
|
||||
# ABSTRACT: The base class for Telegram 'EncryptedCredentials' type objects
|
||||
|
||||
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
|
||||
has 'data';
|
||||
has 'hash';
|
||||
has 'secret';
|
||||
|
||||
sub fields {
|
||||
return { 'scalar' => [qw/ data hash secret/] };
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=pod
|
||||
|
||||
=encoding UTF-8
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Teapot::Bot::Object::EncryptedCredentials - The base class for Telegram 'EncryptedCredentials' type objects
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.021
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
See L<https://core.telegram.org/bots/api#encryptedcredentials> for details of the
|
||||
attributes available for L<Teapot::Bot::Object::EncryptedCredentials> objects.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Justin Hawkins <justin@eatmorecode.com>
|
||||
|
||||
=head1 COPYRIGHT AND LICENSE
|
||||
|
||||
This software is copyright (c) 2019 by Justin Hawkins.
|
||||
|
||||
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
|
||||
56
lib/Teapot/Bot/Object/EncryptedPassportElement.pm
Normal file
56
lib/Teapot/Bot/Object/EncryptedPassportElement.pm
Normal file
@@ -0,0 +1,56 @@
|
||||
package Teapot::Bot::Object::EncryptedPassportElement;
|
||||
$Teapot::Bot::Object::EncryptedPassportElement::VERSION = '0.021';
|
||||
# ABSTRACT: The base class for Telegram 'EncryptedPassportElement' type objects
|
||||
|
||||
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
|
||||
# XXX Implement rest of this
|
||||
# https://core.telegram.org/bots/api#encryptedpassportelement
|
||||
|
||||
has 'type';
|
||||
has 'data';
|
||||
has 'phone_number';
|
||||
has 'email';
|
||||
|
||||
# XXX more here
|
||||
|
||||
sub fields {
|
||||
return { 'scalar' => [qw/type data phone_number email/] };
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=pod
|
||||
|
||||
=encoding UTF-8
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Teapot::Bot::Object::EncryptedPassportElement - The base class for Telegram 'EncryptedPassportElement' type objects
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.021
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
See L<https://core.telegram.org/bots/api#encryptedpassportelement> for details of the
|
||||
attributes available for L<Teapot::Bot::Object::EncryptedPassportElement> objects.
|
||||
|
||||
Note that this type is not yet fully implemented.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Justin Hawkins <justin@eatmorecode.com>
|
||||
|
||||
=head1 COPYRIGHT AND LICENSE
|
||||
|
||||
This software is copyright (c) 2019 by Justin Hawkins.
|
||||
|
||||
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
|
||||
60
lib/Teapot/Bot/Object/Game.pm
Normal file
60
lib/Teapot/Bot/Object/Game.pm
Normal file
@@ -0,0 +1,60 @@
|
||||
package Teapot::Bot::Object::Game;
|
||||
$Teapot::Bot::Object::Game::VERSION = '0.021';
|
||||
# ABSTRACT: The base class for Telegram message 'Game' type.
|
||||
|
||||
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
use Teapot::Bot::Object::PhotoSize;
|
||||
use Teapot::Bot::Object::Animation;
|
||||
use Teapot::Bot::Object::MessageEntity;
|
||||
|
||||
has 'title';
|
||||
has 'description';
|
||||
has 'photo'; # Array of PhotoSize
|
||||
has 'text';
|
||||
has 'text_entities'; #Array of MessageEntity
|
||||
has 'animation'; #Animation
|
||||
|
||||
sub fields {
|
||||
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/],
|
||||
};
|
||||
}
|
||||
|
||||
sub arrays { qw/photo text_entities/ }
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=pod
|
||||
|
||||
=encoding UTF-8
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Teapot::Bot::Object::Game - The base class for Telegram message 'Game' type.
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.021
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
See L<https://core.telegram.org/bots/api#game> for details of the
|
||||
attributes available for L<Teapot::Bot::Object::Game> objects.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Justin Hawkins <justin@eatmorecode.com>
|
||||
|
||||
=head1 COPYRIGHT AND LICENSE
|
||||
|
||||
This software is copyright (c) 2019 by Justin Hawkins.
|
||||
|
||||
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
|
||||
60
lib/Teapot/Bot/Object/InlineKeyboardButton.pm
Normal file
60
lib/Teapot/Bot/Object/InlineKeyboardButton.pm
Normal file
@@ -0,0 +1,60 @@
|
||||
package Teapot::Bot::Object::InlineKeyboardButton;
|
||||
$Teapot::Bot::Object::InlineKeyboardButton::VERSION = '0.021';
|
||||
# ABSTRACT: The base class for Telegram 'InlineKeyboardButton' type objects
|
||||
|
||||
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
use Teapot::Bot::Object::LoginUrl;
|
||||
use Teapot::Bot::Object::CallbackGame;
|
||||
|
||||
has 'text';
|
||||
has 'url';
|
||||
has 'login_url'; #LoginUrl
|
||||
has 'callback_data';
|
||||
has 'switch_inline_query';
|
||||
has 'switch_inline_query_current_chat';
|
||||
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/],
|
||||
};
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=pod
|
||||
|
||||
=encoding UTF-8
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Teapot::Bot::Object::InlineKeyboardButton - The base class for Telegram 'InlineKeyboardButton' type objects
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.021
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
See L<https://core.telegram.org/bots/api#inlinekeyboardbutton> for details of the
|
||||
attributes available for L<Teapot::Bot::Object::InlineKeyboardButton> objects.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Justin Hawkins <justin@eatmorecode.com>
|
||||
|
||||
=head1 COPYRIGHT AND LICENSE
|
||||
|
||||
This software is copyright (c) 2019 by Justin Hawkins.
|
||||
|
||||
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
|
||||
52
lib/Teapot/Bot/Object/InlineKeyboardMarkup.pm
Normal file
52
lib/Teapot/Bot/Object/InlineKeyboardMarkup.pm
Normal file
@@ -0,0 +1,52 @@
|
||||
package Teapot::Bot::Object::InlineKeyboardMarkup;
|
||||
$Teapot::Bot::Object::InlineKeyboardMarkup::VERSION = '0.021';
|
||||
# ABSTRACT: The base class for Telegram 'InlineKeyboardMarkup' type objects
|
||||
|
||||
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
use Teapot::Bot::Object::InlineKeyboardButton;
|
||||
|
||||
has 'inline_keyboard';
|
||||
|
||||
sub fields {
|
||||
return { 'Teapot::Bot::Object::InlineKeyboardButton' => [qw/inline_keyboard/],
|
||||
};
|
||||
}
|
||||
|
||||
sub array_of_arrays {
|
||||
qw/inline_keyboard/;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=pod
|
||||
|
||||
=encoding UTF-8
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Teapot::Bot::Object::InlineKeyboardMarkup - The base class for Telegram 'InlineKeyboardMarkup' type objects
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.021
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
See L<https://core.telegram.org/bots/api#inlinekeyboardmarkup> for details of the
|
||||
attributes available for L<Teapot::Bot::Object::InlineKeyboardMarkup> objects.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Justin Hawkins <justin@eatmorecode.com>
|
||||
|
||||
=head1 COPYRIGHT AND LICENSE
|
||||
|
||||
This software is copyright (c) 2019 by Justin Hawkins.
|
||||
|
||||
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/Invoice.pm
Normal file
51
lib/Teapot/Bot/Object/Invoice.pm
Normal file
@@ -0,0 +1,51 @@
|
||||
package Teapot::Bot::Object::Invoice;
|
||||
$Teapot::Bot::Object::Invoice::VERSION = '0.021';
|
||||
# ABSTRACT: The base class for Telegram 'Invoice' type objects
|
||||
|
||||
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
|
||||
has 'title';
|
||||
has 'description';
|
||||
has 'start_parameter';
|
||||
has 'currency';
|
||||
has 'total_amount';
|
||||
|
||||
sub fields {
|
||||
return { scalar => [qw/title description start_parameter currency total_amount/],
|
||||
};
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=pod
|
||||
|
||||
=encoding UTF-8
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Teapot::Bot::Object::Invoice - The base class for Telegram 'Invoice' type objects
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.021
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
See L<https://core.telegram.org/bots/api#invoice> for details of the
|
||||
attributes available for L<Teapot::Bot::Object::Invoice> objects.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Justin Hawkins <justin@eatmorecode.com>
|
||||
|
||||
=head1 COPYRIGHT AND LICENSE
|
||||
|
||||
This software is copyright (c) 2019 by Justin Hawkins.
|
||||
|
||||
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
|
||||
48
lib/Teapot/Bot/Object/Location.pm
Normal file
48
lib/Teapot/Bot/Object/Location.pm
Normal file
@@ -0,0 +1,48 @@
|
||||
package Teapot::Bot::Object::Location;
|
||||
$Teapot::Bot::Object::Location::VERSION = '0.021';
|
||||
# ABSTRACT: The base class for Telegram message 'Location' type.
|
||||
|
||||
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
|
||||
has 'longitude';
|
||||
has 'latitude';
|
||||
|
||||
sub fields {
|
||||
return { scalar => [qw/longitude latitude/],
|
||||
};
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=pod
|
||||
|
||||
=encoding UTF-8
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Teapot::Bot::Object::Location - The base class for Telegram message 'Location' type.
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.021
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
See L<https://core.telegram.org/bots/api#location> for details of the
|
||||
attributes available for L<Teapot::Bot::Object::Location> objects.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Justin Hawkins <justin@eatmorecode.com>
|
||||
|
||||
=head1 COPYRIGHT AND LICENSE
|
||||
|
||||
This software is copyright (c) 2019 by Justin Hawkins.
|
||||
|
||||
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
|
||||
49
lib/Teapot/Bot/Object/LoginUrl.pm
Normal file
49
lib/Teapot/Bot/Object/LoginUrl.pm
Normal file
@@ -0,0 +1,49 @@
|
||||
package Teapot::Bot::Object::LoginUrl;
|
||||
$Teapot::Bot::Object::LoginUrl::VERSION = '0.021';
|
||||
# ABSTRACT: The base class for Telegram 'LoginUrl' type objects
|
||||
|
||||
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
|
||||
has 'url';
|
||||
has 'forward_text';
|
||||
has 'bot_username';
|
||||
has 'request_write_access';
|
||||
|
||||
sub fields {
|
||||
return { 'scalar' => [qw/url forward_text bot_username request_write_access/] };
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=pod
|
||||
|
||||
=encoding UTF-8
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Teapot::Bot::Object::LoginUrl - The base class for Telegram 'LoginUrl' type objects
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.021
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
See L<https://core.telegram.org/bots/api#loginurl> for details of the
|
||||
attributes available for L<Teapot::Bot::Object::LoginUrl> objects.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Justin Hawkins <justin@eatmorecode.com>
|
||||
|
||||
=head1 COPYRIGHT AND LICENSE
|
||||
|
||||
This software is copyright (c) 2019 by Justin Hawkins.
|
||||
|
||||
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
|
||||
178
lib/Teapot/Bot/Object/Message.pm
Normal file
178
lib/Teapot/Bot/Object/Message.pm
Normal file
@@ -0,0 +1,178 @@
|
||||
package Teapot::Bot::Object::Message;
|
||||
$Teapot::Bot::Object::Message::VERSION = '0.021';
|
||||
# ABSTRACT: The base class for the Telegram type "Message".
|
||||
|
||||
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
|
||||
use Teapot::Bot::Object::User;
|
||||
use Teapot::Bot::Object::Chat;
|
||||
use Teapot::Bot::Object::MessageEntity;
|
||||
use Teapot::Bot::Object::Audio;
|
||||
use Teapot::Bot::Object::Document;
|
||||
use Teapot::Bot::Object::Animation;
|
||||
use Teapot::Bot::Object::Game;
|
||||
use Teapot::Bot::Object::PhotoSize;
|
||||
use Teapot::Bot::Object::Sticker;
|
||||
use Teapot::Bot::Object::Video;
|
||||
use Teapot::Bot::Object::Voice;
|
||||
use Teapot::Bot::Object::VideoNote;
|
||||
use Teapot::Bot::Object::Contact;
|
||||
use Teapot::Bot::Object::Location;
|
||||
use Teapot::Bot::Object::Poll;
|
||||
use Teapot::Bot::Object::Location;
|
||||
use Teapot::Bot::Object::PhotoSize;
|
||||
use Teapot::Bot::Object::Invoice;
|
||||
use Teapot::Bot::Object::Venue;
|
||||
use Teapot::Bot::Object::SuccessfulPayment;
|
||||
use Teapot::Bot::Object::PassportData;
|
||||
use Teapot::Bot::Object::InlineKeyboardMarkup;
|
||||
|
||||
use Data::Dumper;
|
||||
|
||||
# basic message stuff
|
||||
has 'message_id';
|
||||
has 'from'; # User
|
||||
has 'date';
|
||||
has 'chat'; # Chat
|
||||
|
||||
has 'forward_from'; # User
|
||||
has 'forward_from_chat'; # Chat
|
||||
has 'forward_from_message_id';
|
||||
has 'forward_signature';
|
||||
has 'forward_sender_name';
|
||||
has 'forward_date';
|
||||
|
||||
has 'reply_to_message'; # Message
|
||||
has 'edit_date';
|
||||
has 'media_group_id';
|
||||
has 'author_signature';
|
||||
has 'text';
|
||||
has 'entities'; # Array of MessageEntity
|
||||
|
||||
has 'caption_entities'; # Array of MessageEntity
|
||||
|
||||
has 'audio'; # Audio
|
||||
has 'document'; # Document
|
||||
has 'animation'; # Animation
|
||||
has 'game'; # Game
|
||||
has 'photo'; # Array of PhotoSize
|
||||
has 'sticker'; # Sticker
|
||||
has 'video'; # Video
|
||||
has 'voice'; # Voice
|
||||
has 'video_note'; # VideoNote
|
||||
has 'caption';
|
||||
has 'contact'; # Contact
|
||||
has 'location'; # Location
|
||||
has 'venue'; # Venue
|
||||
has 'poll'; # Poll
|
||||
has 'new_chat_members'; # Array of User
|
||||
has 'left_chat_member'; # User
|
||||
has 'new_chat_title';
|
||||
has 'new_chat_photo'; # Array of PhotoSize
|
||||
has 'delete_chat_photo';
|
||||
has 'group_chat_created';
|
||||
has 'supergroup_chat_created';
|
||||
has 'channel_chat_created';
|
||||
has 'migrate_to_chat_id';
|
||||
has 'migrate_from_chat_id';
|
||||
has 'pinned_message'; # Message
|
||||
has 'invoice'; # Invoice
|
||||
has 'successful_payment'; # SuccessfulPayment
|
||||
has 'connected_website';
|
||||
has 'passport_data'; # PassportData
|
||||
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 edit_date 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/],
|
||||
'Teapot::Bot::Object::User' => [qw/from forward_from new_chat_members left_chat_member /],
|
||||
|
||||
'Teapot::Bot::Object::Chat' => [qw/chat forward_from_chat/],
|
||||
'Teapot::Bot::Object::Message' => [qw/reply_to_message pinned_message/],
|
||||
'Teapot::Bot::Object::MessageEntity' => [qw/entities caption_entities /],
|
||||
|
||||
'Teapot::Bot::Object::Audio' => [qw/audio/],
|
||||
'Teapot::Bot::Object::Document' => [qw/document/],
|
||||
'Teapot::Bot::Object::Animation' => [qw/animation/],
|
||||
'Teapot::Bot::Object::Game' => [qw/game/],
|
||||
'Teapot::Bot::Object::PhotoSize' => [qw/photo new_chat_photo/],
|
||||
'Teapot::Bot::Object::Sticker' => [qw/sticker/],
|
||||
'Teapot::Bot::Object::Video' => [qw/video/],
|
||||
'Teapot::Bot::Object::Voice' => [qw/voice/],
|
||||
'Teapot::Bot::Object::VideoNote' => [qw/video_note/],
|
||||
|
||||
'Teapot::Bot::Object::Contact' => [qw/contact/],
|
||||
'Teapot::Bot::Object::Location' => [qw/location/],
|
||||
'Teapot::Bot::Object::Venue' => [qw/venue/],
|
||||
|
||||
'Teapot::Bot::Object::Poll' => [qw/poll/],
|
||||
|
||||
'Teapot::Bot::Object::Invoice' => [qw/invoice/],
|
||||
'Teapot::Bot::Object::SuccessfulPayment' => [qw/successful_payment/],
|
||||
'Teapot::Bot::Object::PassportData' => [qw/passport_data/],
|
||||
'Teapot::Bot::Object::InlineKeyboardMarkup' => [qw/reply_markup/],
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
sub arrays {
|
||||
qw/photo entities caption_entities new_chat_members new_chat_photo/
|
||||
}
|
||||
|
||||
|
||||
sub reply {
|
||||
my $self = shift;
|
||||
my $text = shift;
|
||||
return $self->_brain->sendMessage({chat_id => $self->chat->id, text => $text});
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=pod
|
||||
|
||||
=encoding UTF-8
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Teapot::Bot::Object::Message - The base class for the Telegram type "Message".
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.021
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
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
|
||||
|
||||
A convenience method to reply to a message with text.
|
||||
|
||||
Will return the L<Teapot::Bot::Object::Message> object representing the message
|
||||
sent.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Justin Hawkins <justin@eatmorecode.com>
|
||||
|
||||
=head1 COPYRIGHT AND LICENSE
|
||||
|
||||
This software is copyright (c) 2019 by Justin Hawkins.
|
||||
|
||||
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/MessageEntity.pm
Normal file
54
lib/Teapot/Bot/Object/MessageEntity.pm
Normal file
@@ -0,0 +1,54 @@
|
||||
package Teapot::Bot::Object::MessageEntity;
|
||||
$Teapot::Bot::Object::MessageEntity::VERSION = '0.021';
|
||||
# ABSTRACT: The base class for Telegram 'MessageEntity' type objects
|
||||
|
||||
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
use Teapot::Bot::Object::User;
|
||||
|
||||
has 'type';
|
||||
has 'offset';
|
||||
has 'length';
|
||||
has 'url';
|
||||
has 'user'; #User
|
||||
|
||||
sub fields {
|
||||
return {
|
||||
'scalar' => [qw/type offset length url/],
|
||||
'Teapot::Bot::Object::User' => [qw/user/],
|
||||
};
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=pod
|
||||
|
||||
=encoding UTF-8
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Teapot::Bot::Object::MessageEntity - The base class for Telegram 'MessageEntity' type objects
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.021
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
See L<https://core.telegram.org/bots/api#messageentity> for details of the
|
||||
attributes available for L<Teapot::Bot::Object::MessageEntity> objects.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Justin Hawkins <justin@eatmorecode.com>
|
||||
|
||||
=head1 COPYRIGHT AND LICENSE
|
||||
|
||||
This software is copyright (c) 2019 by Justin Hawkins.
|
||||
|
||||
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/PassportData.pm
Normal file
54
lib/Teapot/Bot/Object/PassportData.pm
Normal file
@@ -0,0 +1,54 @@
|
||||
package Teapot::Bot::Object::PassportData;
|
||||
$Teapot::Bot::Object::PassportData::VERSION = '0.021';
|
||||
# ABSTRACT: The base class for Telegram 'PassportData' type objects
|
||||
|
||||
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
use Teapot::Bot::Object::EncryptedPassportElement;
|
||||
use Teapot::Bot::Object::EncryptedCredentials;
|
||||
|
||||
has 'data'; # Array of EncryptedPassportElement
|
||||
has 'credentials'; # EncryptedCredentials
|
||||
|
||||
sub fields {
|
||||
return { 'Teapot::Bot::Object::EncryptedPassportElement' => [qw/data/],
|
||||
'Teapot::Bot::Object::EncryptedCredentials' => [qw/credentials/],
|
||||
};
|
||||
}
|
||||
sub arrays {
|
||||
qw/data/;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=pod
|
||||
|
||||
=encoding UTF-8
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Teapot::Bot::Object::PassportData - The base class for Telegram 'PassportData' type objects
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.021
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
See L<https://core.telegram.org/bots/api#passportdata> for details of the
|
||||
attributes available for L<Teapot::Bot::Object::PassportData> objects.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Justin Hawkins <justin@eatmorecode.com>
|
||||
|
||||
=head1 COPYRIGHT AND LICENSE
|
||||
|
||||
This software is copyright (c) 2019 by Justin Hawkins.
|
||||
|
||||
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/PhotoSize.pm
Normal file
51
lib/Teapot/Bot/Object/PhotoSize.pm
Normal file
@@ -0,0 +1,51 @@
|
||||
package Teapot::Bot::Object::PhotoSize;
|
||||
$Teapot::Bot::Object::PhotoSize::VERSION = '0.021';
|
||||
# ABSTRACT: The base class for Telegram message 'PhotoSize' type.
|
||||
|
||||
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
use Carp qw/croak/;
|
||||
|
||||
has 'file_id';
|
||||
has 'width';
|
||||
has 'height';
|
||||
has 'file_size';
|
||||
|
||||
sub fields {
|
||||
return { scalar => [qw/file_id width height file_size/]
|
||||
};
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=pod
|
||||
|
||||
=encoding UTF-8
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Teapot::Bot::Object::PhotoSize - The base class for Telegram message 'PhotoSize' type.
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.021
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
See L<https://core.telegram.org/bots/api#photosize> for details of the
|
||||
attributes available for L<Teapot::Bot::Object::PhotoSize> objects.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Justin Hawkins <justin@eatmorecode.com>
|
||||
|
||||
=head1 COPYRIGHT AND LICENSE
|
||||
|
||||
This software is copyright (c) 2019 by Justin Hawkins.
|
||||
|
||||
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
|
||||
58
lib/Teapot/Bot/Object/Poll.pm
Normal file
58
lib/Teapot/Bot/Object/Poll.pm
Normal file
@@ -0,0 +1,58 @@
|
||||
package Teapot::Bot::Object::Poll;
|
||||
$Teapot::Bot::Object::Poll::VERSION = '0.021';
|
||||
# ABSTRACT: The base class for Telegram 'Poll' type objects
|
||||
|
||||
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
use Teapot::Bot::Object::PollOption;
|
||||
|
||||
|
||||
has 'id';
|
||||
has 'question';
|
||||
has 'options'; # Array of PollOption
|
||||
has 'is_closed';
|
||||
|
||||
sub fields {
|
||||
return { scalar => [qw/id question is_closed/],
|
||||
'Teapot::Bot::Object::PollOption' => [qw/options /],
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
sub arrays {
|
||||
qw/options/;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=pod
|
||||
|
||||
=encoding UTF-8
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Teapot::Bot::Object::Poll - The base class for Telegram 'Poll' type objects
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.021
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
See L<https://core.telegram.org/bots/api#poll> for details of the
|
||||
attributes available for L<Teapot::Bot::Object::Poll> objects.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Justin Hawkins <justin@eatmorecode.com>
|
||||
|
||||
=head1 COPYRIGHT AND LICENSE
|
||||
|
||||
This software is copyright (c) 2019 by Justin Hawkins.
|
||||
|
||||
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
|
||||
48
lib/Teapot/Bot/Object/PollOption.pm
Normal file
48
lib/Teapot/Bot/Object/PollOption.pm
Normal file
@@ -0,0 +1,48 @@
|
||||
package Teapot::Bot::Object::PollOption;
|
||||
$Teapot::Bot::Object::PollOption::VERSION = '0.021';
|
||||
# ABSTRACT: The base class for Telegram 'PollOption' type objects
|
||||
|
||||
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
|
||||
has 'text';
|
||||
has 'voter_count';
|
||||
|
||||
sub fields {
|
||||
return { scalar => [qw/text voter_count/],
|
||||
};
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=pod
|
||||
|
||||
=encoding UTF-8
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Teapot::Bot::Object::PollOption - The base class for Telegram 'PollOption' type objects
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.021
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
See L<https://core.telegram.org/bots/api#polloption> for details of the
|
||||
attributes available for L<Teapot::Bot::Object::PollOption> objects.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Justin Hawkins <justin@eatmorecode.com>
|
||||
|
||||
=head1 COPYRIGHT AND LICENSE
|
||||
|
||||
This software is copyright (c) 2019 by Justin Hawkins.
|
||||
|
||||
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
|
||||
57
lib/Teapot/Bot/Object/Sticker.pm
Normal file
57
lib/Teapot/Bot/Object/Sticker.pm
Normal file
@@ -0,0 +1,57 @@
|
||||
package Teapot::Bot::Object::Sticker;
|
||||
$Teapot::Bot::Object::Sticker::VERSION = '0.021';
|
||||
# ABSTRACT: The base class for Telegram message 'Sticker' type.
|
||||
|
||||
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
use Teapot::Bot::Object::PhotoSize;
|
||||
|
||||
has 'file_id';
|
||||
has 'width';
|
||||
has 'height';
|
||||
has 'thumb'; # PhotoSize
|
||||
has 'emoji';
|
||||
has 'set_name';
|
||||
# has 'mask_position'; # XXX TODO
|
||||
has 'file_size';
|
||||
|
||||
sub fields {
|
||||
return { scalar => [qw/file_id width height emoji
|
||||
set_name file_size /],
|
||||
'Teapot::Bot::Object::PhotoSize' => [ qw/thumb/ ],
|
||||
};
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=pod
|
||||
|
||||
=encoding UTF-8
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Teapot::Bot::Object::Sticker - The base class for Telegram message 'Sticker' type.
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.021
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
See L<https://core.telegram.org/bots/api#sticker> for details of the
|
||||
attributes available for L<Teapot::Bot::Object::Sticker> objects.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Justin Hawkins <justin@eatmorecode.com>
|
||||
|
||||
=head1 COPYRIGHT AND LICENSE
|
||||
|
||||
This software is copyright (c) 2019 by Justin Hawkins.
|
||||
|
||||
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
|
||||
57
lib/Teapot/Bot/Object/SuccessfulPayment.pm
Normal file
57
lib/Teapot/Bot/Object/SuccessfulPayment.pm
Normal file
@@ -0,0 +1,57 @@
|
||||
package Teapot::Bot::Object::SuccessfulPayment;
|
||||
$Teapot::Bot::Object::SuccessfulPayment::VERSION = '0.021';
|
||||
# ABSTRACT: The base class for Telegram 'SuccessfulPayment' type objects
|
||||
|
||||
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
# use Teapot::Bot::Object::OrderInfo;
|
||||
|
||||
has 'currency';
|
||||
has 'total_amount';
|
||||
has 'invoice_payload';
|
||||
has 'shipping_option_id';
|
||||
# has 'order_info'; #OrderInfo XXX
|
||||
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/],
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=pod
|
||||
|
||||
=encoding UTF-8
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Teapot::Bot::Object::SuccessfulPayment - The base class for Telegram 'SuccessfulPayment' type objects
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.021
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
See L<https://core.telegram.org/bots/api#successfulpayment> for details of the
|
||||
attributes available for L<Teapot::Bot::Object::SuccessfulPayment> objects.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Justin Hawkins <justin@eatmorecode.com>
|
||||
|
||||
=head1 COPYRIGHT AND LICENSE
|
||||
|
||||
This software is copyright (c) 2019 by Justin Hawkins.
|
||||
|
||||
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
|
||||
52
lib/Teapot/Bot/Object/User.pm
Normal file
52
lib/Teapot/Bot/Object/User.pm
Normal file
@@ -0,0 +1,52 @@
|
||||
package Teapot::Bot::Object::User;
|
||||
$Teapot::Bot::Object::User::VERSION = '0.021';
|
||||
# ABSTRACT: The base class for Telegram message 'User' type.
|
||||
|
||||
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
|
||||
has 'id';
|
||||
has 'is_bot';
|
||||
has 'first_name';
|
||||
has 'last_name'; # optional
|
||||
has 'username'; # optional
|
||||
has 'language_code'; # optional
|
||||
|
||||
sub fields {
|
||||
return { scalar => [qw/id is_bot first_name last_name username language_code/]
|
||||
};
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=pod
|
||||
|
||||
=encoding UTF-8
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Teapot::Bot::Object::User - The base class for Telegram message 'User' type.
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.021
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
See L<https://core.telegram.org/bots/api#user> for details of the
|
||||
attributes available for L<Teapot::Bot::Object::User> objects.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Justin Hawkins <justin@eatmorecode.com>
|
||||
|
||||
=head1 COPYRIGHT AND LICENSE
|
||||
|
||||
This software is copyright (c) 2019 by Justin Hawkins.
|
||||
|
||||
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/Venue.pm
Normal file
54
lib/Teapot/Bot/Object/Venue.pm
Normal file
@@ -0,0 +1,54 @@
|
||||
package Teapot::Bot::Object::Venue;
|
||||
$Teapot::Bot::Object::Venue::VERSION = '0.021';
|
||||
# ABSTRACT: The base class for Telegram 'LoginUrl' type objects
|
||||
|
||||
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
use Teapot::Bot::Object::Location;
|
||||
|
||||
has 'location'; #Location
|
||||
has 'title';
|
||||
has 'address';
|
||||
has 'foursquare_id';
|
||||
has 'foursquare_type';
|
||||
|
||||
sub fields {
|
||||
return { 'scalar' => [qw/title address
|
||||
foursquare_id foursquare_type/],
|
||||
'Teapot::Bot::Object::Location' => [qw/location/] };
|
||||
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=pod
|
||||
|
||||
=encoding UTF-8
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Teapot::Bot::Object::Venue - The base class for Telegram 'LoginUrl' type objects
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.021
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
See L<https://core.telegram.org/bots/api#venue> for details of the
|
||||
attributes available for L<Teapot::Bot::Object::Venue> objects.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Justin Hawkins <justin@eatmorecode.com>
|
||||
|
||||
=head1 COPYRIGHT AND LICENSE
|
||||
|
||||
This software is copyright (c) 2019 by Justin Hawkins.
|
||||
|
||||
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
|
||||
56
lib/Teapot/Bot/Object/Video.pm
Normal file
56
lib/Teapot/Bot/Object/Video.pm
Normal file
@@ -0,0 +1,56 @@
|
||||
package Teapot::Bot::Object::Video;
|
||||
$Teapot::Bot::Object::Video::VERSION = '0.021';
|
||||
# ABSTRACT: The base class for Telegram 'Video' object.
|
||||
|
||||
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
use Teapot::Bot::Object::PhotoSize;
|
||||
|
||||
has 'file_id';
|
||||
has 'width';
|
||||
has 'height';
|
||||
has 'duration';
|
||||
has 'thumb'; #PhotoSize
|
||||
has 'mime_type';
|
||||
has 'file_size';
|
||||
|
||||
sub fields {
|
||||
return { scalar => [qw/file_id width height duration
|
||||
mime_type file_size /],
|
||||
'Teapot::Bot::Object::PhotoSize' => [qw/thumb/]
|
||||
};
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=pod
|
||||
|
||||
=encoding UTF-8
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Teapot::Bot::Object::Video - The base class for Telegram 'Video' object.
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.021
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
See L<https://core.telegram.org/bots/api#video> for details of the
|
||||
attributes available for L<Teapot::Bot::Object::Video> objects.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Justin Hawkins <justin@eatmorecode.com>
|
||||
|
||||
=head1 COPYRIGHT AND LICENSE
|
||||
|
||||
This software is copyright (c) 2019 by Justin Hawkins.
|
||||
|
||||
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
|
||||
55
lib/Teapot/Bot/Object/VideoNote.pm
Normal file
55
lib/Teapot/Bot/Object/VideoNote.pm
Normal file
@@ -0,0 +1,55 @@
|
||||
package Teapot::Bot::Object::VideoNote;
|
||||
$Teapot::Bot::Object::VideoNote::VERSION = '0.021';
|
||||
# ABSTRACT: The base class for Telegram 'VideoNote' type objects
|
||||
|
||||
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
use Teapot::Bot::Object::PhotoSize;
|
||||
|
||||
has 'file_id';
|
||||
has 'length';
|
||||
has 'duration';
|
||||
has 'mime_type';
|
||||
has 'thumb'; #PhotoSize
|
||||
has 'file_size';
|
||||
|
||||
sub fields {
|
||||
return { scalar => [qw/file_id length duration mime_type file_size/],
|
||||
'Teapot::Bot::Object::PhotoSize' => [qw/thumb /],
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=pod
|
||||
|
||||
=encoding UTF-8
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Teapot::Bot::Object::VideoNote - The base class for Telegram 'VideoNote' type objects
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.021
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
See L<https://core.telegram.org/bots/api#videonote> for details of the
|
||||
attributes available for L<Teapot::Bot::Object::VideoNote> objects.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Justin Hawkins <justin@eatmorecode.com>
|
||||
|
||||
=head1 COPYRIGHT AND LICENSE
|
||||
|
||||
This software is copyright (c) 2019 by Justin Hawkins.
|
||||
|
||||
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
|
||||
50
lib/Teapot/Bot/Object/Voice.pm
Normal file
50
lib/Teapot/Bot/Object/Voice.pm
Normal file
@@ -0,0 +1,50 @@
|
||||
package Teapot::Bot::Object::Voice;
|
||||
$Teapot::Bot::Object::Voice::VERSION = '0.021';
|
||||
# ABSTRACT: The base class for Telegram 'Voice' type objects
|
||||
|
||||
|
||||
use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
|
||||
has 'file_id';
|
||||
has 'duration';
|
||||
has 'mime_type';
|
||||
has 'file_size';
|
||||
|
||||
sub fields {
|
||||
return { scalar => [qw/file_id duration mime_type file_size/]
|
||||
};
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=pod
|
||||
|
||||
=encoding UTF-8
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Teapot::Bot::Object::Voice - The base class for Telegram 'Voice' type objects
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
version 0.021
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
See L<https://core.telegram.org/bots/api#voice> for details of the
|
||||
attributes available for L<Teapot::Bot::Object::Voice> objects.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Justin Hawkins <justin@eatmorecode.com>
|
||||
|
||||
=head1 COPYRIGHT AND LICENSE
|
||||
|
||||
This software is copyright (c) 2019 by Justin Hawkins.
|
||||
|
||||
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
|
||||
Reference in New Issue
Block a user