The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Telegram::BotKit::Polling - Implementation of Telegram getUpdates method (long polling). For easy testing your bot code locally

VERSION

version 0.03

SYNOPSIS

        use Telegram::BotKit::Polling qw(get_last_messages);
        my $api = WWW::Telegram::BotAPI->new(token => 'token');
    Mojo::IOLoop->recurring(1 => sub {
                my $hash = get_last_messages($api); # or just post '/' => sub
                while ( my ($chat_id, $update) = each(%$hash) ) {
                        ...
                }
        });

METHODS

get_last_messages

Return last Update for each chat_id if it such Update exists

Technically it returns a hash where keys = chat_id, values = Update object

AUTHOR

Pavel Serikov <pavelsr@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2017 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.