xxtelebot  1.4.1.0
A simple Telegram Bot implementation in C++
Public Member Functions | List of all members
tgbot::WebhookBot Class Reference

Webhook bot (see WebhookBot::start() function) More...

#include <bot.h>

Inheritance diagram for tgbot::WebhookBot:
tgbot::Bot tgbot::methods::Api tgbot::RegisterCallback

Public Member Functions

 WebhookBot ()=delete
 Missing webhook implementation. Not scheduled.
 
 WebhookBot (const std::string &token)=delete
 Construct and nothing more. Call setWebhook() before start() :) More...
 
 WebhookBot (const std::string &token, const std::string &url, const int &maxConnections=40, const std::vector< types::UpdateType > &filterUpdates={})=delete
 Call setWebhook() after field initialization, if something wrong, then throw TelegramException. No self-signed certificate upload. More...
 
 WebhookBot (const std::string &token, const std::string &url, const std::string &certificate, const int &maxConnections=40, const std::vector< types::UpdateType > &filterUpdates={})=delete
 Call setWebhook() after field initialization, if something wrong, then throw TelegramException. UPLOADS SELF-SIGNED CERTIFICATE More...
 
 WebhookBot (const WebhookBot &)=delete
 
 WebhookBot (WebhookBot &&)=delete
 
WebhookBotoperator= (const WebhookBot &)=delete
 
WebhookBotoperator= (WebhookBot &&)=delete
 
- Public Member Functions inherited from tgbot::Bot
 Bot (const Bot &)=default
 
 Bot (Bot &&)=default
 
Botoperator= (const Bot &)=default
 
Botoperator= (Bot &&)=default
 
virtual void start ()
 
void notifyEachUpdate (bool t)
 log each update? (received update - ${UPDATE_ID}) (false by default) More...
 
- Public Member Functions inherited from tgbot::methods::Api
api_types::Message sendMessage (const std::string &chatId, const std::string &text, const types::ParseMode &=types::ParseMode::DEFAULT, const bool &disableWebPagePreview=false, const bool &disableNotification=false, const types::ReplyMarkup &replyMarkup="") const
 
api_types::Message sendMessage (const std::string &chatId, const std::string &text, const int &replyToMessageId, const types::ParseMode &=types::ParseMode::DEFAULT, const bool &disableWebPagePreview=false, const bool &disableNotification=false, const types::ReplyMarkup &replyMarkup="") const
 
api_types::Message forwardMessage (const std::string &chatId, const std::string &fromChatId, const int &messageId, const bool &disableNotification=false) const
 
api_types::Message sendPhoto (const std::string &chatId, const std::string &photo, const types::FileSource &source=types::FileSource::EXTERNAL, const std::string &mimeType="", const std::string &caption="", const bool &disableNotification=false, const int &replyToMessageId=-1, const types::ReplyMarkup &replyMarkup="") const
 
api_types::Message sendAudio (const std::string &chatId, const std::string &audio, const types::FileSource &source=types::FileSource::EXTERNAL, const std::string &mimeType="", const std::string &caption="", const int &duration=-1, const std::string &performer="", const std::string &title="", const bool &disableNotification=false, const int &replyToMessageId=-1, const types::ReplyMarkup &replyMarkup="") const
 
api_types::Message sendDocument (const std::string &chatId, const std::string &document, const types::FileSource &source=types::FileSource::EXTERNAL, const std::string &mimeType="", const std::string &caption="", const bool &disableNotification=false, const int &replyToMessageId=-1, const types::ReplyMarkup &replyMarkup="") const
 
api_types::Message sendVideo (const std::string &chatId, const std::string &video, const types::FileSource &source=types::FileSource::EXTERNAL, const std::string &mimeType="", const int &duration=-1, const int &width=-1, const int &height=-1, const std::string &caption="", const bool &supportsStreaming=false, const bool &disableNotification=false, const int &replyToMessageId=-1, const types::ReplyMarkup &replyMarkup="") const
 
api_types::Message sendVoice (const std::string &chatId, const std::string &voice, const types::FileSource &source=types::FileSource::EXTERNAL, const std::string &caption="", const int &duration=-1, const bool &disableNotification=false, const int &replyToMessageId=-1, const types::ReplyMarkup &replyMarkup="") const
 
