yatbcpp  0.0.1
Yet another Telegram Bot CPP Library
Public Member Functions | Private Member Functions | Private Attributes | List of all members
yatbcpp::Bot Class Reference

#include "Bot.h"

Collaboration diagram for yatbcpp::Bot:
Collaboration graph
[legend]

Public Member Functions

 Bot (Token &T)
 
void startLongPoll ()
 
void startLongPoll (long timeout)
 
void stopLongPoll ()
 
void startUpdating ()
 
void stopUpdating ()
 
const User getMe () const
 
void addOnUpdateListener (std::function< void(Update)> Listener)
 
void addOnMessageBotCommandListener (std::function< void(Message, MessageEntity)> Listener)
 
void addOnMessageListener (std::function< void(Message)> Listener)
 
void addOnMessageEditedListener (std::function< void(Message)> Listener)
 
void addOnChannelPostListener (std::function< void(Message)> Listener)
 
void addOnChannelPostEditedListener (std::function< void(Message)> Listener)
 
void addOnInlineQueryListener (std::function< void(InlineQuery)> Listener)
 
void join ()
 
const Message send (sendMessage sendMessage) const
 

Private Member Functions

void LongPolling (long timeout)
 
void NotifyRegisteredListeners ()
 

Private Attributes

const Token token
 
std::thread Polling
 
std::thread Updating
 
bool isPolling
 
bool isUpdating
 
std::mutex m
 
std::queue< UpdatependingUpdates
 
std::condition_variable pendingUpdatesAvailable
 
std::vector< std::function< void(Update)> > OnUpdateListeners
 
std::vector< std::function< void(Message, MessageEntity)> > OnMessageCommandListener
 
std::vector< std::function< void(Message)> > OnMessageListener
 
std::vector< std::function< void(Message)> > OnMessageEditedListener
 
std::vector< std::function< void(Message)> > OnChannelPostListener
 
std::vector< std::function< void(Message)> > OnChannelPostEditedListener
 
std::vector< std::function< void(InlineQuery)> > OnInlineQueryListener
 

Detailed Description

Definition at line 28 of file Bot.h.

Constructor & Destructor Documentation

◆ Bot()

Bot::Bot ( Token T)

Definition at line 31 of file Bot.cc.

Member Function Documentation

◆ addOnChannelPostEditedListener()

void Bot::addOnChannelPostEditedListener ( std::function< void(Message)>  Listener)

Definition at line 234 of file Bot.cc.

◆ addOnChannelPostListener()

void Bot::addOnChannelPostListener ( std::function< void(Message)>  Listener)

Definition at line 230 of file Bot.cc.

◆ addOnInlineQueryListener()

void Bot::addOnInlineQueryListener ( std::function< void(InlineQuery)>  Listener)

Definition at line 238 of file Bot.cc.

◆ addOnMessageBotCommandListener()

void Bot::addOnMessageBotCommandListener ( std::function< void(Message, MessageEntity)>  Listener)

Definition at line 218 of file Bot.cc.

◆ addOnMessageEditedListener()

void Bot::addOnMessageEditedListener ( std::function< void(Message)>  Listener)

Definition at line 226 of file Bot.cc.

◆ addOnMessageListener()

void Bot::addOnMessageListener ( std::function< void(Message)>  Listener)

Definition at line 222 of file Bot.cc.

◆ addOnUpdateListener()

void Bot::addOnUpdateListener ( std::function< void(Update)>  Listener)

Definition at line 215 of file Bot.cc.

◆ getMe()

const User Bot::getMe ( ) const

Definition at line 246 of file Bot.cc.

Here is the call graph for this function:

◆ join()

void Bot::join ( )

Function to join the main threads so cpu load is not 100 % when using this

Returns

Definition at line 44 of file Bot.cc.

◆ LongPolling()

void Bot::LongPolling ( long  timeout)
private

Definition at line 95 of file Bot.cc.

Here is the call graph for this function:

◆ NotifyRegisteredListeners()

void Bot::NotifyRegisteredListeners ( )
private

Definition at line 160 of file Bot.cc.

Here is the call graph for this function:

◆ send()

const Message Bot::send ( sendMessage  sendMessage) const

Definition at line 253 of file Bot.cc.

Here is the call graph for this function:

◆ startLongPoll() [1/2]

void Bot::startLongPoll ( )

Defaults starts with a timeout of 100s

Definition at line 72 of file Bot.cc.

◆ startLongPoll() [2/2]

void Bot::startLongPoll ( long  timeout)

Definition at line 76 of file Bot.cc.

Here is the call graph for this function:

◆ startUpdating()

void Bot::startUpdating ( )

Definition at line 149 of file Bot.cc.

Here is the call graph for this function:

◆ stopLongPoll()

void Bot::stopLongPoll ( )

Definition at line 87 of file Bot.cc.

◆ stopUpdating()

void Bot::stopUpdating ( )

Definition at line 155 of file Bot.cc.

Member Data Documentation

◆ isPolling

bool yatbcpp::Bot::isPolling
private

Definition at line 74 of file Bot.h.

◆ isUpdating

bool yatbcpp::Bot::isUpdating
private

Definition at line 75 of file Bot.h.

◆ m

std::mutex yatbcpp::Bot::m
private

Definition at line 80 of file Bot.h.

◆ OnChannelPostEditedListener

std::vector<std::function<void(Message)> > yatbcpp::Bot::OnChannelPostEditedListener
private

Definition at line 89 of file Bot.h.

◆ OnChannelPostListener

std::vector<std::function<void(Message)> > yatbcpp::Bot::OnChannelPostListener
private

Definition at line 88 of file Bot.h.

◆ OnInlineQueryListener

std::vector<std::function<void(InlineQuery)> > yatbcpp::Bot::OnInlineQueryListener
private

Definition at line 90 of file Bot.h.

◆ OnMessageCommandListener

std::vector<std::function<void(Message,MessageEntity)> > yatbcpp::Bot::OnMessageCommandListener
private

Definition at line 85 of file Bot.h.

◆ OnMessageEditedListener

std::vector<std::function<void(Message)> > yatbcpp::Bot::OnMessageEditedListener
private

Definition at line 87 of file Bot.h.

◆ OnMessageListener

std::vector<std::function<void(Message)> > yatbcpp::Bot::OnMessageListener
private

Definition at line 86 of file Bot.h.

◆ OnUpdateListeners

std::vector<std::function<void(Update)> > yatbcpp::Bot::OnUpdateListeners
private

Definition at line 84 of file Bot.h.

◆ pendingUpdates

std::queue<Update> yatbcpp::Bot::pendingUpdates
private

Definition at line 81 of file Bot.h.

◆ pendingUpdatesAvailable

std::condition_variable yatbcpp::Bot::pendingUpdatesAvailable
private

Definition at line 82 of file Bot.h.

◆ Polling

std::thread yatbcpp::Bot::Polling
private

Definition at line 71 of file Bot.h.

◆ token

const Token yatbcpp::Bot::token
private

Definition at line 67 of file Bot.h.

◆ Updating

std::thread yatbcpp::Bot::Updating
private

Definition at line 72 of file Bot.h.


The documentation for this class was generated from the following files: