diff options
author | kukin-konstantin <kukin.konstantin@gmail.com> | 2017-01-02 22:08:51 +0300 |
---|---|---|
committer | kukin-konstantin <kukin.konstantin@gmail.com> | 2017-01-02 22:08:51 +0300 |
commit | 0466be7b03710caec9cf1037342b4004b2360af2 (patch) | |
tree | d998e29912119367fd9d6866f05e90bb0adbd9c5 /include/tgbot/Api.h | |
parent | 4f3a56bf7fcfae055d5f513ff86cf4e1e75e83b7 (diff) |
add editMessage methods
Diffstat (limited to 'include/tgbot/Api.h')
-rw-r--r-- | include/tgbot/Api.h | 53 |
1 files changed, 51 insertions, 2 deletions
diff --git a/include/tgbot/Api.h b/include/tgbot/Api.h index 4cb71a1..ae8bbdb 100644 --- a/include/tgbot/Api.h +++ b/include/tgbot/Api.h @@ -361,9 +361,55 @@ public: */ ChatMember::Ptr getChatMember(int64_t chatId, int32_t userId) const; + /** + * 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. + * @param callbackQueryId Unique identifier for the query to be answered + * @param text Optional Text of the notification. If not specified, nothing will be shown to the user, 0-200 characters + * @param showAlert Optional If true, an alert will be shown by the client instead of a notification at the top of the chat screen. Defaults to false. + * @param url Optional URL that will be opened by the user's client. If you have created a Game and accepted the conditions via @Botfather, specify the URL that opens your game – note that this will only work if the query comes from a callback_game button + * @param cacheTime Optional The maximum amount of time in seconds that the result of the callback query may be cached client-side. Telegram apps will support caching starting in version 3.14. Defaults to 0. + * @return True on success + */ bool answerCallbackQuery(const std::string & callbackQueryId, const std::string & text="", bool showAlert=false, const std::string &url="", int32_t cacheTime=0) const; /** + * Use this method to edit text and game messages sent by the bot or via the bot (for inline bots) + * @param text New text of the message + * @param chatId Optional Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername) + * @param messageId Optional Required if inline_message_id is not specified. Identifier of the sent message + * @param inlineMessageId Optional Required if chat_id and message_id are not specified. Identifier of the inline message + * @param parseMode Optional Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message. + * @param disableWebPagePreview Optional Disables link previews for links in this message + * @param replyMarkup Optional A JSON-serialized object for an inline keyboard. + * @return Message object on success, otherwise nullptr + */ + Message::Ptr editMessageText(const std::string& text, int64_t chatId=0, int32_t messageId=0, const std::string& inlineMessageId="", + const std::string& parseMode = "", bool disableWebPagePreview = false, const GenericReply::Ptr& replyMarkup = GenericReply::Ptr()) const; + + /** + * Use this method to edit captions of messages sent by the bot or via the bot (for inline bots). + * @param chatId Optional Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername) + * @param messageId Optional Required if inline_message_id is not specified. Identifier of the sent message + * @param caption Optional New caption of the message + * @param inlineMessageId Optional Required if chat_id and message_id are not specified. Identifier of the inline message + * @param replyMarkup Optional A JSON-serialized object for an inline keyboard. + * @return Message object on success, otherwise nullptr + */ + Message::Ptr editMessageCaption(int64_t chatId = 0, int32_t messageId = 0, const std::string& caption = "", + const std::string& inlineMessageId = "", const GenericReply::Ptr& replyMarkup = GenericReply::Ptr()) const; + + /** + * Use this method to edit only the reply markup of messages sent by the bot or via the bot (for inline bots). + * @param chatId Optional Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername) + * @param messageId Optional Required if inline_message_id is not specified. Identifier of the sent message + * @param inlineMessageId Optional Required if chat_id and message_id are not specified. Identifier of the inline message + * @param replyMarkup Optional A JSON-serialized object for an inline keyboard. + * @return Message object on success, otherwise nullptr + */ + Message::Ptr editMessageReplyMarkup(int64_t chatId = 0, int32_t messageId = 0, const std::string& inlineMessageId = "", + const GenericReply::Ptr& replyMarkup = GenericReply::Ptr()) const; + + /** * Use this method to receive incoming updates using long polling. * This method will not work if an outgoing webhook is set up. * In order to avoid getting duplicate updates, recalculate offset after each server response. @@ -406,9 +452,12 @@ public: * @param cacheTime The maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300. * @param isPersonal Pass True, if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query. * @param nextOffset 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. Offset length can’t exceed 64 bytes. + * @param switchPmText 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 + * @param switchPmParameter Parameter for the start message sent to the bot when user presses the switch button + * @return True on success */ - void answerInlineQuery(const std::string& inlineQueryId, const std::vector<InlineQueryResult::Ptr>& results, - int32_t cacheTime=300, bool isPersonal=false, const std::string& nextOffset="") const; + bool answerInlineQuery(const std::string& inlineQueryId, const std::vector<InlineQueryResult::Ptr>& results, + int32_t cacheTime=300, bool isPersonal=false, const std::string& nextOffset="", const std::string& switchPmText="", const std::string& switchPmParameter="") const; /** * Use this method to kick a user from a group or a supergroup. |