api_types::Message sendVideoNote (const std::string &chatId, const std::string &videoNote, const types::FileSource &source=types::FileSource::EXTERNAL, const std::string &caption="", const int &duration=-1, const bool &disableNotification=false, const int &replyToMessageId=-1, const types::ReplyMarkup &replyMarkup="") const
 
api_types::Message sendLocation (const std::string &chatId, const double &latitude, const double &longitude, const int &liveLocation=-1, const bool &disableNotification=false, const int &replyToMessageId=-1, const types::ReplyMarkup &replyMarkup="") const
 
api_types::Message sendVenue (const std::string &chatId, const double &latitude, const double &longitude, const std::string &title, const std::string &address, const std::string &foursquareType="", const std::string &foursquareId="", const bool &disableNotification=false, const int &replyToMessageId=-1, const types::ReplyMarkup &replyMarkup="") const
 
api_types::Message sendContact (const std::string &chatId, const std::string &phoneNumber, const std::string &firstName, const std::string &vCard="", const std::string &lastName="", const bool &disableNotification=false, const int &replyToMessageId=-1, const types::ReplyMarkup &replyMarkup="") const
 
api_types::Message sendSticker (const std::string &chatId, const std::string &sticker, const types::FileSource &source=types::FileSource::EXTERNAL, const bool &disableNotification=false, const int &replyToMessageId=-1, const types::ReplyMarkup &replyMarkup="") const
 
api_types::Message sendInvoice (const int &chatId, const types::Invoice &invoice, const bool &disableNotification=false, const int &replyToMessageId=-1) const
 Please refer to tgbot::methods::types::Invoice struct.
 
api_types::Message sendInvoice (const int &chatId, const types::Invoice &invoice, const types::InlineKeyboardMarkup &replyMarkup, const bool &disableNotification=false, const int &replyToMessageId=-1) const
 Please refer to tgbot::methods::types::Invoice struct.
 
std::vector< api_types::MessagesendMediaGroup (const std::string &chatId, const std::vector< tgbot::types::Ptr< types::InputMedia >> &media, const bool &disableNotification=false, const int &replyToMessageId=-1) const
 
api_types::Message sendGame (const int &chatId, const std::string &gameShortName, const bool &disableNotification=false, const int &replyToMessageId=-1, const types::ReplyMarkup &replyMarkup="") const
 
api_types::Message sendPoll (const std::string &chatId, const std::string &question, const std::vector< std::string > &options, const bool &disableNotification=false, const int &replyToMessageId=-1, const types::ReplyMarkup &replyMarkup="") const
 
tgbot::types::Poll stopPoll (const std::string &chatId, const int &messageId, const types::ReplyMarkup &replyMarkup="") const
 
api_types::Message setGameScore (const std::string &userId, const int &score, const std::string &inlineMessageId, const bool &force=false, const bool &disableEditMessage=false) const
 
api_types::Message setGameScore (const std::string &userId, const int &score, const int &chatId, const int &messageId, const bool &force=false, const bool &disableEditMessage=false) const
 
std::vector< api_types::GameHighScoregetGameHighScores (const int &userId, const std::string &inlineMessageId) const
 
std::vector< api_types::GameHighScoregetGameHighScores (const int &userId, const int &chatId, const int &messageId) const
 
bool answerShippingQuery (const std::string &shippingQueryId, const std::string &errorMessage) const
 Use this overload if the shipping query cannot proceed.
 
bool answerShippingQuery (const std::string &shippingQueryId, const std::vector< types::ShippingOption > &shippingOptions) const
 Use this overload if the shipping query CAN proceed.
 
bool answerPreCheckoutQuery (const std::string &preCheckoutQueryId, const std::string &errorMessage) const
 Use this overload if the checkout phase can take place.
 
bool answerPreCheckoutQuery (const std::string &preCheckoutQueryId) const
 Use this overload if the checkout phase CANNOT take place.
 
api_types::StickerSet getStickerSet (const std::string &name) const
 
api_types::File uploadStickerFile (const int &userId, const std::string &pngSticker, const types::FileSource &source=types::FileSource::EXTERNAL) const
 
bool createNewStickerSet (const int &userId, const std::string &name, const std::string &title, const std::string &emoji, const std::string &pngSticker, const types::FileSource &source=types::FileSource::EXTERNAL) const
 
