1

Now Telegram::Bot is Teapot::Bot

This commit is contained in:
eleksir
2020-10-28 18:12:49 +03:00
parent c3818e5dee
commit f816840e14
34 changed files with 266 additions and 267 deletions

View File

@@ -10,6 +10,5 @@ requires 'JSON';
requires 'JSON::XS'; requires 'JSON::XS';
requires 'JSON::PP'; requires 'JSON::PP';
requires 'Mojo::Base'; requires 'Mojo::Base';
requires 'Telegram::Bot';
requires 'URI::URL'; requires 'URI::URL';
requires 'local::lib'; requires 'local::lib';

View File

@@ -1,5 +1,5 @@
package Telegram::Bot; package Teapot::Bot;
$Telegram::Bot::VERSION = '0.021'; $Teapot::Bot::VERSION = '0.021';
use strict; use strict;
use warnings; use warnings;
@@ -16,7 +16,7 @@ __END__
=head1 NAME =head1 NAME
Telegram::Bot - A base class to make your very own Telegram bot Teapot::Bot - A base class to make your very own Telegram bot
=head1 VERSION =head1 VERSION
@@ -30,7 +30,7 @@ Creating a bot is easy:
package MyBot; package MyBot;
use Mojo::Base 'Telegram::Bot::Brain'; use Mojo::Base 'Teapot::Bot::Brain';
has token => 'YOURTOKENHERE'; has token => 'YOURTOKENHERE';

View File

@@ -1,5 +1,5 @@
package Telegram::Bot::Brain; package Teapot::Bot::Brain;
$Telegram::Bot::Brain::VERSION = '0.021'; $Teapot::Bot::Brain::VERSION = '0.021';
# ABSTRACT: A base class to make your very own Telegram bot # ABSTRACT: A base class to make your very own Telegram bot
@@ -14,7 +14,7 @@ use Carp qw/croak/;
use Log::Any; use Log::Any;
use Data::Dumper; use Data::Dumper;
use Telegram::Bot::Object::Message; use Teapot::Bot::Object::Message;
# base class for building telegram robots with Mojolicious # base class for building telegram robots with Mojolicious
has longpoll_time => 60; has longpoll_time => 60;
@@ -82,7 +82,7 @@ sub getMe {
my $url = "https://api.telegram.org/bot${token}/getMe"; my $url = "https://api.telegram.org/bot${token}/getMe";
my $api_response = $self->_post_request($url); my $api_response = $self->_post_request($url);
return Telegram::Bot::Object::User->create_from_hash($api_response, $self); return Teapot::Bot::Object::User->create_from_hash($api_response, $self);
} }
@@ -107,10 +107,10 @@ sub sendMessage {
if (exists $args->{reply_markup}) { if (exists $args->{reply_markup}) {
my $reply_markup = $args->{reply_markup}; my $reply_markup = $args->{reply_markup};
die "bad reply_markup supplied" die "bad reply_markup supplied"
if ( ref($reply_markup) ne 'Telegram::Bot::Object::InlineKeyboardMarkup' && if ( ref($reply_markup) ne 'Teapot::Bot::Object::InlineKeyboardMarkup' &&
ref($reply_markup) ne 'Telegram::Bot::Object::ReplyKeyboardMarkup' && ref($reply_markup) ne 'Teapot::Bot::Object::ReplyKeyboardMarkup' &&
ref($reply_markup) ne 'Telegram::Bot::Object::ReplyKeyboardRemove' && ref($reply_markup) ne 'Teapot::Bot::Object::ReplyKeyboardRemove' &&
ref($reply_markup) ne 'Telegram::Bot::Object::ForceReply' ); ref($reply_markup) ne 'Teapot::Bot::Object::ForceReply' );
$send_args->{reply_markup} = $reply_markup; $send_args->{reply_markup} = $reply_markup;
} }
@@ -118,7 +118,7 @@ sub sendMessage {
my $url = "https://api.telegram.org/bot${token}/sendMessage"; my $url = "https://api.telegram.org/bot${token}/sendMessage";
my $api_response = $self->_post_request($url, $send_args); my $api_response = $self->_post_request($url, $send_args);
return Telegram::Bot::Object::Message->create_from_hash($api_response, $self); return Teapot::Bot::Object::Message->create_from_hash($api_response, $self);
} }
@@ -142,7 +142,7 @@ sub forwardMessage {
my $url = "https://api.telegram.org/bot${token}/forwardMessage"; my $url = "https://api.telegram.org/bot${token}/forwardMessage";
my $api_response = $self->_post_request($url, $send_args); my $api_response = $self->_post_request($url, $send_args);
return Telegram::Bot::Object::Message->create_from_hash($api_response, $self); return Teapot::Bot::Object::Message->create_from_hash($api_response, $self);
} }
@@ -170,7 +170,7 @@ sub sendPhoto {
my $url = "https://api.telegram.org/bot${token}/sendPhoto"; my $url = "https://api.telegram.org/bot${token}/sendPhoto";
my $api_response = $self->_post_request($url, $send_args); my $api_response = $self->_post_request($url, $send_args);
return Telegram::Bot::Object::Message->create_from_hash($api_response, $self); return Teapot::Bot::Object::Message->create_from_hash($api_response, $self);
} }
@@ -212,10 +212,10 @@ sub _process_message {
# There can be several types of responses. But only one response. # There can be several types of responses. But only one response.
# https://core.telegram.org/bots/api#update # https://core.telegram.org/bots/api#update
my $update; my $update;
$update = Telegram::Bot::Object::Message->create_from_hash($item->{message}, $self) if $item->{message}; $update = Teapot::Bot::Object::Message->create_from_hash($item->{message}, $self) if $item->{message};
$update = Telegram::Bot::Object::Message->create_from_hash($item->{edited_message}, $self) if $item->{edited_message}; $update = Teapot::Bot::Object::Message->create_from_hash($item->{edited_message}, $self) if $item->{edited_message};
$update = Telegram::Bot::Object::Message->create_from_hash($item->{channel_post}, $self) if $item->{channel_post}; $update = Teapot::Bot::Object::Message->create_from_hash($item->{channel_post}, $self) if $item->{channel_post};
$update = Telegram::Bot::Object::Message->create_from_hash($item->{edited_channel_post}, $self) if $item->{edited_channel_post}; $update = Teapot::Bot::Object::Message->create_from_hash($item->{edited_channel_post}, $self) if $item->{edited_channel_post};
# if we got to this point without creating a response, it must be a type we # if we got to this point without creating a response, it must be a type we
# don't handle yet # don't handle yet
@@ -252,7 +252,7 @@ __END__
=head1 NAME =head1 NAME
Telegram::Bot::Brain - A base class to make your very own Telegram bot Teapot::Bot::Brain - A base class to make your very own Telegram bot
=head1 VERSION =head1 VERSION
@@ -262,7 +262,7 @@ version 0.021
package MyApp::Coolbot; package MyApp::Coolbot;
use Mojo::Base 'Telegram::Bot::Brain'; use Mojo::Base 'Teapot::Bot::Brain';
has token => 'token-you-got-from-@botfather'; has token => 'token-you-got-from-@botfather';
@@ -306,13 +306,13 @@ This method will add a sub to run every C<$seconds> seconds. Pass this method
two parameters, the number of seconds between executions, and the coderef to two parameters, the number of seconds between executions, and the coderef to
execute. execute.
Your coderef will be passed the L<Telegram::Bot::Brain> object when it is Your coderef will be passed the L<Teapot::Bot::Brain> object when it is
executed. executed.
=head2 add_listener =head2 add_listener
Respond to messages we receive. It takes a single argument, a coderef to execute Respond to messages we receive. It takes a single argument, a coderef to execute
for each update that is sent to us. These are *typically* C<Telegram::Bot:Object::Message> for each update that is sent to us. These are *typically* C<Teapot::Bot:Object::Message>
objects, though that is not the only type of update that may be sent (see objects, though that is not the only type of update that may be sent (see
L<https://core.telegram.org/bots/api#update>). L<https://core.telegram.org/bots/api#update>).
@@ -333,26 +333,26 @@ is already running).
This is the wrapper around the C<getMe> API method. See This is the wrapper around the C<getMe> API method. See
L<https://core.telegram.org/bots/api#getme>. L<https://core.telegram.org/bots/api#getme>.
Takes no arguments, and returns the L<Telegram::Bot::Object::User> that Takes no arguments, and returns the L<Teapot::Bot::Object::User> that
represents this bot. represents this bot.
=head2 sendMessage =head2 sendMessage
See L<https://core.telegram.org/bots/api#sendmessage>. See L<https://core.telegram.org/bots/api#sendmessage>.
Returns a L<Telegram::Bot::Object::Message> object. Returns a L<Teapot::Bot::Object::Message> object.
=head2 forwardMessage =head2 forwardMessage
See L<https://core.telegram.org/bots/api#forwardmessage>. See L<https://core.telegram.org/bots/api#forwardmessage>.
Returns a L<Telegram::Bot::Object::Message> object. Returns a L<Teapot::Bot::Object::Message> object.
=head2 sendPhoto =head2 sendPhoto
See L<https://core.telegram.org/bots/api#sendphoto>. See L<https://core.telegram.org/bots/api#sendphoto>.
Returns a L<Telegram::Bot::Object::Message> object. Returns a L<Teapot::Bot::Object::Message> object.
=head1 SEE ALSO =head1 SEE ALSO
@@ -376,7 +376,7 @@ updates.
L<https://core.telegram.org/bots/api#available-methods> L<https://core.telegram.org/bots/api#available-methods>
They all return immediately with the corresponding Telegram::Bot::Object They all return immediately with the corresponding Teapot::Bot::Object
subclass - consult the documenation for each below to see what to expect. subclass - consult the documenation for each below to see what to expect.
Note that not all methods have yet been implemented. Note that not all methods have yet been implemented.

View File

@@ -1,10 +1,10 @@
package Telegram::Bot::Object::Animation; package Teapot::Bot::Object::Animation;
$Telegram::Bot::Object::Animation::VERSION = '0.021'; $Teapot::Bot::Object::Animation::VERSION = '0.021';
# ABSTRACT: The base class for Telegram message 'Animation' type. # ABSTRACT: The base class for Telegram message 'Animation' type.
use Mojo::Base 'Telegram::Bot::Object::Base'; use Mojo::Base 'Teapot::Bot::Object::Base';
use Telegram::Bot::Object::PhotoSize; use Teapot::Bot::Object::PhotoSize;
use Carp qw/croak/; use Carp qw/croak/;
has 'file_id'; has 'file_id';
@@ -18,7 +18,7 @@ has 'file_size';
sub fields { 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/],
'Telegram::Bot::Object::PhotoSize' => [qw/thumb/], 'Teapot::Bot::Object::PhotoSize' => [qw/thumb/],
}; };
} }
@@ -33,7 +33,7 @@ __END__
=head1 NAME =head1 NAME
Telegram::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 =head1 VERSION
@@ -42,7 +42,7 @@ version 0.021
=head1 DESCRIPTION =head1 DESCRIPTION
See L<https://core.telegram.org/bots/api#animation> for details of the See L<https://core.telegram.org/bots/api#animation> for details of the
attributes available for L<Telegram::Bot::Object::Animation> objects. attributes available for L<Teapot::Bot::Object::Animation> objects.
=head1 AUTHOR =head1 AUTHOR

