Bot-Telegram
view release on metacpan or search on metacpan
t/01-polling.t view on Meta::CPAN
{ timeout => 30, allowed_updates => ['message'], offset => 0 },
'custom config';
});
# NOTE: the polling loop is currently active
eval { $bot -> start_polling({ timeout => 30, allowed_updates => ['message'] }, restart => 1) };
ok !$@, 'named options';
};
# Multiple iterations (make sure the next _poll actually gets scheduled)
my $counter = 0;
$bot -> stop_polling;
$bot -> api(bot_api
+(map {random_valid_polling_response} 1 .. 3), # this API "responds" 3 times
sub { $counter++ } # count requests
);
# 1 / 0.2 = 5 update sets per second under ideal circumstances, given that no actual network activity is happening and "updates" are returned instantly
( run in 1.259 second using v1.01-cache-2.11-cpan-96521ef73a4 )