bool createNewStickerSet (const int &userId, const std::string &name, const std::string &title, const std::string &emoji, const std::string &pngSticker, const api_types::MaskPosition &maskPosition, const types::FileSource &source=types::FileSource::EXTERNAL) const
 
bool addStickerToSet (const int &userId, const std::string &name, const std::string &emoji, const std::string &pngSticker, const types::FileSource &source=types::FileSource::EXTERNAL) const
 
bool addStickerToSet (const int &userId, const std::string &name, const std::string &emoji, const std::string &pngSticker, const api_types::MaskPosition &maskPosition, const types::FileSource &source=types::FileSource::EXTERNAL) const
 
bool setStickerPositionInSet (const std::string &sticker, const int &position) const
 
bool deleteStickerFromSet (const std::string &sticker) const
 
bool sendChatAction (const std::string &chatId, const types::ChatAction &action) const
 
bool kickChatMember (const std::string &chatId, const int &userId, const int &untilDate=-1) const
 
bool unbanChatMember (const std::string &chatId, const int &userId) const
 
bool restrictChatMember (const std::string &chatId, const int &userId, const types::ChatMemberRestrict &permissions, const int &untilDate=-1) const
 
bool promoteChatMember (const std::string &chatId, const int &userId, const types::ChatMemberPromote &permissions) const
 
std::string exportChatInviteLink (const std::string &chatId) const
 
bool setChatPhoto (const std::string &chatId, const std::string &filename, const std::string &mimeType) const
 
bool deleteChatPhoto (const std::string &chatId) const
 
bool setChatTitle (const std::string &chatId, const std::string &title) const
 
bool setChatDescription (const std::string &chatId, const std::string &description) const
 
bool pinChatMessage (const std::string &chatId, const std::string &messageId, const bool &disableNotification=false) const
 
bool unpinChatMessage (const std::string &chatId) const
 
bool leaveChat (const std::string &chatId) const
 
bool answerCallbackQuery (const std::string &callbackQueryId, const std::string &text="", const bool &showAlert=false, const std::string &url="", const int &cacheTime=0) const
 
bool answerInlineQuery (const std::string &inlineQueryId, const std::vector<::tgbot::types::Ptr< types::InlineQueryResult >> &results, const int &cacheTime=0, const bool &isPersonal=true, const std::string &nextOffset="", const std::string &switchPmText="", const std::string &switchPmParameter="") const
 
api_types::Message editMessageText (const std::string &inlineMessageId, const std::string &text, const types::ParseMode &parseMode=types::ParseMode::DEFAULT, const bool &disableWebPagePreview=false) const
 
api_types::Message editMessageText (const std::string &inlineMessageId, const types::InlineKeyboardMarkup &replyMarkup, const std::string &text, const types::ParseMode &parseMode=types::ParseMode::DEFAULT, const bool &disableWebPagePreview=false) const
 
api_types::Message editMessageText (const std::string &chatId, const std::string &messageId, const std::string &text, const types::ParseMode &parseMode=types::ParseMode::DEFAULT, const bool &disableWebPagePreview=false) const
 
api_types::Message editMessageText (const std::string &chatId, const std::string &messageId, const types::InlineKeyboardMarkup &replyMarkup, const std::string &text, const types::ParseMode &parseMode=types::ParseMode::DEFAULT, const bool &disableWebPagePreview=false) const
 
api_types::Message editMessageReplyMarkup (const std::string &inlineMessageId, const types::InlineKeyboardMarkup &replyMarkup) const
 
api_types::Message editMessageReplyMarkup (const std::string &chatId, const std::string &messageId, const types::InlineKeyboardMarkup &replyMarkup) const
 
api_types::Message editMessageCaption (const std::string &chatId, const std::string &messageId, const std::string &caption) const
 
api_types::Message editMessageCaption (const std::string &inlineMessageId, const std::string &caption) const
 
api_types::Message editMessageCaption (const std::string &chatId, const std::string &messageId, const types::InlineKeyboardMarkup &replyMarkup, const std::string &caption) const
 
api_types::Message editMessageCaption (const std::string &inlineMessageId, const types::InlineKeyboardMarkup &replyMarkup, const std::string &caption) const
 