View File

@@ -1,9 +1,9 @@
package Telegram::Bot::Object::Audio; package Teapot::Bot::Object::Audio;
$Telegram::Bot::Object::Audio::VERSION = '0.021'; $Teapot::Bot::Object::Audio::VERSION = '0.021';
# ABSTRACT: The base class for Telegram 'Audio' type objects # ABSTRACT: The base class for Telegram 'Audio' type objects
use Mojo::Base 'Telegram::Bot::Object::Base'; use Mojo::Base 'Teapot::Bot::Object::Base';
has 'file_id'; has 'file_id';
has 'duration'; has 'duration';
@@ -15,7 +15,7 @@ has 'thumb'; #PhotoSize
sub fields { 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/],
'Telegram::Bot::Object::PhotoSize' => [qw/thumb/], 'Teapot::Bot::Object::PhotoSize' => [qw/thumb/],
}; };
} }
@@ -29,7 +29,7 @@ __END__
=head1 NAME =head1 NAME
Telegram::Bot::Object::Audio - The base class for Telegram 'Audio' type objects Teapot::Bot::Object::Audio - The base class for Telegram 'Audio' type objects
=head1 VERSION =head1 VERSION
@@ -38,7 +38,7 @@ version 0.021
=head1 DESCRIPTION =head1 DESCRIPTION
See L<https://core.telegram.org/bots/api#audio> for details of the See L<https://core.telegram.org/bots/api#audio> for details of the
attributes available for L<Telegram::Bot::Object::Audio> objects. attributes available for L<Teapot::Bot::Object::Audio> objects.
=head1 AUTHOR =head1 AUTHOR

View File

@@ -1,6 +1,6 @@
package Telegram::Bot::Object::Base; package Teapot::Bot::Object::Base;
$Telegram::Bot::Object::Base::VERSION = '0.021'; $Teapot::Bot::Object::Base::VERSION = '0.021';
# ABSTRACT: The base class for all Telegram::Bot::Object objects. # ABSTRACT: The base class for all Teapot::Bot::Object objects.
use Mojo::Base -base; use Mojo::Base -base;
@@ -129,7 +129,7 @@ __END__
=head1 NAME =head1 NAME
Telegram::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 =head1 VERSION
@@ -139,9 +139,9 @@ version 0.021
This class should not be instantiated itself. Instead, instantiate a sub-class. 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<Telegram::Bot::Object::Base>, 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 instead the appropriate objects will be created from an incoming request via
L<Telegram::Bot::Brain>. L<Teapot::Bot::Brain>.
You can then use the methods referenced below on those objects. You can then use the methods referenced below on those objects.

View File

@@ -1,9 +1,9 @@
package Telegram::Bot::Object::CallbackGame; package Teapot::Bot::Object::CallbackGame;
$Telegram::Bot::Object::CallbackGame::VERSION = '0.021'; $Teapot::Bot::Object::CallbackGame::VERSION = '0.021';
# ABSTRACT: The base class for Telegram message 'CallbackGame' type. # ABSTRACT: The base class for Telegram message 'CallbackGame' type.
use Mojo::Base 'Telegram::Bot::Object::Base'; use Mojo::Base 'Teapot::Bot::Object::Base';
# https://core.telegram.org/bots/api#callbackgame # https://core.telegram.org/bots/api#callbackgame
# "A placeholder, currently holds no information. Use BotFather to set up your game" # "A placeholder, currently holds no information. Use BotFather to set up your game"
@@ -22,7 +22,7 @@ __END__
=head1 NAME =head1 NAME
Telegram::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 =head1 VERSION
@@ -31,7 +31,7 @@ version 0.021
=head1 DESCRIPTION =head1 DESCRIPTION
See L<https://core.telegram.org/bots/api#callbackgame> for details of the See L<https://core.telegram.org/bots/api#callbackgame> for details of the
attributes available for L<Telegram::Bot::Object::CallbackGame> objects. attributes available for L<Teapot::Bot::Object::CallbackGame> objects.
=head1 AUTHOR =head1 AUTHOR

View File

@@ -1,11 +1,11 @@
package Telegram::Bot::Object::Chat; package Teapot::Bot::Object::Chat;
$Telegram::Bot::Object::Chat::VERSION = '0.021'; $Teapot::Bot::Object::Chat::VERSION = '0.021';
# ABSTRACT: The base class for Telegram 'Chat' type objects # ABSTRACT: The base class for Telegram 'Chat' type objects
use Mojo::Base 'Telegram::Bot::Object::Base'; use Mojo::Base 'Teapot::Bot::Object::Base';
use Telegram::Bot::Object::ChatPhoto; use Teapot::Bot::Object::ChatPhoto;
use Telegram::Bot::Object::Message; use Teapot::Bot::Object::Message;
has 'id'; has 'id';
has 'type'; has 'type';
@@ -27,8 +27,8 @@ sub fields {
last_name all_members_are_administrators last_name all_members_are_administrators
description invite_link sticker_set_name description invite_link sticker_set_name
can_set_sticker_set/], can_set_sticker_set/],
'Telegram::Bot::Object::ChatPhoto' => [qw/photo/], 'Teapot::Bot::Object::ChatPhoto' => [qw/photo/],
'Telegram::Bot::Object::Message' => [qw/pinned_message/], 'Teapot::Bot::Object::Message' => [qw/pinned_message/],
}; };
} }
@@ -52,7 +52,7 @@ __END__
=head1 NAME =head1 NAME
Telegram::Bot::Object::Chat - The base class for Telegram 'Chat' type objects Teapot::Bot::Object::Chat - The base class for Telegram 'Chat' type objects
=head1 VERSION =head1 VERSION
@@ -61,7 +61,7 @@ version 0.021
=head1 DESCRIPTION =head1 DESCRIPTION
See L<https://core.telegram.org/bots/api#chat> for details of the See L<https://core.telegram.org/bots/api#chat> for details of the
attributes available for L<Telegram::Bot::Object::Chat> objects. attributes available for L<Teapot::Bot::Object::Chat> objects.
=head1 METHODS =head1 METHODS

