=pod
 
=encoding utf8

=head1 NAME
 
Telebot - Mojolicious-based Telegram bot

=head1 SYNOPSIS

    # Create telebot application
    
    telebot bot generate My::Bot
    
=head1 DESCRIPTION

This library helps to create mojolicious based Telegram
bots. Application works via telegram webhooks.
It creates route and register it in telegram. Requests
form telegram are processed on this route. Application
processes requests via minion tasks to minimize web
interaction time.
You can include your application logic in so called
handlers. You have several types of handlers - one
for update and one for each possible part of update.
Handlers are located in B<lib/Handler> folder and have
corresponding names:

    Update.pm
    
    CallbackQuery.pm
    ChannelPost.pm
    ChatJoinRequest.pm
    ChatMember.pm
    ChosenInlineResult.pm
    EditedChannelPost.pm
    EditedMessage.pm
    InlineQuery.pm
    Message.pm
    MyChatMember.pm
    Poll.pm
    PollAnswer.pm
    PreCheckoutQuery.pm
    ShippingQuery.pm

To implement your logic you must overwrite subroutine
B<run>

    package My::Bot::Handler::Message;
    use Mojo::Base 'Telebot::Handler', -signatures;

    sub run ($self) {
        
        # Your magic here
        
        $self;
    }

    1;

Handler have attributes
B<app> - reference to application,
B<payload> - data recieved from update,
B<update_id> - Telegram ID of update.

Handler B<Update> gets full update paypload.
Typed handlers gets only corresponding part of update.

For example if incoming update contain message -
two handlers will be executed - Update and Message.
Update will recieve full update payload, Message only
message part of update.

For interaction with Telegram API you can use helper
B<tg:request>

    $self->app->tg->request(getMe => {});
    
    $self->app->tg->request(sendLocation => {
        chat_id => 777,
        latitude => 90-rand(180),
        longitude => 180-rand(360),
    });
    
=head1 COPYRIGHT AND LICENSE

Copyright (C) 2022, Igor Lobanov.
This program is free software, you can redistribute it and/or modify it under the terms of the Artistic License version
2.0.

=head1 SEE ALSO

L<https://github.com/igorlobanov/telebot>, L<Mojolicious::Guides>, L<https://mojolicious.org>, L<https://core.telegram.org/api>.

=cut