api_types::Message editMessageLiveLocation (const double &longitude, const double &latitude, const int &chatId, const int &messageId, const types::ReplyMarkup &replyMarkup="") const
 
api_types::Message editMessageLiveLocation (const double &longitude, const double &latitude, const std::string &inlineMessageId, const types::ReplyMarkup &replyMarkup="") const
 
api_types::Message editMessageMedia (const std::string &inlineMessageId, const types::InputMedia &media, const types::ReplyMarkup &replyMarkup="") const
 
api_types::Message editMessageMedia (const std::string &chatId, const int &messageId, const types::InputMedia &media, const types::ReplyMarkup &replyMarkup="") const
 
api_types::Message stopMessageLiveLocation (const int &chatId, const int &messageId, const types::ReplyMarkup &replyMarkup="") const
 
api_types::Message stopMessageLiveLocation (const std::string &inlineMessageId, const types::ReplyMarkup &replyMarkup="") const
 
bool setChatStickerSet (const int &chatId, const std::string &stickerSetName) const
 
bool setChatStickerSet (const std::string &chatId, const std::string &stickerSetName) const
 
bool deleteChatStickerSet (const int &chatId) const
 
bool deleteChatStickerSet (const std::string &chatId) const
 
bool deleteMessage (const std::string &chatId, const std::string &messageId) const
 
api_types::User getMe () const
 
api_types::File getFile (const std::string &fileId) const
 
api_types::Chat getChat (const std::string &chatId) const
 
std::vector< api_types::ChatMembergetChatAdministrators (const std::string &chatId) const
 
unsigned getChatMembersCount (const std::string &chatId) const
 
api_types::ChatMember getChatMember (const std::string &chatId, const int &userId) const
 
api_types::UserProfilePhotos getUserProfilePhotos (const int &userId, const unsigned &offset=0, const unsigned &limit=100) const
 
bool deleteWebhook () const
 
api_types::WebhookInfo getWebhookInfo () const
 
bool setWebhook (const std::string &url, const int &maxConnections=40, const std::vector< api_types::UpdateType > &allowedUpdates={})
 
bool setWebhook (const std::string &url, const std::string &certificate, const int &maxConnections=40, const std::vector< api_types::UpdateType > &allowedUpdates={})
 
Logger const & getLogger () const
 
LoggergetLogger ()
 
- Public Member Functions inherited from tgbot::RegisterCallback
void callback (bool(&matcherCallback)(const std::string &, const char *), void(&callback)(const types::Message, const methods::Api &, const std::vector< std::string >), const char *matchWord, const char sep= ' ')
 C-style function pointer callback overload, associate with command. More...
 