View File

@@ -1,9 +1,9 @@
package Telegram::Bot::Object::ChatPhoto; package Teapot::Bot::Object::ChatPhoto;
$Telegram::Bot::Object::ChatPhoto::VERSION = '0.021'; $Teapot::Bot::Object::ChatPhoto::VERSION = '0.021';
# ABSTRACT: The base class for Telegram 'ChatPhoto' type objects # ABSTRACT: The base class for Telegram 'ChatPhoto' type objects
use Mojo::Base 'Telegram::Bot::Object::Base'; use Mojo::Base 'Teapot::Bot::Object::Base';
has 'small_file_id'; has 'small_file_id';
has 'big_file_id'; has 'big_file_id';
@@ -24,7 +24,7 @@ __END__
=head1 NAME =head1 NAME
Telegram::Bot::Object::ChatPhoto - The base class for Telegram 'ChatPhoto' type objects Teapot::Bot::Object::ChatPhoto - The base class for Telegram 'ChatPhoto' type objects
=head1 VERSION =head1 VERSION
@@ -33,7 +33,7 @@ version 0.021
=head1 DESCRIPTION =head1 DESCRIPTION
See L<https://core.telegram.org/bots/api#chatphoto> for details of the See L<https://core.telegram.org/bots/api#chatphoto> for details of the
attributes available for L<Telegram::Bot::Object::ChatPhoto> objects. attributes available for L<Teapot::Bot::Object::ChatPhoto> objects.
=head1 AUTHOR =head1 AUTHOR

View File

@@ -1,9 +1,9 @@
package Telegram::Bot::Object::Contact; package Teapot::Bot::Object::Contact;
$Telegram::Bot::Object::Contact::VERSION = '0.021'; $Teapot::Bot::Object::Contact::VERSION = '0.021';
# ABSTRACT: The base class for Telegram 'Contact' objects. # ABSTRACT: The base class for Telegram 'Contact' objects.
use Mojo::Base 'Telegram::Bot::Object::Base'; use Mojo::Base 'Teapot::Bot::Object::Base';
has 'phone_number'; has 'phone_number';
has 'first_name'; has 'first_name';
@@ -25,7 +25,7 @@ __END__
=head1 NAME =head1 NAME
Telegram::Bot::Object::Contact - The base class for Telegram 'Contact' objects. Teapot::Bot::Object::Contact - The base class for Telegram 'Contact' objects.
=head1 VERSION =head1 VERSION
@@ -34,7 +34,7 @@ version 0.021
=head1 DESCRIPTION =head1 DESCRIPTION
See L<https://core.telegram.org/bots/api#chat> for details of the See L<https://core.telegram.org/bots/api#chat> for details of the
attributes available for L<Telegram::Bot::Object::Contact> objects. attributes available for L<Teapot::Bot::Object::Contact> objects.
=head1 AUTHOR =head1 AUTHOR

View File

@@ -1,11 +1,11 @@
package Telegram::Bot::Object::Document; package Teapot::Bot::Object::Document;
$Telegram::Bot::Object::Document::VERSION = '0.021'; $Teapot::Bot::Object::Document::VERSION = '0.021';
# ABSTRACT: The base class for Telegram 'Document' objects # ABSTRACT: The base class for Telegram 'Document' objects
use Mojo::Base 'Telegram::Bot::Object::Base'; use Mojo::Base 'Teapot::Bot::Object::Base';
use Telegram::Bot::Object::PhotoSize; use Teapot::Bot::Object::PhotoSize;
has 'file_id'; has 'file_id';
has 'thumb'; #PhotoSize has 'thumb'; #PhotoSize
@@ -15,7 +15,7 @@ has 'file_size';
sub fields { sub fields {
return { scalar => [qw/file_id file_name mime_type file_size/], return { scalar => [qw/file_id file_name mime_type file_size/],
'Telegram::Bot::Object::PhotoSize' => [qw/thumb/] 'Teapot::Bot::Object::PhotoSize' => [qw/thumb/]
}; };
} }
@@ -29,7 +29,7 @@ __END__
=head1 NAME =head1 NAME
Telegram::Bot::Object::Document - The base class for Telegram 'Document' objects Teapot::Bot::Object::Document - The base class for Telegram 'Document' objects
=head1 VERSION =head1 VERSION
@@ -38,7 +38,7 @@ version 0.021
=head1 DESCRIPTION =head1 DESCRIPTION
See L<https://core.telegram.org/bots/api#document> for details of the See L<https://core.telegram.org/bots/api#document> for details of the
attributes available for L<Telegram::Bot::Object::Document> objects. attributes available for L<Teapot::Bot::Object::Document> objects.
=head1 AUTHOR =head1 AUTHOR

View File

@@ -1,9 +1,9 @@
package Telegram::Bot::Object::EncryptedCredentials; package Teapot::Bot::Object::EncryptedCredentials;
$Telegram::Bot::Object::EncryptedCredentials::VERSION = '0.021'; $Teapot::Bot::Object::EncryptedCredentials::VERSION = '0.021';
# ABSTRACT: The base class for Telegram 'EncryptedCredentials' type objects # ABSTRACT: The base class for Telegram 'EncryptedCredentials' type objects
use Mojo::Base 'Telegram::Bot::Object::Base'; use Mojo::Base 'Teapot::Bot::Object::Base';
has 'data'; has 'data';
has 'hash'; has 'hash';
@@ -23,7 +23,7 @@ __END__
=head1 NAME =head1 NAME
Telegram::Bot::Object::EncryptedCredentials - The base class for Telegram 'EncryptedCredentials' type objects Teapot::Bot::Object::EncryptedCredentials - The base class for Telegram 'EncryptedCredentials' type objects
=head1 VERSION =head1 VERSION
@@ -32,7 +32,7 @@ version 0.021
=head1 DESCRIPTION =head1 DESCRIPTION
See L<https://core.telegram.org/bots/api#encryptedcredentials> for details of the See L<https://core.telegram.org/bots/api#encryptedcredentials> for details of the
attributes available for L<Telegram::Bot::Object::EncryptedCredentials> objects. attributes available for L<Teapot::Bot::Object::EncryptedCredentials> objects.
=head1 AUTHOR =head1 AUTHOR

View File

@@ -1,9 +1,9 @@
package Telegram::Bot::Object::EncryptedPassportElement; package Teapot::Bot::Object::EncryptedPassportElement;
$Telegram::Bot::Object::EncryptedPassportElement::VERSION = '0.021'; $Teapot::Bot::Object::EncryptedPassportElement::VERSION = '0.021';
# ABSTRACT: The base class for Telegram 'EncryptedPassportElement' type objects # ABSTRACT: The base class for Telegram 'EncryptedPassportElement' type objects
use Mojo::Base 'Telegram::Bot::Object::Base'; use Mojo::Base 'Teapot::Bot::Object::Base';
# XXX Implement rest of this # XXX Implement rest of this
# https://core.telegram.org/bots/api#encryptedpassportelement # https://core.telegram.org/bots/api#encryptedpassportelement
@@ -29,7 +29,7 @@ __END__
=head1 NAME =head1 NAME
Telegram::Bot::Object::EncryptedPassportElement - The base class for Telegram 'EncryptedPassportElement' type objects Teapot::Bot::Object::EncryptedPassportElement - The base class for Telegram 'EncryptedPassportElement' type objects
=head1 VERSION =head1 VERSION
@@ -38,7 +38,7 @@ version 0.021
=head1 DESCRIPTION =head1 DESCRIPTION
See L<https://core.telegram.org/bots/api#encryptedpassportelement> for details of the See L<https://core.telegram.org/bots/api#encryptedpassportelement> for details of the
attributes available for L<Telegram::Bot::Object::EncryptedPassportElement> objects. attributes available for L<Teapot::Bot::Object::EncryptedPassportElement> objects.
Note that this type is not yet fully implemented. Note that this type is not yet fully implemented.

