NAME
Telebot::Plugin::Telegram::UI - User intreface based on telegram API.
SYNOPSIS
$app->tg->ui->input(
chat_id => 111,
text => 'Fill your name',
placeholder => 'Your name here',
);
$app->tg->ui->choice(
chat_id => 111,
[text => 'Select next action',]
buttons => [
[
{
text => 'Open beer',
callback_data => 'beer',
},
{
text => 'Code something',
callback_data => 'waste_time',
},
],
[
{
text => 'Drink beer',
callback_data => 'pleasure',
},
{
text => 'Buy iPhone 115',
callback_data => 'waste_money',
},
]
],
);
$app->tg->ui->error(
chat_id => 111,
text => 'Something unexpected',
reply_to => 777,
);
DESCRIPTION
Telebot::Plugin::Telegram::UI - plugin defines some helpers which will be more high level replacement of direct calls of Telegram API.
IMPORTANT NOTE. These helpers are EXPERIMENTAL. I'm not sure they will not be changed or removed in future versions.
HELPERS
Telebot::Plugin::Telegram::UI implements the following helpers.
tg->ui->input
Send to chat message which looks like input field.
tg->ui->choice
Send to chat message which looks like set of buttons with single choice.
tg->ui->error
Inform user about error in the Telegram chat.
METHODS
Telebot::Plugin::Telegram::UI inherits all methods from Mojolicious::Plugin and implements the following new ones.
register
my $tg = $plugin->register(Mojolicious->new);
Register plugin in Mojolicious application and define helpers.
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.
SEE ALSO
https://github.com/igorlobanov/telebot, Mojolicious::Guides, https://mojolicious.org, https://core.telegram.org/bots/api.