void callback (bool(&matcherCallback)(const std::string &, const char *), std::function< void(const types::Message, const methods::Api &, const std::vector< std::string >)> callback, const char *matchWord, const char sep= ' ')
 std::function wrapper callback overload, associate with command (ability to use lambdas More...
 
void callback (std::function< bool(const std::string &, const char *)> matcherCallback, void(&callback)(const types::Message, const methods::Api &, const std::vector< std::string >), const char *matchWord, const char sep= ' ')
 C-style function pointer callback overload, associate with command. More...
 
void callback (std::function< bool(const std::string &, const char *)> matcherCallback, std::function< void(const types::Message, const methods::Api &, const std::vector< std::string >)> callback, const char *matchWord, const char sep= ' ')
 std::function wrapper callback overload, associate with command (ability to use lambdas More...
 
void callback (void(&callback)(const types::Message, const methods::Api &))
 Message update callback. More...
 
void callback (MessageCallback callback)
 Message update callback. More...
 
void callback (void(&callback)(const types::InlineQuery, const methods::Api &))
 Inline query update callback. More...
 
void callback (InlineQueryCallback callback)
 Inline query update callback. More...
 
void callback (void(&callback)(const types::ChosenInlineResult, const methods::Api &))
 Chosen inline result update callback. More...
 
void callback (ChosenInlineResultCallback callback)
 
void callback (void(&callback)(const types::CallbackQuery, const methods::Api &))
 Callback query update callback. More...
 
void callback (CallbackQueryCallback callback)
 Callback query update callback. More...
 
void callback (void(&callback)(const types::ShippingQuery, const methods::Api &))
 Shipping query update callback. More...
 
void callback (ShippingQueryCallback callback)
 Shipping query update callback. More...
 
void callback (void(&callback)(const types::PreCheckoutQuery, const methods::Api &))
 Pre checkout query update callback. More...
 
void callback (PreCheckoutQueryCallback callback)
 Pre checkout query update callback. More...
 
void callback (void(&callback)(const types::Message, const methods::Api &), const types::UpdateType &which)
 Multiple-options update callback. More...
 
void callback (MessageCallback callback, const types::UpdateType updateType)
 Multiple-options update callback. More...
 

Additional Inherited Members

- Public Types inherited from tgbot::RegisterCallback
using MessageCallback = __T_UpdateCallback< types::Message >
 
using InlineQueryCallback = __T_UpdateCallback< types::InlineQuery >
 
using ChosenInlineResultCallback = __T_UpdateCallback< types::ChosenInlineResult >
 
using CallbackQueryCallback = __T_UpdateCallback< types::CallbackQuery >
 
using ShippingQueryCallback = __T_UpdateCallback< types::ShippingQuery >
 
using PreCheckoutQueryCallback = __T_UpdateCallback< types::PreCheckoutQuery >
 
- Protected Types inherited from tgbot::RegisterCallback
using __Command_Tuple = std::tuple< const char *, std::function< bool(const std::string &, const char *)>, const char, std::function< void(const types::Message, const methods::Api &, const std::vector< std::string >)> >
 
- Protected Member Functions inherited from tgbot::Bot
template<typename... TyArgs>
 Bot (TyArgs &&...many)
 
void makeCallback (const std::vector< types::Update > &updates) const
 
- Protected Member Functions inherited from tgbot::methods::Api
 Api (const std::string &token)
 
 Api (const std::string &token, const std::vector< api_types::UpdateType > &allowedUpdates, const int &timeout, const int &limit)
 
 Api (const std::string &token, const std::string &url, const int &maxConnections, const std::vector< api_types::UpdateType > &allowedUpdates)
 
 Api (const std::string &token, const std::string &url, const std::string &certificate, const int &maxConnections, const std::vector< api_types::UpdateType > &allowedUpdates)
 
int getUpdates (void *c, std::vector< api_types::Update > &updates)
 
- Protected Attributes inherited from tgbot::methods::Api
std::string urlWebhook {""}
 
- Protected Attributes inherited from tgbot::RegisterCallback
MessageCallback messageCallback
 
InlineQueryCallback inlineQueryCallback
 
ChosenInlineResultCallback chosenInlineResultCallback
 
CallbackQueryCallback callbackQueryCallback
 
ShippingQueryCallback shippingQueryCallback
 
PreCheckoutQueryCallback preCheckoutQueryCallback
 
MessageCallback editedMessageCallback
 
MessageCallback editedChannelPostCallback
 
MessageCallback channelPostCallback
 
std::vector< __Command_Tuple > commandCallback
 

Detailed Description

Webhook bot (see WebhookBot::start() function)

Constructor & Destructor Documentation

tgbot::WebhookBot::WebhookBot ( const std::string &  token)
delete

Construct and nothing more. Call setWebhook() before start() :)

Parameters
token: Bot token
tgbot::WebhookBot::WebhookBot ( const std::string &  token,
const std::string &  url,
const int &  maxConnections = 40,
const std::vector< types::UpdateType > &  filterUpdates = {} 
)
delete

Call setWebhook() after field initialization, if something wrong, then throw TelegramException. No self-signed certificate upload.

Parameters
token: Bot token
url: Where would you like to get updates?
maxConnections: number of maximum connections
filterUpdates: allowed updates
tgbot::WebhookBot::WebhookBot ( const std::string &  token,
const std::string &  url,
const std::string &  certificate,
const int &  maxConnections = 40,
const std::vector< types::UpdateType > &  filterUpdates = {} 
)
delete

Call setWebhook() after field initialization, if something wrong, then throw TelegramException. UPLOADS SELF-SIGNED CERTIFICATE

Parameters
certificate: local path to certificate
token: Bot token
url: Where would you like to get updates?
maxConnections: number of maximum connections
filterUpdates: allowed updates

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