View File

@@ -1,12 +1,12 @@
package Telegram::Bot::Object::Game; package Teapot::Bot::Object::Game;
$Telegram::Bot::Object::Game::VERSION = '0.021'; $Teapot::Bot::Object::Game::VERSION = '0.021';
# ABSTRACT: The base class for Telegram message 'Game' type. # ABSTRACT: The base class for Telegram message 'Game' type.
use Mojo::Base 'Telegram::Bot::Object::Base'; use Mojo::Base 'Teapot::Bot::Object::Base';
use Telegram::Bot::Object::PhotoSize; use Teapot::Bot::Object::PhotoSize;
use Telegram::Bot::Object::Animation; use Teapot::Bot::Object::Animation;
use Telegram::Bot::Object::MessageEntity; use Teapot::Bot::Object::MessageEntity;
has 'title'; has 'title';
has 'description'; has 'description';
@@ -17,9 +17,9 @@ has 'animation'; #Animation
sub fields { sub fields {
return { scalar => [qw/title description text/], return { scalar => [qw/title description text/],
'Telegram::Bot::Object::PhotoSize' => [qw/photo/], 'Teapot::Bot::Object::PhotoSize' => [qw/photo/],
'Telegram::Bot::Object::MessageEntity' => [qw/text_entities/], 'Teapot::Bot::Object::MessageEntity' => [qw/text_entities/],
'Telegram::Bot::Object::Animation' => [qw/animation/], 'Teapot::Bot::Object::Animation' => [qw/animation/],
}; };
} }
@@ -35,7 +35,7 @@ __END__
=head1 NAME =head1 NAME
Telegram::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 =head1 VERSION
@@ -44,7 +44,7 @@ version 0.021
=head1 DESCRIPTION =head1 DESCRIPTION
See L<https://core.telegram.org/bots/api#game> for details of the See L<https://core.telegram.org/bots/api#game> for details of the
attributes available for L<Telegram::Bot::Object::Game> objects. attributes available for L<Teapot::Bot::Object::Game> objects.
=head1 AUTHOR =head1 AUTHOR

View File

@@ -1,11 +1,11 @@
package Telegram::Bot::Object::InlineKeyboardButton; package Teapot::Bot::Object::InlineKeyboardButton;
$Telegram::Bot::Object::InlineKeyboardButton::VERSION = '0.021'; $Teapot::Bot::Object::InlineKeyboardButton::VERSION = '0.021';
# ABSTRACT: The base class for Telegram 'InlineKeyboardButton' type objects # ABSTRACT: The base class for Telegram 'InlineKeyboardButton' type objects
use Mojo::Base 'Telegram::Bot::Object::Base'; use Mojo::Base 'Teapot::Bot::Object::Base';
use Telegram::Bot::Object::LoginUrl; use Teapot::Bot::Object::LoginUrl;
use Telegram::Bot::Object::CallbackGame; use Teapot::Bot::Object::CallbackGame;
has 'text'; has 'text';
has 'url'; has 'url';
@@ -20,8 +20,8 @@ sub fields {
return { 'scalar' => [qw/text url callback_data switch_inline_query return { 'scalar' => [qw/text url callback_data switch_inline_query
switch_inline_query_current_chat switch_inline_query_current_chat switch_inline_query_current_chat switch_inline_query_current_chat
pay/], pay/],
'Telegram::Bot::Object::LoginUrl' => [qw/login_url/], 'Teapot::Bot::Object::LoginUrl' => [qw/login_url/],
'Telegram::Bot::Object::CallbackGame'=> [qw/callback_game/], 'Teapot::Bot::Object::CallbackGame'=> [qw/callback_game/],
}; };
} }
@@ -35,7 +35,7 @@ __END__
=head1 NAME =head1 NAME
Telegram::Bot::Object::InlineKeyboardButton - The base class for Telegram 'InlineKeyboardButton' type objects Teapot::Bot::Object::InlineKeyboardButton - The base class for Telegram 'InlineKeyboardButton' type objects
=head1 VERSION =head1 VERSION
@@ -44,7 +44,7 @@ version 0.021
=head1 DESCRIPTION =head1 DESCRIPTION
See L<https://core.telegram.org/bots/api#inlinekeyboardbutton> for details of the See L<https://core.telegram.org/bots/api#inlinekeyboardbutton> for details of the
attributes available for L<Telegram::Bot::Object::InlineKeyboardButton> objects. attributes available for L<Teapot::Bot::Object::InlineKeyboardButton> objects.
=head1 AUTHOR =head1 AUTHOR

View File

@@ -1,15 +1,15 @@
package Telegram::Bot::Object::InlineKeyboardMarkup; package Teapot::Bot::Object::InlineKeyboardMarkup;
$Telegram::Bot::Object::InlineKeyboardMarkup::VERSION = '0.021'; $Teapot::Bot::Object::InlineKeyboardMarkup::VERSION = '0.021';
# ABSTRACT: The base class for Telegram 'InlineKeyboardMarkup' type objects # ABSTRACT: The base class for Telegram 'InlineKeyboardMarkup' type objects
use Mojo::Base 'Telegram::Bot::Object::Base'; use Mojo::Base 'Teapot::Bot::Object::Base';
use Telegram::Bot::Object::InlineKeyboardButton; use Teapot::Bot::Object::InlineKeyboardButton;
has 'inline_keyboard'; has 'inline_keyboard';
sub fields { sub fields {
return { 'Telegram::Bot::Object::InlineKeyboardButton' => [qw/inline_keyboard/], return { 'Teapot::Bot::Object::InlineKeyboardButton' => [qw/inline_keyboard/],
}; };
} }
@@ -27,7 +27,7 @@ __END__
=head1 NAME =head1 NAME
Telegram::Bot::Object::InlineKeyboardMarkup - The base class for Telegram 'InlineKeyboardMarkup' type objects Teapot::Bot::Object::InlineKeyboardMarkup - The base class for Telegram 'InlineKeyboardMarkup' type objects
=head1 VERSION =head1 VERSION
@@ -36,7 +36,7 @@ version 0.021
=head1 DESCRIPTION =head1 DESCRIPTION
See L<https://core.telegram.org/bots/api#inlinekeyboardmarkup> for details of the See L<https://core.telegram.org/bots/api#inlinekeyboardmarkup> for details of the
attributes available for L<Telegram::Bot::Object::InlineKeyboardMarkup> objects. attributes available for L<Teapot::Bot::Object::InlineKeyboardMarkup> objects.
=head1 AUTHOR =head1 AUTHOR

View File

@@ -1,9 +1,9 @@
package Telegram::Bot::Object::Invoice; package Teapot::Bot::Object::Invoice;
$Telegram::Bot::Object::Invoice::VERSION = '0.021'; $Teapot::Bot::Object::Invoice::VERSION = '0.021';
# ABSTRACT: The base class for Telegram 'Invoice' type objects # ABSTRACT: The base class for Telegram 'Invoice' type objects
use Mojo::Base 'Telegram::Bot::Object::Base'; use Mojo::Base 'Teapot::Bot::Object::Base';
has 'title'; has 'title';
has 'description'; has 'description';
@@ -26,7 +26,7 @@ __END__
=head1 NAME =head1 NAME
Telegram::Bot::Object::Invoice - The base class for Telegram 'Invoice' type objects Teapot::Bot::Object::Invoice - The base class for Telegram 'Invoice' type objects
=head1 VERSION =head1 VERSION
@@ -35,7 +35,7 @@ version 0.021
=head1 DESCRIPTION =head1 DESCRIPTION
See L<https://core.telegram.org/bots/api#invoice> for details of the See L<https://core.telegram.org/bots/api#invoice> for details of the
attributes available for L<Telegram::Bot::Object::Invoice> objects. attributes available for L<Teapot::Bot::Object::Invoice> objects.
=head1 AUTHOR =head1 AUTHOR

View File

