Cppgram
1.0.0
Easy and modern C++14 Telegram Bot API wrapper
|
Functions | |
bool | getUpdates (std::vector< types::Update > &updates, const uint_fast32_t offset=0, const uint_fast32_t limit=100, const uint_fast32_t timeout=60) |
Receive incoming updates using polling (short or long polling based on timeout) More... | |
std::experimental::optional< const class types::Message > | sendMessage (const int_fast64_t chat_id, const std::string &text, const std::string &reply_markup="", const EParseMode parse_mode=EParseMode::HTML, const bool disable_web_page_preview=true, const bool disable_notification=false, const int_fast32_t reply_to_message_id=0) |
Send a message to a specified chat. (https://core.telegram.org/bots/api#sendmessage) More... | |
std::experimental::optional< const class types::Message > | sendMessage (const std::string &chat_id, const std::string &text, const std::string &reply_markup="", const EParseMode parse_mode=EParseMode::HTML, const bool disable_web_page_preview=true, const bool disable_notification=false, const int_fast32_t reply_to_message_id=0) |
Send a message to a specified chat. (https://core.telegram.org/bots/api#sendmessage) More... | |
std::experimental::optional< const class types::Message > | sendMessage (const std::string &text, const std::string &reply_markup="", const EParseMode parse_mode=EParseMode::HTML, const bool disable_web_page_preview=true, const bool disable_notification=false, const int_fast32_t reply_to_message_id=0) |
Send a message to a specified chat. More... | |
bool | answerCallbackQuery (const std::string &text, bool show_alert=false, uint32_t cache_time=0, const std::string &url="") |
Use this method to send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. More... | |
std::experimental::optional< const class types::Message > | editMessageText (const int_fast64_t chat_id, const uint_fast32_t message_id, const std::string &text, const std::string &reply_markup="", const EParseMode parse_mode=static_cast< EParseMode >(1), const bool disable_web_page_preview=true) |
Edit text (and reply markup) of a message sent by the bot. More... | |
std::experimental::optional< const class types::Message > | editMessageText (const std::string &chat_id, const uint_fast32_t message_id, const std::string &text, const std::string &reply_markup="", const EParseMode parse_mode=static_cast< EParseMode >(1), const bool disable_web_page_preview=true) |
Edit text (and reply markup) of a message sent by the bot. More... | |
std::experimental::optional< const class types::Message > | editMessageText (const uint_fast32_t message_id, const std::string &text, const std::string &reply_markup="", const EParseMode parse_mode=static_cast< EParseMode >(1), const bool disable_web_page_preview=true) |
Edit text (and reply markup) of a message sent by the bot. More... | |
bool | editMessageText (const std::string &inline_message_id, const std::string &text, const std::string &reply_markup="", const EParseMode parse_mode=static_cast< EParseMode >(1), const bool disable_web_page_preview=true) |
Edit text (and reply markup) of a message sent via the bot (using inline queries). More... | |
std::experimental::optional< const class types::Message > | editMessageCaption (const int_fast64_t chat_id, const uint_fast32_t message_id, const std::string &caption="", const std::string &reply_markup="") |
Edit captions of messages sent by the bot. More... | |
std::experimental::optional< const class types::Message > | editMessageCaption (const std::string &chat_id, const uint_fast32_t message_id, const std::string &caption="", const std::string &reply_markup="") |
Edit captions of messages sent by the bot. More... | |
std::experimental::optional< const class types::Message > | editMessageCaption (const uint_fast32_t message_id, const std::string &caption="", const std::string &reply_markup="") |
Edit captions of messages sent by the bot. More... | |
bool | editMessageCaption (const std::string &inline_message_id, const std::string &caption, const std::string &reply_markup="") |
Edit captions of messages sent via the bot (using inline_queries). More... | |
std::experimental::optional< const class types::Message > | editMessageReplyMarkup (const int_fast64_t chat_id, const uint_fast32_t message_id, const std::string &reply_markup="") |
Edit only the reply markup of a message sent by the the bot. More... | |
std::experimental::optional< const class types::Message > | editMessageReplyMarkup (const std::string &chat_id, const uint_fast32_t message_id, const std::string &reply_markup="") |
Edit only the reply markup of a message sent by the the bot. More... | |
std::experimental::optional< const class types::Message > | editMessageReplyMarkup (const uint_fast32_t message_id, const std::string &reply_markup="") |
Edit only the reply markup of a message sent by the the bot. More... | |
bool | editMessageReplyMarkup (const std::string &inline_message_id, const std::string &reply_markup="") |
bool | answerInlineQuery (const Json::Value &results, const uint_fast16_t cache_time=300, const bool is_personal=false, const std::string &next_offset="", const std::string &switch_pm_text="", const std::string &switch_pm_paramter="") |
Answer an inline query. (https://core.telegram.org/bots/api#answerinlinequery) More... | |
bool answerCallbackQuery | ( | const std::string & | text, |
bool | show_alert = false , |
||
uint32_t | cache_time = 0 , |
||
const std::string & | url = "" |
||
) |
Use this method to send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert.
text | Text of the notification. If not specified, nothing will be shown to the user, 0-200 characters |
show_alert | If true, an alert will be shown by the client instead of a notification at the top of the chat screen. |
cache_time | The maximum amount of time in seconds that the result of the callback query may be cached client-side. |
URL | that will be opened by the user's client. If you have created a Game and accepted the conditions via , specify the URL that opens your game – note that this will only work if the query comes from a callback_game button. |
bool answerInlineQuery | ( | const Json::Value & | results, |
const uint_fast16_t | cache_time = 300 , |
||
const bool | is_personal = false , |
||
const std::string & | next_offset = "" , |
||
const std::string & | switch_pm_text = "" , |
||
const std::string & | switch_pm_paramter = "" |
||
) |
Answer an inline query. (https://core.telegram.org/bots/api#answerinlinequery)
inline_query_id | Unique identifier for the answered query |
results | JSON serialized array of the results for the inline query. Use InlineQueryResults to create them. |
cache_time | The maximum amount of time in seconds that the result of the inline query may be cached on the server. |
is_personal | Pass True, if results may be cached on the server side only for the user that sent the query. |
next_offset | Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you don‘t support pagination. |
switch_pm_text | If passed, clients will display a button with specified text that switches the user to a private chat with the bot and. sends the bot a start message with the parameter switch_pm_parameter |
switch_pm_paramter | Parameter for the start message sent to the bot when user presses the switch button. |
std::experimental::optional<const class types::Message> editMessageCaption | ( | const int_fast64_t | chat_id, |
const uint_fast32_t | message_id, | ||
const std::string & | caption = "" , |
||
const std::string & | reply_markup = "" |
||
) |
Edit captions of messages sent by the bot.
Leaving reply_markup empty remove it from the edited message. (https://core.telegram.org/bots/api#editmessagecaption)
chat_id | Unique identifier for the target chat. |
caption | New caption of the message. |
reply_markup | Inline keyboard object. |
std::experimental::optional<const class types::Message> editMessageCaption | ( | const std::string & | chat_id, |
const uint_fast32_t | message_id, | ||
const std::string & | caption = "" , |
||
const std::string & | reply_markup = "" |
||
) |
Edit captions of messages sent by the bot.
chat_id | Username of the target channel or group (in the format @channelusername ). (https://core.telegram.org/bots/api#editmessagecaption) |
std::experimental::optional<const class types::Message> editMessageCaption | ( | const uint_fast32_t | message_id, |
const std::string & | caption = "" , |
||
const std::string & | reply_markup = "" |
||
) |
Edit captions of messages sent by the bot.
The chat selected will be the chat from where the current update was received. (https://core.telegram.org/bots/api#editmessagecaption)
bool editMessageCaption | ( | const std::string & | inline_message_id, |
const std::string & | caption, | ||
const std::string & | reply_markup = "" |
||
) |
Edit captions of messages sent via the bot (using inline_queries).
Leaving reply_markup empty remove it from the edited message. (https://core.telegram.org/bots/api#editmessagecaption)
inline_message_id | Identifier of the inline message. |
caption | New caption of the message. |
reply_markup | Inline Keyboard object. |
std::experimental::optional<const class types::Message> editMessageReplyMarkup | ( | const int_fast64_t | chat_id, |
const uint_fast32_t | message_id, | ||
const std::string & | reply_markup = "" |
||
) |
Edit only the reply markup of a message sent by the the bot.
Leaving reply_markup empty remove it from the edited message. (https://core.telegram.org/bots/api#editmessagereplymarkup)
chat_id | Unique identifier for the target chat. |
message_id | Unique identifier of the sent message. |
reply_markup | New inline keyboard object. |
std::experimental::optional<const class types::Message> editMessageReplyMarkup | ( | const std::string & | chat_id, |
const uint_fast32_t | message_id, | ||
const std::string & | reply_markup = "" |
||
) |
Edit only the reply markup of a message sent by the the bot.
chat_id | Username of the target channel or group (in the format @channelusername ). (https://core.telegram.org/bots/api#editmessagereplymarkup) |
std::experimental::optional<const class types::Message> editMessageReplyMarkup | ( | const uint_fast32_t | message_id, |
const std::string & | reply_markup = "" |
||
) |
Edit only the reply markup of a message sent by the the bot.
The chat selected will be the chat from where the current update was received. (https://core.telegram.org/bots/api#editmessagereplymarkup)
bool editMessageReplyMarkup | ( | const std::string & | inline_message_id, |
const std::string & | reply_markup = "" |
||
) |
Edit only the reply markup of a message sent via the the bot (using inline queries). Leaving reply_markup empty remove keyboards from the message edited. (https://core.telegram.org/bots/api#editmessagereplymarkup)
inline_message_id | Identifier of the inline message. |
reply_markup | New inline keyboard object. |
std::experimental::optional<const class types::Message> editMessageText | ( | const int_fast64_t | chat_id, |
const uint_fast32_t | message_id, | ||
const std::string & | text, | ||
const std::string & | reply_markup = "" , |
||
const EParseMode | parse_mode = static_cast< EParseMode >(1) , |
||
const bool | disable_web_page_preview = true |
||
) |
Edit text (and reply markup) of a message sent by the bot.
Leaving reply_markup empty remove it from the edited message. (https://core.telegram.org/bots/api#editmessagetext)
chat_id | Unique identifier for the target chat. |
message_id | Unique identifier of the sent message. |
text | New text of the message. |
reply_markup | Inline keyboard object. |
parse_mode | Send an enum of type ParseMode. |
disable_web_page_preview | Disables link previews for links in this message. |
std::experimental::optional<const class types::Message> editMessageText | ( | const std::string & | chat_id, |
const uint_fast32_t | message_id, | ||
const std::string & | text, | ||
const std::string & | reply_markup = "" , |
||
const EParseMode | parse_mode = static_cast< EParseMode >(1) , |
||
const bool | disable_web_page_preview = true |
||
) |
Edit text (and reply markup) of a message sent by the bot.
chat_id | Username of the target channel or group (in the format @channelusername ). |
std::experimental::optional<const class types::Message> editMessageText | ( | const uint_fast32_t | message_id, |
const std::string & | text, | ||
const std::string & | reply_markup = "" , |
||
const EParseMode | parse_mode = static_cast< EParseMode >(1) , |
||
const bool | disable_web_page_preview = true |
||
) |
Edit text (and reply markup) of a message sent by the bot.
The chat selected will be the chat from where the current update was received. (https://core.telegram.org/bots/api#editmessagetext)
bool editMessageText | ( | const std::string & | inline_message_id, |
const std::string & | text, | ||
const std::string & | reply_markup = "" , |
||
const EParseMode | parse_mode = static_cast< EParseMode >(1) , |
||
const bool | disable_web_page_preview = true |
||
) |
Edit text (and reply markup) of a message sent via the bot (using inline queries).
Leaving reply_markup empty remove it from the edited message. (https://core.telegram.org/bots/api#editmessagetext)
inline_message_id | Identifier of the inline message. |
text | New text of the message. |
reply_markup | Inline keyboard object. |
parse_mode | Send an enum of type ParseMode. |
disable_web_page_preview | Disables link previews for links in this message. |
bool getUpdates | ( | std::vector< types::Update > & | updates, |
const uint_fast32_t | offset = 0 , |
||
const uint_fast32_t | limit = 100 , |
||
const uint_fast32_t | timeout = 60 |
||
) |
Receive incoming updates using polling (short or long polling based on timeout)
updates | Pushes all the updates on the back of a vector. |
offset | Identifier of the first update to be returned. Must be greater by one than the highest among the identifiers of previously received updates. By default, updates starting with the earliest unconfirmed update are returned. An update is considered confirmed as soon as getUpdates is called with an offset higher than its update_id. The negative offset can be specified to retrieve updates starting from -offset update from the end of the updates queue. All previous updates will be forgotten. |
limit | Limits the number of updates to be retrieved. Values between 1—100 are accepted. |
timeout | Timeout in seconds for long polling. |
std::experimental::optional<const class types::Message> sendMessage | ( | const int_fast64_t | chat_id, |
const std::string & | text, | ||
const std::string & | reply_markup = "" , |
||
const EParseMode | parse_mode = EParseMode::HTML , |
||
const bool | disable_web_page_preview = true , |
||
const bool | disable_notification = false , |
||
const int_fast32_t | reply_to_message_id = 0 |
||
) |
Send a message to a specified chat. (https://core.telegram.org/bots/api#sendmessage)
chat_id | Unique identifier for the target chat. |
text | Text of the message to be sent. |
reply_markup | Additional interface options. Use InlineKeyboard class to create a reply markup. |
parse_mode | Send an enum of type ParseMode. |
disable_web_page_preview | Disables link previews for links in this message. |
disable_notification | Sends the message silently. |
reply_to_message_id | If the message is a reply, Id of the original. message. |
std::experimental::optional<const class types::Message> sendMessage | ( | const std::string & | chat_id, |
const std::string & | text, | ||
const std::string & | reply_markup = "" , |
||
const EParseMode | parse_mode = EParseMode::HTML , |
||
const bool | disable_web_page_preview = true , |
||
const bool | disable_notification = false , |
||
const int_fast32_t | reply_to_message_id = 0 |
||
) |
Send a message to a specified chat. (https://core.telegram.org/bots/api#sendmessage)
std::experimental::optional<const class types::Message> sendMessage | ( | const std::string & | text, |
const std::string & | reply_markup = "" , |
||
const EParseMode | parse_mode = EParseMode::HTML , |
||
const bool | disable_web_page_preview = true , |
||
const bool | disable_notification = false , |
||
const int_fast32_t | reply_to_message_id = 0 |
||
) |
Send a message to a specified chat.
chat_id | Username of the target channel or group (in the format @channelusername ). (https://core.telegram.org/bots/api#sendmessage) |