tgbot-cpp
TgBot::EventBroadcaster Class Reference

#include <EventBroadcaster.h>

Public Types

typedef std::function< void(const Message::Ptr)> MessageListener
 
typedef std::function< void(const InlineQuery::Ptr)> InlineQueryListener
 
typedef std::function< void(const ChosenInlineResult::Ptr)> ChosenInlineResultListener
 
typedef std::function< void(const CallbackQuery::Ptr)> CallbackQueryListener
 

Public Member Functions

void onAnyMessage (const MessageListener &listener)
 
void onCommand (const std::string &commandName, const MessageListener &listener)
 
void onCommand (const std::initializer_list< std::string > &commandsList, const MessageListener &listener)
 
void onUnknownCommand (const MessageListener &listener)
 
void onNonCommandMessage (const MessageListener &listener)
 
void onInlineQuery (const InlineQueryListener &listener)
 
void onChosenInlineResult (const ChosenInlineResultListener &listener)
 
void onCallbackQuery (const CallbackQueryListener &listener)
 

Detailed Description

This class holds all event listeners.

Definition at line 44 of file EventBroadcaster.h.

Member Typedef Documentation

◆ CallbackQueryListener

Definition at line 52 of file EventBroadcaster.h.

◆ ChosenInlineResultListener

Definition at line 51 of file EventBroadcaster.h.

◆ InlineQueryListener

Definition at line 50 of file EventBroadcaster.h.

◆ MessageListener

typedef std::function<void (const Message::Ptr)> TgBot::EventBroadcaster::MessageListener

Definition at line 49 of file EventBroadcaster.h.

Member Function Documentation

◆ onAnyMessage()

void TgBot::EventBroadcaster::onAnyMessage ( const MessageListener listener)
inline

Registers listener which receives all messages which the bot can ever receive.

Parameters
listenerListener.

Definition at line 58 of file EventBroadcaster.h.

◆ onCallbackQuery()

void TgBot::EventBroadcaster::onCallbackQuery ( const CallbackQueryListener listener)
inline

Definition at line 115 of file EventBroadcaster.h.

◆ onChosenInlineResult()

void TgBot::EventBroadcaster::onChosenInlineResult ( const ChosenInlineResultListener listener)
inline

Registers listener which receives all the chosen inline result.

Parameters
listenerListener.

Definition at line 111 of file EventBroadcaster.h.

◆ onCommand() [1/2]

void TgBot::EventBroadcaster::onCommand ( const std::string &  commandName,
const MessageListener listener 
)
inline

Registers listener which receives all messages with commands (messages with leading '/' char).

Parameters
commandNameCommand name which listener can handle.
listenerListener.

Definition at line 67 of file EventBroadcaster.h.

◆ onCommand() [2/2]

void TgBot::EventBroadcaster::onCommand ( const std::initializer_list< std::string > &  commandsList,
const MessageListener listener 
)
inline

Registers listener which receives all messages with commands (messages with leading '/' char).

Parameters
commandsListCommands names which listener can handle.
listenerListener.

Definition at line 76 of file EventBroadcaster.h.

◆ onInlineQuery()

void TgBot::EventBroadcaster::onInlineQuery ( const InlineQueryListener listener)
inline

Registers listener which receives all the inline query.

Parameters
listenerListener.

Definition at line 103 of file EventBroadcaster.h.

◆ onNonCommandMessage()

void TgBot::EventBroadcaster::onNonCommandMessage ( const MessageListener listener)
inline

Registers listener which receives all messages without commands (messages with no leading '/' char)

Parameters
listenerListener.

Definition at line 95 of file EventBroadcaster.h.

◆ onUnknownCommand()

void TgBot::EventBroadcaster::onUnknownCommand ( const MessageListener listener)
inline

Registers listener which receives all messages with commands (messages with leading '/' char) which haven't been handled by other listeners.

Parameters
listenerListener.

Definition at line 87 of file EventBroadcaster.h.


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