Handle long (or short) polling for a bot.
More...
#include <polling.hpp>
|
| Polling (T bot, uint_fast8_t threads_number, uint_fast32_t limit=100, uint_fast32_t timeout=60) |
| Create a polling object by passing a single bot, and the number of threads. More...
|
|
| Polling (std::vector< T > bots, uint_fast32_t limit=100, uint_fast32_t timeout=60) |
| Create a polling object by passing a vector of bots of the same type. More...
|
|
void | run () |
| Start the polling.
|
|
|
std::vector< T > | bots |
| Vector of bots.
|
|
moodycamel::BlockingConcurrentQueue< types::Update > | updates_queue |
| Queue of the updates to process.
|
|
std::shared_ptr< spdlog::logger > | console_stderr |
| Logger that will print error messages to the console.
|
|
std::shared_ptr< spdlog::logger > | console_stdout |
| Logger that will print messages to the console.
|
|
template<class T>
class cppgram::Polling< T >
Handle long (or short) polling for a bot.
◆ Polling() [1/2]
Polling |
( |
T |
bot, |
|
|
uint_fast8_t |
threads_number, |
|
|
uint_fast32_t |
limit = 100 , |
|
|
uint_fast32_t |
timeout = 60 |
|
) |
| |
Create a polling object by passing a single bot, and the number of threads.
- Parameters
-
bot | Bot that will handle updates. |
threads_number | Number of threads that will run asynchronously. |
limit | Limits the number of updates to be retrieved. Values between 1—100 are accepted. |
timeout | Timeout in seconds for long polling. Defaults to 0, i.e. usual short polling. |
◆ Polling() [2/2]
Polling |
( |
std::vector< T > |
bots, |
|
|
uint_fast32_t |
limit = 100 , |
|
|
uint_fast32_t |
timeout = 60 |
|
) |
| |
Create a polling object by passing a vector of bots of the same type.
- Parameters
-
bots | Vector of bots that will run asynchronously. |
limit | Limits the number of updates to be retrieved. Values between 1—100 are accepted. |
timeout | Timeout in seconds for long polling. Defaults to 0, i.e. usual short polling. |
◆ firstUpdateID()
uint_fast32_t firstUpdateID |
( |
T & |
poller | ) |
|
|
private |
Get the offset of the first update to process.
- Returns
- Update offset.
◆ init()
Init logger for each bot.
The documentation for this class was generated from the following files: