Name : perl-Telebot
| |
Version : 0.01
| Vendor : obs://build_opensuse_org/devel:languages:perl
|
Release : lp156.1.1
| Date : 2024-07-03 19:06:53
|
Group : Unspecified
| Source RPM : perl-Telebot-0.01-lp156.1.1.src.rpm
|
Size : 0.12 MB
| |
Packager : https://www_suse_com/
| |
Summary : Mojolicious-based Telegram bot
|
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 *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 *run*
package My::Bot::Handler::Message; use Mojo::Base \'Telebot::Handler\', -signatures;
sub run ($self) {
$self; }
1;
Handler have attributes *app* - reference to application, *payload* - data recieved from update, *update_id* - Telegram ID of update.
Handler *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 *tg:request*
$self->app->tg->request(getMe => {});
$self->app->tg->request(sendLocation => { chat_id => 777, latitude => 90-rand(180), longitude => 180-rand(360), });
|
RPM found in directory: /packages/linux-pbone/ftp5.gwdg.de/pub/opensuse/repositories/devel:/languages:/perl:/CPAN-T/15.6/noarch |