NAME

Telegram::BotKit::Wizard - State automat for Telegram Bots

VERSION

version 0.02

SYNOPSIS

my $wizard = Telegram::BotKit::Wizard->new({ screens_arrayref => [{},{}, ... , {}], dyn_kbs_class=>'Test::Class', serialize_func => \&test_func(), # not implemented now keyboard_type => 'inline' # regular by default, default_welcome_msg => '', # message to show if there is no 'welcome_msg' attr at screen debug => 1 )};

my $msg = $w->process($update); $api->sendMessage($msg); # my $api = WWW::Telegram::BotAPI->new(token => '');

METHODS

defaults

Set defaults for non-obligatory parameters

get_screen

Get screen depending on was /start cmd sent or previous screen in session

build_keyboard_array

Create an array for keyboard

Works both with static or dynamic screens

build_msg

Build message depending on $screen, $chat_id and $callback_msg

$self->build_msg($screen, $chat_id, $text)

update_session

Correct update of session. Here you can see which parameters of screen to save

process

Main public subroutine. Process Update object and return msg for sendMessage method

AUTHOR

Pavel Serikov <pavelsr@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2016 by Pavel Serikov.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.