@@ -1,9 +1,9 @@
package Telegram::Bot::Object::Location; package Teapot::Bot::Object::Location;
$Telegram::Bot::Object::Location::VERSION = '0.021'; $Teapot::Bot::Object::Location::VERSION = '0.021';
# ABSTRACT: The base class for Telegram message 'Location' type. # ABSTRACT: The base class for Telegram message 'Location' type.
use Mojo::Base 'Telegram::Bot::Object::Base'; use Mojo::Base 'Teapot::Bot::Object::Base';
has 'longitude'; has 'longitude';
has 'latitude'; has 'latitude';
@@ -23,7 +23,7 @@ __END__
=head1 NAME =head1 NAME
Telegram::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 =head1 VERSION
@@ -32,7 +32,7 @@ version 0.021
=head1 DESCRIPTION =head1 DESCRIPTION
See L<https://core.telegram.org/bots/api#location> for details of the See L<https://core.telegram.org/bots/api#location> for details of the
attributes available for L<Telegram::Bot::Object::Location> objects. attributes available for L<Teapot::Bot::Object::Location> objects.
=head1 AUTHOR =head1 AUTHOR

View File

@@ -1,9 +1,9 @@
package Telegram::Bot::Object::LoginUrl; package Teapot::Bot::Object::LoginUrl;
$Telegram::Bot::Object::LoginUrl::VERSION = '0.021'; $Teapot::Bot::Object::LoginUrl::VERSION = '0.021';
# ABSTRACT: The base class for Telegram 'LoginUrl' type objects # ABSTRACT: The base class for Telegram 'LoginUrl' type objects
use Mojo::Base 'Telegram::Bot::Object::Base'; use Mojo::Base 'Teapot::Bot::Object::Base';
has 'url'; has 'url';
has 'forward_text'; has 'forward_text';
@@ -24,7 +24,7 @@ __END__
=head1 NAME =head1 NAME
Telegram::Bot::Object::LoginUrl - The base class for Telegram 'LoginUrl' type objects Teapot::Bot::Object::LoginUrl - The base class for Telegram 'LoginUrl' type objects
=head1 VERSION =head1 VERSION
@@ -33,7 +33,7 @@ version 0.021
=head1 DESCRIPTION =head1 DESCRIPTION
See L<https://core.telegram.org/bots/api#loginurl> for details of the See L<https://core.telegram.org/bots/api#loginurl> for details of the
attributes available for L<Telegram::Bot::Object::LoginUrl> objects. attributes available for L<Teapot::Bot::Object::LoginUrl> objects.
=head1 AUTHOR =head1 AUTHOR

View File

@@ -1,32 +1,32 @@
package Telegram::Bot::Object::Message; package Teapot::Bot::Object::Message;
$Telegram::Bot::Object::Message::VERSION = '0.021'; $Teapot::Bot::Object::Message::VERSION = '0.021';
# ABSTRACT: The base class for the Telegram type "Message". # ABSTRACT: The base class for the Telegram type "Message".
use Mojo::Base 'Telegram::Bot::Object::Base'; use Mojo::Base 'Teapot::Bot::Object::Base';
use Telegram::Bot::Object::User; use Teapot::Bot::Object::User;
use Telegram::Bot::Object::Chat; use Teapot::Bot::Object::Chat;
use Telegram::Bot::Object::MessageEntity; use Teapot::Bot::Object::MessageEntity;
use Telegram::Bot::Object::Audio; use Teapot::Bot::Object::Audio;
use Telegram::Bot::Object::Document; use Teapot::Bot::Object::Document;
use Telegram::Bot::Object::Animation; use Teapot::Bot::Object::Animation;
use Telegram::Bot::Object::Game; use Teapot::Bot::Object::Game;
use Telegram::Bot::Object::PhotoSize; use Teapot::Bot::Object::PhotoSize;
use Telegram::Bot::Object::Sticker; use Teapot::Bot::Object::Sticker;
use Telegram::Bot::Object::Video; use Teapot::Bot::Object::Video;
use Telegram::Bot::Object::Voice; use Teapot::Bot::Object::Voice;
use Telegram::Bot::Object::VideoNote; use Teapot::Bot::Object::VideoNote;
use Telegram::Bot::Object::Contact; use Teapot::Bot::Object::Contact;
use Telegram::Bot::Object::Location; use Teapot::Bot::Object::Location;
use Telegram::Bot::Object::Poll; use Teapot::Bot::Object::Poll;
use Telegram::Bot::Object::Location; use Teapot::Bot::Object::Location;
use Telegram::Bot::Object::PhotoSize; use Teapot::Bot::Object::PhotoSize;
use Telegram::Bot::Object::Invoice; use Teapot::Bot::Object::Invoice;
use Telegram::Bot::Object::Venue; use Teapot::Bot::Object::Venue;
use Telegram::Bot::Object::SuccessfulPayment; use Teapot::Bot::Object::SuccessfulPayment;
use Telegram::Bot::Object::PassportData; use Teapot::Bot::Object::PassportData;
use Telegram::Bot::Object::InlineKeyboardMarkup; use Teapot::Bot::Object::InlineKeyboardMarkup;
use Data::Dumper; use Data::Dumper;
@@ -93,32 +93,32 @@ sub fields {
group_chat_created supergroup_chat_created group_chat_created supergroup_chat_created
channel_chat_created migrate_to_chat_id channel_chat_created migrate_to_chat_id
migrate_from_chat_id connected_website/], migrate_from_chat_id connected_website/],
'Telegram::Bot::Object::User' => [qw/from forward_from new_chat_members left_chat_member /], 'Teapot::Bot::Object::User' => [qw/from forward_from new_chat_members left_chat_member /],
'Telegram::Bot::Object::Chat' => [qw/chat forward_from_chat/], 'Teapot::Bot::Object::Chat' => [qw/chat forward_from_chat/],
'Telegram::Bot::Object::Message' => [qw/reply_to_message pinned_message/], 'Teapot::Bot::Object::Message' => [qw/reply_to_message pinned_message/],
'Telegram::Bot::Object::MessageEntity' => [qw/entities caption_entities /], 'Teapot::Bot::Object::MessageEntity' => [qw/entities caption_entities /],
'Telegram::Bot::Object::Audio' => [qw/audio/], 'Teapot::Bot::Object::Audio' => [qw/audio/],
'Telegram::Bot::Object::Document' => [qw/document/], 'Teapot::Bot::Object::Document' => [qw/document/],
'Telegram::Bot::Object::Animation' => [qw/animation/], 'Teapot::Bot::Object::Animation' => [qw/animation/],
'Telegram::Bot::Object::Game' => [qw/game/], 'Teapot::Bot::Object::Game' => [qw/game/],
'Telegram::Bot::Object::PhotoSize' => [qw/photo new_chat_photo/], 'Teapot::Bot::Object::PhotoSize' => [qw/photo new_chat_photo/],
'Telegram::Bot::Object::Sticker' => [qw/sticker/], 'Teapot::Bot::Object::Sticker' => [qw/sticker/],
'Telegram::Bot::Object::Video' => [qw/video/], 'Teapot::Bot::Object::Video' => [qw/video/],
'Telegram::Bot::Object::Voice' => [qw/voice/], 'Teapot::Bot::Object::Voice' => [qw/voice/],
'Telegram::Bot::Object::VideoNote' => [qw/video_note/], 'Teapot::Bot::Object::VideoNote' => [qw/video_note/],
'Telegram::Bot::Object::Contact' => [qw/contact/], 'Teapot::Bot::Object::Contact' => [qw/contact/],
'Telegram::Bot::Object::Location' => [qw/location/], 'Teapot::Bot::Object::Location' => [qw/location/],
'Telegram::Bot::Object::Venue' => [qw/venue/], 'Teapot::Bot::Object::Venue' => [qw/venue/],
'Telegram::Bot::Object::Poll' => [qw/poll/], 'Teapot::Bot::Object::Poll' => [qw/poll/],
'Telegram::Bot::Object::Invoice' => [qw/invoice/], 'Teapot::Bot::Object::Invoice' => [qw/invoice/],
'Telegram::Bot::Object::SuccessfulPayment' => [qw/successful_payment/], 'Teapot::Bot::Object::SuccessfulPayment' => [qw/successful_payment/],
'Telegram::Bot::Object::PassportData' => [qw/passport_data/], 'Teapot::Bot::Object::PassportData' => [qw/passport_data/],
'Telegram::Bot::Object::InlineKeyboardMarkup' => [qw/reply_markup/], 'Teapot::Bot::Object::InlineKeyboardMarkup' => [qw/reply_markup/],
}; };
} }
@@ -144,7 +144,7 @@ __END__
=head1 NAME =head1 NAME
Telegram::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 =head1 VERSION
@@ -153,7 +153,7 @@ version 0.021
=head1 DESCRIPTION =head1 DESCRIPTION
See L<https://core.telegram.org/bots/api#message> for details of the See L<https://core.telegram.org/bots/api#message> for details of the
attributes available for L<Telegram::Bot::Object::Message> objects. attributes available for L<Teapot::Bot::Object::Message> objects.
=head1 METHODS =head1 METHODS
@@ -161,7 +161,7 @@ attributes available for L<Telegram::Bot::Object::Message> objects.
A convenience method to reply to a message with text. A convenience method to reply to a message with text.
Will return the L<Telegram::Bot::Object::Message> object representing the message Will return the L<Teapot::Bot::Object::Message> object representing the message
sent. sent.
=head1 AUTHOR =head1 AUTHOR

