NAME
Telegram::BotKit::Sessions - Implements memory of Telegram::BotKit::Wizard state automat. Almost all methods has at least one argument = chat_id
VERSION
version 0.01
SYNOPSIS
my $sess = Telegram::BotKit::Sessions->new();
$sess->start(12345); # 12345 = chat_id
METHODS
new
Create a new session object.
Keys will be chat_id and values = array of Update objects (or its particular fields)
all
Return all session for specified chat_id
$session->all($chat_id);
all_keys_arr
Return array contains from all messages of session with particular chatId and $key
Can be useful while data serialization
$session->all_keys_arr($chat_id, 'some_key'); # ['Value 1', 'Value 2']
start
Start session for particular chat_id
$session->start($chat_id);
del
Delete session for particular chat_id
$session->del($chat_id);
set
Method for inserting any data into session
Mainly intended for unit testing, also can be used for data serialization
$session->set($chat_id, $array);
update
Update session for particular chat_id
$session->update($chat_id, $data_to_store_in_session);
last
Return last element of session for particular chat_id
$session->last($chat_id);
combine_properties
Return hash that combines two properies of session
combine_properties_retrospective
Return hash that combines two properies of session from specified and previous screens
get_replies_hash
specific usage of combine_properties_retrospective()
Combine "screen" property from i session element and "callback_text" from i+1 session element
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.