xxtelebot
1.4.1.0
A simple Telegram Bot implementation in C++
|
Long polling bot, (see LongPollBot::start() function) More...
#include <bot.h>
Public Member Functions | |
LongPollBot (const std::string &token, const std::vector< types::UpdateType > &filterUpdates={}, const int &limit=100, const int &timeout=60) | |
Bot class constructor. More... | |
LongPollBot (const LongPollBot &)=delete | |
LongPollBot (LongPollBot &&)=default | |
LongPollBot & | operator= (const LongPollBot &)=delete |
LongPollBot & | operator= (LongPollBot &&)=default |
void | start () override |
start long polling | |
Public Member Functions inherited from tgbot::Bot | |
Bot (const Bot &)=default | |
Bot (Bot &&)=default | |
Bot & | operator= (const Bot &)=default |
Bot & | operator= (Bot &&)=default |
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::Message > | sendMediaGroup (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::GameHighScore > | getGameHighScores (const int &userId, const std::string &inlineMessageId) const |
std::vector< api_types::GameHighScore > | getGameHighScores (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::ChatMember > | getChatAdministrators (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 |
Logger & | getLogger () |
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 |
Long polling bot, (see LongPollBot::start() function)
|
explicit |