|
tgbot-cpp
|
This class holds all event listeners. More...
#include <EventBroadcaster.h>
Public Types | |
| using | MessageListener = std::function<void(std::shared_ptr<Message>)> |
| using | InlineQueryListener = std::function<void(std::shared_ptr<InlineQuery>)> |
| using | ChosenInlineResultListener = std::function<void(std::shared_ptr<ChosenInlineResult>)> |
| using | CallbackQueryListener = std::function<void(std::shared_ptr<CallbackQuery>)> |
| using | ShippingQueryListener = std::function<void(std::shared_ptr<ShippingQuery>)> |
| using | PreCheckoutQueryListener = std::function<void(std::shared_ptr<PreCheckoutQuery>)> |
| using | PollListener = std::function<void(std::shared_ptr<Poll>)> |
| using | PollAnswerListener = std::function<void(std::shared_ptr<PollAnswer>)> |
| using | ChatMemberUpdatedListener = std::function<void(std::shared_ptr<ChatMemberUpdated>)> |
| using | ChatJoinRequestListener = std::function<void(std::shared_ptr<ChatJoinRequest>)> |
| using | MessageReactionUpdatedListener = std::function<void(std::shared_ptr<MessageReactionUpdated>)> |
| using | MessageReactionCountUpdatedListener = std::function<void(std::shared_ptr<MessageReactionCountUpdated>)> |
| using | SuccessfulPaymentListener = std::function<void(std::shared_ptr<Message>, std::shared_ptr<SuccessfulPayment>)> |
Public Member Functions | |
| void | onAnyMessage (const MessageListener &listener) |
| Registers listener which receives new incoming message of any kind - text, photo, sticker, etc. | |
| void | onCommand (const std::string &commandName, const MessageListener &listener) |
| Registers listener which receives all messages with commands (messages with leading '/' char). | |
| void | onCommand (const std::initializer_list< std::string > &commandsList, const MessageListener &listener) |
| Registers listener which receives all messages with commands (messages with leading '/' char). | |
| void | onUnknownCommand (const MessageListener &listener) |
| Registers listener which receives all messages with commands (messages with leading '/' char) which haven't been handled by other listeners. | |
| void | onNonCommandMessage (const MessageListener &listener) |
| Registers listener which receives all messages without commands (messages with no leading '/' char). | |
| void | onEditedMessage (const MessageListener &listener) |
| Registers listener which receives new versions of a message that is known to the bot and was edited. | |
| void | onInlineQuery (const InlineQueryListener &listener) |
| Registers listener which receives new incoming inline queries. | |
| void | onChosenInlineResult (const ChosenInlineResultListener &listener) |
| Registers listener which receives the results of an inline query that was chosen by a user and sent to their chat partner. Please see https://core.telegram.org/bots/inline#collecting-feedback for details on how to enable these updates for your bot. | |
| void | onCallbackQuery (const CallbackQueryListener &listener) |
| Registers listener which receives new incoming callback queries. | |
| void | onShippingQuery (const ShippingQueryListener &listener) |
| Registers listener which receives new incoming shipping queries. Only for invoices with flexible price. | |
| void | onPreCheckoutQuery (const PreCheckoutQueryListener &listener) |
| Registers listener which receives new incoming pre-checkout queries. Contains full information about checkout. | |
| void | onPoll (const PollListener &listener) |
| Registers listener which receives new poll states. Bots receive only updates about stopped polls and polls, which are sent by the bot. | |
| void | onPollAnswer (const PollAnswerListener &listener) |
| Registers listener which receives an answer if a user changed their answer in a non-anonymous poll. Bots receive new votes only in polls that were sent by the bot itself. | |
| void | onMyChatMember (const ChatMemberUpdatedListener &listener) |
| Registers listener which receives the bot's chat member status if it was updated in a chat. For private chats, this update is received only when the bot is blocked or unblocked by the user. | |
| void | onChatMember (const ChatMemberUpdatedListener &listener) |
| Registers listener which receives a status if a chat member's status was updated in a chat. The bot must be an administrator in the chat and must explicitly specify “chat_member” in the list of allowedUpdates to receive these updates. | |
| void | onChatJoinRequest (const ChatJoinRequestListener &listener) |
| Registers listener which receives requests to join the chat. The bot must have the canInviteUsers administrator right in the chat to receive these updates. | |
| void | onMessageReaction (const MessageReactionUpdatedListener &listener) |
| Registers listener which receives new incoming message reaction update event. | |
| void | onMessageReactionCount (const MessageReactionCountUpdatedListener &listener) |
| Registers listener which receives new incoming message reaction count update event. | |
| void | onSuccessfulPayment (const SuccessfulPaymentListener &listener) |
| Registers listener which receives information about successful payments. This listener is triggered when a successful payment is received by the bot. | |
This class holds all event listeners.
Definition at line 21 of file EventBroadcaster.h.
| using TgBot::EventBroadcaster::CallbackQueryListener = std::function<void(std::shared_ptr<CallbackQuery>)> |
Definition at line 28 of file EventBroadcaster.h.
| using TgBot::EventBroadcaster::ChatJoinRequestListener = std::function<void(std::shared_ptr<ChatJoinRequest>)> |
Definition at line 34 of file EventBroadcaster.h.
| using TgBot::EventBroadcaster::ChatMemberUpdatedListener = std::function<void(std::shared_ptr<ChatMemberUpdated>)> |
Definition at line 33 of file EventBroadcaster.h.
| using TgBot::EventBroadcaster::ChosenInlineResultListener = std::function<void(std::shared_ptr<ChosenInlineResult>)> |
Definition at line 27 of file EventBroadcaster.h.
| using TgBot::EventBroadcaster::InlineQueryListener = std::function<void(std::shared_ptr<InlineQuery>)> |
Definition at line 26 of file EventBroadcaster.h.
| using TgBot::EventBroadcaster::MessageListener = std::function<void(std::shared_ptr<Message>)> |
Definition at line 25 of file EventBroadcaster.h.
| using TgBot::EventBroadcaster::MessageReactionCountUpdatedListener = std::function<void(std::shared_ptr<MessageReactionCountUpdated>)> |
Definition at line 36 of file EventBroadcaster.h.
| using TgBot::EventBroadcaster::MessageReactionUpdatedListener = std::function<void(std::shared_ptr<MessageReactionUpdated>)> |
Definition at line 35 of file EventBroadcaster.h.
| using TgBot::EventBroadcaster::PollAnswerListener = std::function<void(std::shared_ptr<PollAnswer>)> |
Definition at line 32 of file EventBroadcaster.h.
| using TgBot::EventBroadcaster::PollListener = std::function<void(std::shared_ptr<Poll>)> |
Definition at line 31 of file EventBroadcaster.h.
| using TgBot::EventBroadcaster::PreCheckoutQueryListener = std::function<void(std::shared_ptr<PreCheckoutQuery>)> |
Definition at line 30 of file EventBroadcaster.h.
| using TgBot::EventBroadcaster::ShippingQueryListener = std::function<void(std::shared_ptr<ShippingQuery>)> |
Definition at line 29 of file EventBroadcaster.h.
| using TgBot::EventBroadcaster::SuccessfulPaymentListener = std::function<void(std::shared_ptr<Message>, std::shared_ptr<SuccessfulPayment>)> |
Definition at line 37 of file EventBroadcaster.h.
| void TgBot::EventBroadcaster::onAnyMessage | ( | const MessageListener & | listener | ) |
Registers listener which receives new incoming message of any kind - text, photo, sticker, etc.
| listener | Listener. |
| void TgBot::EventBroadcaster::onCallbackQuery | ( | const CallbackQueryListener & | listener | ) |
Registers listener which receives new incoming callback queries.
| listener | Listener. |
| void TgBot::EventBroadcaster::onChatJoinRequest | ( | const ChatJoinRequestListener & | listener | ) |
Registers listener which receives requests to join the chat. The bot must have the canInviteUsers administrator right in the chat to receive these updates.
| listener | Listener. |
| void TgBot::EventBroadcaster::onChatMember | ( | const ChatMemberUpdatedListener & | listener | ) |
Registers listener which receives a status if a chat member's status was updated in a chat. The bot must be an administrator in the chat and must explicitly specify “chat_member” in the list of allowedUpdates to receive these updates.
| listener | Listener. |
| void TgBot::EventBroadcaster::onChosenInlineResult | ( | const ChosenInlineResultListener & | listener | ) |
Registers listener which receives the results of an inline query that was chosen by a user and sent to their chat partner. Please see https://core.telegram.org/bots/inline#collecting-feedback for details on how to enable these updates for your bot.
| listener | Listener. |
| void TgBot::EventBroadcaster::onCommand | ( | const std::initializer_list< std::string > & | commandsList, |
| const MessageListener & | listener ) |
Registers listener which receives all messages with commands (messages with leading '/' char).
| commandsList | Commands names which listener can handle. |
| listener | Listener. Pass nullptr to remove listener of commands |
| void TgBot::EventBroadcaster::onCommand | ( | const std::string & | commandName, |
| const MessageListener & | listener ) |
Registers listener which receives all messages with commands (messages with leading '/' char).
| commandName | Command name which listener can handle. |
| listener | Listener. Pass nullptr to remove listener of command |
| void TgBot::EventBroadcaster::onEditedMessage | ( | const MessageListener & | listener | ) |
Registers listener which receives new versions of a message that is known to the bot and was edited.
| listener | Listener. |
| void TgBot::EventBroadcaster::onInlineQuery | ( | const InlineQueryListener & | listener | ) |
Registers listener which receives new incoming inline queries.
| listener | Listener. |
| void TgBot::EventBroadcaster::onMessageReaction | ( | const MessageReactionUpdatedListener & | listener | ) |
Registers listener which receives new incoming message reaction update event.
| listener | Listener. |
| void TgBot::EventBroadcaster::onMessageReactionCount | ( | const MessageReactionCountUpdatedListener & | listener | ) |
Registers listener which receives new incoming message reaction count update event.
| listener | Listener. |
| void TgBot::EventBroadcaster::onMyChatMember | ( | const ChatMemberUpdatedListener & | listener | ) |
Registers listener which receives the bot's chat member status if it was updated in a chat. For private chats, this update is received only when the bot is blocked or unblocked by the user.
| listener | Listener. |
| void TgBot::EventBroadcaster::onNonCommandMessage | ( | const MessageListener & | listener | ) |
Registers listener which receives all messages without commands (messages with no leading '/' char).
| listener | Listener. |
| void TgBot::EventBroadcaster::onPoll | ( | const PollListener & | listener | ) |
Registers listener which receives new poll states. Bots receive only updates about stopped polls and polls, which are sent by the bot.
| listener | Listener. |
| void TgBot::EventBroadcaster::onPollAnswer | ( | const PollAnswerListener & | listener | ) |
Registers listener which receives an answer if a user changed their answer in a non-anonymous poll. Bots receive new votes only in polls that were sent by the bot itself.
| listener | Listener. |
| void TgBot::EventBroadcaster::onPreCheckoutQuery | ( | const PreCheckoutQueryListener & | listener | ) |
Registers listener which receives new incoming pre-checkout queries. Contains full information about checkout.
| listener | Listener. |
| void TgBot::EventBroadcaster::onShippingQuery | ( | const ShippingQueryListener & | listener | ) |
Registers listener which receives new incoming shipping queries. Only for invoices with flexible price.
| listener | Listener. |
| void TgBot::EventBroadcaster::onSuccessfulPayment | ( | const SuccessfulPaymentListener & | listener | ) |
Registers listener which receives information about successful payments. This listener is triggered when a successful payment is received by the bot.
| listener | Listener. |
| void TgBot::EventBroadcaster::onUnknownCommand | ( | const MessageListener & | listener | ) |
Registers listener which receives all messages with commands (messages with leading '/' char) which haven't been handled by other listeners.
| listener | Listener. |