View File

@@ -1,10 +1,10 @@
package Telegram::Bot::Object::MessageEntity; package Teapot::Bot::Object::MessageEntity;
$Telegram::Bot::Object::MessageEntity::VERSION = '0.021'; $Teapot::Bot::Object::MessageEntity::VERSION = '0.021';
# ABSTRACT: The base class for Telegram 'MessageEntity' type objects # ABSTRACT: The base class for Telegram 'MessageEntity' type objects
use Mojo::Base 'Telegram::Bot::Object::Base'; use Mojo::Base 'Teapot::Bot::Object::Base';
use Telegram::Bot::Object::User; use Teapot::Bot::Object::User;
has 'type'; has 'type';
has 'offset'; has 'offset';
@@ -15,7 +15,7 @@ has 'user'; #User
sub fields { sub fields {
return { return {
'scalar' => [qw/type offset length url/], 'scalar' => [qw/type offset length url/],
'Telegram::Bot::Object::User' => [qw/user/], 'Teapot::Bot::Object::User' => [qw/user/],
}; };
} }
@@ -29,7 +29,7 @@ __END__
=head1 NAME =head1 NAME
Telegram::Bot::Object::MessageEntity - The base class for Telegram 'MessageEntity' type objects Teapot::Bot::Object::MessageEntity - The base class for Telegram 'MessageEntity' type objects
=head1 VERSION =head1 VERSION
@@ -38,7 +38,7 @@ version 0.021
=head1 DESCRIPTION =head1 DESCRIPTION
See L<https://core.telegram.org/bots/api#messageentity> for details of the See L<https://core.telegram.org/bots/api#messageentity> for details of the
attributes available for L<Telegram::Bot::Object::MessageEntity> objects. attributes available for L<Teapot::Bot::Object::MessageEntity> objects.
=head1 AUTHOR =head1 AUTHOR

View File

@@ -1,18 +1,18 @@
package Telegram::Bot::Object::PassportData; package Teapot::Bot::Object::PassportData;
$Telegram::Bot::Object::PassportData::VERSION = '0.021'; $Teapot::Bot::Object::PassportData::VERSION = '0.021';
# ABSTRACT: The base class for Telegram 'PassportData' type objects # ABSTRACT: The base class for Telegram 'PassportData' type objects
use Mojo::Base 'Telegram::Bot::Object::Base'; use Mojo::Base 'Teapot::Bot::Object::Base';
use Telegram::Bot::Object::EncryptedPassportElement; use Teapot::Bot::Object::EncryptedPassportElement;
use Telegram::Bot::Object::EncryptedCredentials; use Teapot::Bot::Object::EncryptedCredentials;
has 'data'; # Array of EncryptedPassportElement has 'data'; # Array of EncryptedPassportElement
has 'credentials'; # EncryptedCredentials has 'credentials'; # EncryptedCredentials
sub fields { sub fields {
return { 'Telegram::Bot::Object::EncryptedPassportElement' => [qw/data/], return { 'Teapot::Bot::Object::EncryptedPassportElement' => [qw/data/],
'Telegram::Bot::Object::EncryptedCredentials' => [qw/credentials/], 'Teapot::Bot::Object::EncryptedCredentials' => [qw/credentials/],
}; };
} }
sub arrays { sub arrays {
@@ -29,7 +29,7 @@ __END__
=head1 NAME =head1 NAME
Telegram::Bot::Object::PassportData - The base class for Telegram 'PassportData' type objects Teapot::Bot::Object::PassportData - The base class for Telegram 'PassportData' type objects
=head1 VERSION =head1 VERSION
@@ -38,7 +38,7 @@ version 0.021
=head1 DESCRIPTION =head1 DESCRIPTION
See L<https://core.telegram.org/bots/api#passportdata> for details of the See L<https://core.telegram.org/bots/api#passportdata> for details of the
attributes available for L<Telegram::Bot::Object::PassportData> objects. attributes available for L<Teapot::Bot::Object::PassportData> objects.
=head1 AUTHOR =head1 AUTHOR

View File

@@ -1,9 +1,9 @@
package Telegram::Bot::Object::PhotoSize; package Teapot::Bot::Object::PhotoSize;
$Telegram::Bot::Object::PhotoSize::VERSION = '0.021'; $Teapot::Bot::Object::PhotoSize::VERSION = '0.021';
# ABSTRACT: The base class for Telegram message 'PhotoSize' type. # ABSTRACT: The base class for Telegram message 'PhotoSize' type.
use Mojo::Base 'Telegram::Bot::Object::Base'; use Mojo::Base 'Teapot::Bot::Object::Base';
use Carp qw/croak/; use Carp qw/croak/;
has 'file_id'; has 'file_id';
@@ -26,7 +26,7 @@ __END__
=head1 NAME =head1 NAME
Telegram::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 =head1 VERSION
@@ -35,7 +35,7 @@ version 0.021
=head1 DESCRIPTION =head1 DESCRIPTION
See L<https://core.telegram.org/bots/api#photosize> for details of the See L<https://core.telegram.org/bots/api#photosize> for details of the
attributes available for L<Telegram::Bot::Object::PhotoSize> objects. attributes available for L<Teapot::Bot::Object::PhotoSize> objects.
=head1 AUTHOR =head1 AUTHOR

View File

@@ -1,10 +1,10 @@
package Telegram::Bot::Object::Poll; package Teapot::Bot::Object::Poll;
$Telegram::Bot::Object::Poll::VERSION = '0.021'; $Teapot::Bot::Object::Poll::VERSION = '0.021';
# ABSTRACT: The base class for Telegram 'Poll' type objects # ABSTRACT: The base class for Telegram 'Poll' type objects
use Mojo::Base 'Telegram::Bot::Object::Base'; use Mojo::Base 'Teapot::Bot::Object::Base';
use Telegram::Bot::Object::PollOption; use Teapot::Bot::Object::PollOption;
has 'id'; has 'id';
@@ -14,7 +14,7 @@ has 'is_closed';
sub fields { sub fields {
return { scalar => [qw/id question is_closed/], return { scalar => [qw/id question is_closed/],
'Telegram::Bot::Object::PollOption' => [qw/options /], 'Teapot::Bot::Object::PollOption' => [qw/options /],
}; };
} }
@@ -33,7 +33,7 @@ __END__
=head1 NAME =head1 NAME
Telegram::Bot::Object::Poll - The base class for Telegram 'Poll' type objects Teapot::Bot::Object::Poll - The base class for Telegram 'Poll' type objects
=head1 VERSION =head1 VERSION
@@ -42,7 +42,7 @@ version 0.021
=head1 DESCRIPTION =head1 DESCRIPTION
See L<https://core.telegram.org/bots/api#poll> for details of the See L<https://core.telegram.org/bots/api#poll> for details of the
attributes available for L<Telegram::Bot::Object::Poll> objects. attributes available for L<Teapot::Bot::Object::Poll> objects.
=head1 AUTHOR =head1 AUTHOR

View File

@@ -1,9 +1,9 @@
package Telegram::Bot::Object::PollOption; package Teapot::Bot::Object::PollOption;
$Telegram::Bot::Object::PollOption::VERSION = '0.021'; $Teapot::Bot::Object::PollOption::VERSION = '0.021';
# ABSTRACT: The base class for Telegram 'PollOption' type objects # ABSTRACT: The base class for Telegram 'PollOption' type objects
use Mojo::Base 'Telegram::Bot::Object::Base'; use Mojo::Base 'Teapot::Bot::Object::Base';
has 'text'; has 'text';
has 'voter_count'; has 'voter_count';
@@ -23,7 +23,7 @@ __END__
=head1 NAME =head1 NAME
Telegram::Bot::Object::PollOption - The base class for Telegram 'PollOption' type objects Teapot::Bot::Object::PollOption - The base class for Telegram 'PollOption' type objects
=head1 VERSION =head1 VERSION
@@ -32,7 +32,7 @@ version 0.021
=head1 DESCRIPTION =head1 DESCRIPTION
See L<https://core.telegram.org/bots/api#polloption> for details of the See L<https://core.telegram.org/bots/api#polloption> for details of the
attributes available for L<Telegram::Bot::Object::PollOption> objects. attributes available for L<Teapot::Bot::Object::PollOption> objects.
=head1 AUTHOR =head1 AUTHOR

View File

@@ -1,10 +1,10 @@
package Telegram::Bot::Object::Sticker; package Teapot::Bot::Object::Sticker;
$Telegram::Bot::Object::Sticker::VERSION = '0.021'; $Teapot::Bot::Object::Sticker::VERSION = '0.021';
# ABSTRACT: The base class for Telegram message 'Sticker' type. # ABSTRACT: The base class for Telegram message 'Sticker' type.
use Mojo::Base 'Telegram::Bot::Object::Base'; use Mojo::Base 'Teapot::Bot::Object::Base';
use Telegram::Bot::Object::PhotoSize; use Teapot::Bot::Object::PhotoSize;
has 'file_id'; has 'file_id';
has 'width'; has 'width';
@@ -18,7 +18,7 @@ has 'file_size';
sub fields { sub fields {
return { scalar => [qw/file_id width height emoji return { scalar => [qw/file_id width height emoji
set_name file_size /], set_name file_size /],
'Telegram::Bot::Object::PhotoSize' => [ qw/thumb/ ], 'Teapot::Bot::Object::PhotoSize' => [ qw/thumb/ ],
}; };
} }
@@ -32,7 +32,7 @@ __END__
=head1 NAME =head1 NAME
Telegram::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 =head1 VERSION
@@ -41,7 +41,7 @@ version 0.021
=head1 DESCRIPTION =head1 DESCRIPTION
See L<https://core.telegram.org/bots/api#sticker> for details of the See L<https://core.telegram.org/bots/api#sticker> for details of the
attributes available for L<Telegram::Bot::Object::Sticker> objects. attributes available for L<Teapot::Bot::Object::Sticker> objects.
=head1 AUTHOR =head1 AUTHOR

View File

@@ -1,10 +1,10 @@
package Telegram::Bot::Object::SuccessfulPayment; package Teapot::Bot::Object::SuccessfulPayment;
$Telegram::Bot::Object::SuccessfulPayment::VERSION = '0.021'; $Teapot::Bot::Object::SuccessfulPayment::VERSION = '0.021';
# ABSTRACT: The base class for Telegram 'SuccessfulPayment' type objects # ABSTRACT: The base class for Telegram 'SuccessfulPayment' type objects
use Mojo::Base 'Telegram::Bot::Object::Base'; use Mojo::Base 'Teapot::Bot::Object::Base';
# use Telegram::Bot::Object::OrderInfo; # use Teapot::Bot::Object::OrderInfo;
has 'currency'; has 'currency';
has 'total_amount'; has 'total_amount';
@@ -17,7 +17,7 @@ has 'provider_payment_charge_id';
sub fields { sub fields {
return { scalar => [qw/currency total_amount invoice_payload shipping_option_id return { scalar => [qw/currency total_amount invoice_payload shipping_option_id
telegram_payment_charge_id provider_payment_charge_id/], telegram_payment_charge_id provider_payment_charge_id/],
# 'Telegram::Bot::Object::OrderInfo' => [qw/order_info/], # 'Teapot::Bot::Object::OrderInfo' => [qw/order_info/],
}; };
} }
@@ -32,7 +32,7 @@ __END__
=head1 NAME =head1 NAME
Telegram::Bot::Object::SuccessfulPayment - The base class for Telegram 'SuccessfulPayment' type objects Teapot::Bot::Object::SuccessfulPayment - The base class for Telegram 'SuccessfulPayment' type objects
=head1 VERSION =head1 VERSION
@@ -41,7 +41,7 @@ version 0.021
=head1 DESCRIPTION =head1 DESCRIPTION
See L<https://core.telegram.org/bots/api#successfulpayment> for details of the See L<https://core.telegram.org/bots/api#successfulpayment> for details of the
attributes available for L<Telegram::Bot::Object::SuccessfulPayment> objects. attributes available for L<Teapot::Bot::Object::SuccessfulPayment> objects.
=head1 AUTHOR =head1 AUTHOR

View File

@@ -1,9 +1,9 @@
package Telegram::Bot::Object::User; package Teapot::Bot::Object::User;
$Telegram::Bot::Object::User::VERSION = '0.021'; $Teapot::Bot::Object::User::VERSION = '0.021';
# ABSTRACT: The base class for Telegram message 'User' type. # ABSTRACT: The base class for Telegram message 'User' type.
use Mojo::Base 'Telegram::Bot::Object::Base'; use Mojo::Base 'Teapot::Bot::Object::Base';
has 'id'; has 'id';
has 'is_bot'; has 'is_bot';
@@ -27,7 +27,7 @@ __END__
=head1 NAME =head1 NAME
Telegram::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 =head1 VERSION
@@ -36,7 +36,7 @@ version 0.021
=head1 DESCRIPTION =head1 DESCRIPTION
See L<https://core.telegram.org/bots/api#user> for details of the See L<https://core.telegram.org/bots/api#user> for details of the
attributes available for L<Telegram::Bot::Object::User> objects. attributes available for L<Teapot::Bot::Object::User> objects.
=head1 AUTHOR =head1 AUTHOR

View File

@@ -1,10 +1,10 @@
package Telegram::Bot::Object::Venue; package Teapot::Bot::Object::Venue;
$Telegram::Bot::Object::Venue::VERSION = '0.021'; $Teapot::Bot::Object::Venue::VERSION = '0.021';
# ABSTRACT: The base class for Telegram 'LoginUrl' type objects # ABSTRACT: The base class for Telegram 'LoginUrl' type objects
use Mojo::Base 'Telegram::Bot::Object::Base'; use Mojo::Base 'Teapot::Bot::Object::Base';
use Telegram::Bot::Object::Location; use Teapot::Bot::Object::Location;
has 'location'; #Location has 'location'; #Location
has 'title'; has 'title';
@@ -15,7 +15,7 @@ has 'foursquare_type';
sub fields { sub fields {
return { 'scalar' => [qw/title address return { 'scalar' => [qw/title address
foursquare_id foursquare_type/], foursquare_id foursquare_type/],
'Telegram::Bot::Object::Location' => [qw/location/] }; 'Teapot::Bot::Object::Location' => [qw/location/] };
} }
@@ -29,7 +29,7 @@ __END__
=head1 NAME =head1 NAME
Telegram::Bot::Object::Venue - The base class for Telegram 'LoginUrl' type objects Teapot::Bot::Object::Venue - The base class for Telegram 'LoginUrl' type objects
=head1 VERSION =head1 VERSION
@@ -38,7 +38,7 @@ version 0.021
=head1 DESCRIPTION =head1 DESCRIPTION
See L<https://core.telegram.org/bots/api#venue> for details of the See L<https://core.telegram.org/bots/api#venue> for details of the
attributes available for L<Telegram::Bot::Object::Venue> objects. attributes available for L<Teapot::Bot::Object::Venue> objects.
=head1 AUTHOR =head1 AUTHOR

View File

@@ -1,10 +1,10 @@
package Telegram::Bot::Object::Video; package Teapot::Bot::Object::Video;
$Telegram::Bot::Object::Video::VERSION = '0.021'; $Teapot::Bot::Object::Video::VERSION = '0.021';
# ABSTRACT: The base class for Telegram 'Video' object. # ABSTRACT: The base class for Telegram 'Video' object.
use Mojo::Base 'Telegram::Bot::Object::Base'; use Mojo::Base 'Teapot::Bot::Object::Base';
use Telegram::Bot::Object::PhotoSize; use Teapot::Bot::Object::PhotoSize;
has 'file_id'; has 'file_id';
has 'width'; has 'width';
@@ -17,7 +17,7 @@ has 'file_size';
sub fields { sub fields {
return { scalar => [qw/file_id width height duration return { scalar => [qw/file_id width height duration
mime_type file_size /], mime_type file_size /],
'Telegram::Bot::Object::PhotoSize' => [qw/thumb/] 'Teapot::Bot::Object::PhotoSize' => [qw/thumb/]
}; };
} }
@@ -31,7 +31,7 @@ __END__
=head1 NAME =head1 NAME
Telegram::Bot::Object::Video - The base class for Telegram 'Video' object. Teapot::Bot::Object::Video - The base class for Telegram 'Video' object.
=head1 VERSION =head1 VERSION
@@ -40,7 +40,7 @@ version 0.021
=head1 DESCRIPTION =head1 DESCRIPTION
See L<https://core.telegram.org/bots/api#video> for details of the See L<https://core.telegram.org/bots/api#video> for details of the
attributes available for L<Telegram::Bot::Object::Video> objects. attributes available for L<Teapot::Bot::Object::Video> objects.
=head1 AUTHOR =head1 AUTHOR

View File

@@ -1,10 +1,10 @@
package Telegram::Bot::Object::VideoNote; package Teapot::Bot::Object::VideoNote;
$Telegram::Bot::Object::VideoNote::VERSION = '0.021'; $Teapot::Bot::Object::VideoNote::VERSION = '0.021';
# ABSTRACT: The base class for Telegram 'VideoNote' type objects # ABSTRACT: The base class for Telegram 'VideoNote' type objects
use Mojo::Base 'Telegram::Bot::Object::Base'; use Mojo::Base 'Teapot::Bot::Object::Base';
use Telegram::Bot::Object::PhotoSize; use Teapot::Bot::Object::PhotoSize;
has 'file_id'; has 'file_id';
has 'length'; has 'length';
@@ -15,7 +15,7 @@ has 'file_size';
sub fields { sub fields {
return { scalar => [qw/file_id length duration mime_type file_size/], return { scalar => [qw/file_id length duration mime_type file_size/],
'Telegram::Bot::Object::PhotoSize' => [qw/thumb /], 'Teapot::Bot::Object::PhotoSize' => [qw/thumb /],
}; };
} }
@@ -30,7 +30,7 @@ __END__
=head1 NAME =head1 NAME
Telegram::Bot::Object::VideoNote - The base class for Telegram 'VideoNote' type objects Teapot::Bot::Object::VideoNote - The base class for Telegram 'VideoNote' type objects
=head1 VERSION =head1 VERSION
@@ -39,7 +39,7 @@ version 0.021
=head1 DESCRIPTION =head1 DESCRIPTION
See L<https://core.telegram.org/bots/api#videonote> for details of the See L<https://core.telegram.org/bots/api#videonote> for details of the
attributes available for L<Telegram::Bot::Object::VideoNote> objects. attributes available for L<Teapot::Bot::Object::VideoNote> objects.
=head1 AUTHOR =head1 AUTHOR

View File

@@ -1,9 +1,9 @@
package Telegram::Bot::Object::Voice; package Teapot::Bot::Object::Voice;
$Telegram::Bot::Object::Voice::VERSION = '0.021'; $Teapot::Bot::Object::Voice::VERSION = '0.021';
# ABSTRACT: The base class for Telegram 'Voice' type objects # ABSTRACT: The base class for Telegram 'Voice' type objects
use Mojo::Base 'Telegram::Bot::Object::Base'; use Mojo::Base 'Teapot::Bot::Object::Base';
has 'file_id'; has 'file_id';
has 'duration'; has 'duration';
@@ -25,7 +25,7 @@ __END__
=head1 NAME =head1 NAME
Telegram::Bot::Object::Voice - The base class for Telegram 'Voice' type objects Teapot::Bot::Object::Voice - The base class for Telegram 'Voice' type objects
=head1 VERSION =head1 VERSION
@@ -34,7 +34,7 @@ version 0.021
=head1 DESCRIPTION =head1 DESCRIPTION
See L<https://core.telegram.org/bots/api#voice> for details of the See L<https://core.telegram.org/bots/api#voice> for details of the
attributes available for L<Telegram::Bot::Object::Voice> objects. attributes available for L<Teapot::Bot::Object::Voice> objects.
=head1 AUTHOR =head1 AUTHOR

View File

@@ -11,7 +11,7 @@ use open qw(:std :utf8);
use File::Path qw( mkpath ); use File::Path qw( mkpath );
use Hailo; use Hailo;
use Encode; use Encode;
use Mojo::Base 'Telegram::Bot::Brain'; use Mojo::Base 'Teapot::Bot::Brain';
use conf qw(loadConf); use conf qw(loadConf);
use botlib qw(weather logger trim randomCommonPhrase); use botlib qw(weather logger trim randomCommonPhrase);
@@ -56,7 +56,7 @@ sub __on_msg {
$can_talk = 0; $can_talk = 0;
unless ($myid) { unless ($myid) {
my $myObj = Telegram::Bot::Brain::getMe ($self); my $myObj = Teapot::Bot::Brain::getMe ($self);
$myid = $myObj->id; $myid = $myObj->id;
# TODO: use these values instead of pre-defined in config! # TODO: use these values instead of pre-defined in config!
$myusername = $myObj->username; $myusername = $myObj->username;
@@ -172,7 +172,7 @@ sub __on_msg {
sleep ( 3 + int ( rand (2))); sleep ( 3 + int ( rand (2)));
Telegram::Bot::Brain::sendMessage ($self, $send_args); Teapot::Bot::Brain::sendMessage ($self, $send_args);
return; return;
} }
@@ -324,7 +324,7 @@ sub __on_msg {
MYHELP MYHELP
$send_args->{parse_mode} = 'Markdown'; $send_args->{parse_mode} = 'Markdown';
$send_args->{chat_id} = $chatid; $send_args->{chat_id} = $chatid;
Telegram::Bot::Brain::sendMessage ($self, $send_args); Teapot::Bot::Brain::sendMessage ($self, $send_args);
return; return;
} elsif (substr ($text, 1) eq 'ping') { } elsif (substr ($text, 1) eq 'ping') {
$reply = 'Pong.'; $reply = 'Pong.';

View File

@@ -1,5 +1,5 @@
package telegramlib; package telegramlib;
# store here functions that are not implemented in Telegram::Bot # store here functions that are not implemented in Teapot::Bot
use 5.018; use 5.018;
use strict; use strict;
@@ -8,7 +8,7 @@ use utf8;
use open qw(:std :utf8); use open qw(:std :utf8);
use botlib qw(trim); use botlib qw(trim);
use Telegram::Bot::Brain; use Teapot::Bot::Brain;
# module shit # module shit
use vars qw/$VERSION/; use vars qw/$VERSION/;
@@ -32,7 +32,7 @@ sub getChat {
# framework does just omits it, when creating object from hash, so # framework does just omits it, when creating object from hash, so
# pick raw json object instead # pick raw json object instead
#return Telegram::Bot::Object::User->create_from_hash($api_response, $self); #return Teapot::Bot::Object::User->create_from_hash($api_response, $self);
return $api_response; return $api_response;
} }
@@ -48,7 +48,7 @@ sub getChatMember {
my $url = "https://api.telegram.org/bot${token}/getChatMember"; my $url = "https://api.telegram.org/bot${token}/getChatMember";
my $api_response = $self->_post_request ($url, $send_args); my $api_response = $self->_post_request ($url, $send_args);
# return Telegram::Bot::Object::User->create_from_hash($api_response, $self); # return Teapot::Bot::Object::User->create_from_hash($api_response, $self);
return $api_response; return $api_response;
} }
@@ -65,7 +65,7 @@ sub sendChatAction {
my $url = "https://api.telegram.org/bot${token}/sendChatAction"; my $url = "https://api.telegram.org/bot${token}/sendChatAction";
my $api_response = $self->_post_request ($url, $send_args); my $api_response = $self->_post_request ($url, $send_args);
# return Telegram::Bot::Object::User->create_from_hash($api_response, $self); # return Teapot::Bot::Object::User->create_from_hash($api_response, $self);
return; return;
} }