summaryrefslogtreecommitdiff
path: root/include/tgbot/Api.h
diff options
context:
space:
mode:
authorOleg Morozenkov <omorozenkov@gmail.com>2016-04-17 23:22:52 +0300
committerOleg Morozenkov <omorozenkov@gmail.com>2016-04-17 23:22:52 +0300
commit53418361401958da5cfa3741a8f79687e103c94a (patch)
tree447c7ba83c868066f59d7c10391723a29cdcb58f /include/tgbot/Api.h
parent5d73c438a57b5d0c0846972febc13c1710461185 (diff)
parent9ba69d7e87c9b8ff9997294b68550852ef0274b8 (diff)
Merge pull request #22 from aadeg/master
Diffstat (limited to 'include/tgbot/Api.h')
-rw-r--r--include/tgbot/Api.h135
1 files changed, 121 insertions, 14 deletions
diff --git a/include/tgbot/Api.h b/include/tgbot/Api.h
index 17d0493..cba4b56 100644
--- a/include/tgbot/Api.h
+++ b/include/tgbot/Api.h
@@ -36,6 +36,7 @@
#include "tgbot/types/UserProfilePhotos.h"
#include "tgbot/types/Update.h"
#include "tgbot/types/InlineQueryResult.h"
+#include "tgbot/types/Venue.h"
namespace TgBot {
@@ -65,19 +66,28 @@ public:
* @param disableWebPagePreview Optional. Disables link previews for links in this message.
* @param replyToMessageId Optional. If the message is a reply, ID of the original message.
* @param replyMarkup Optional. Additional interface options. An object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user.
+<<<<<<< HEAD
* @param parseMode Optional. Set it to "Markdown" or "HTML" if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message.
* @return On success, the sent message is returned.
*/
Message::Ptr sendMessage(int64_t chatId, const std::string& text, bool disableWebPagePreview = false, int32_t replyToMessageId = 0, const GenericReply::Ptr& replyMarkup = GenericReply::Ptr(), const std::string& parseMode = "") const;
+=======
+ * @param disableNotification Optional. Sends the message silenty.
+ * @return On success, the sent message is returned.
+ */
+ Message::Ptr sendMessage(int64_t chatId, const std::string& text, bool disableWebPagePreview = false,
+ int32_t replyToMessageId = 0,const GenericReply::Ptr& replyMarkup = GenericReply::Ptr(), bool disableNotification = false) const;
+>>>>>>> 9ba69d7e87c9b8ff9997294b68550852ef0274b8
/**
* Use this method to forward messages of any kind.
* @param chatId Unique identifier for the target chat.
* @param fromChatId Unique identifier for the chat where the original message was sent — User or GroupChat id.
* @param messageId Unique message identifier.
+ * @param disableNotification Optional. Sends the message silenty.
* @return On success, the sent message is returned.
*/
- Message::Ptr forwardMessage(int64_t chatId, int64_t fromChatId, int32_t messageId) const;
+ Message::Ptr forwardMessage(int64_t chatId, int64_t fromChatId, int32_t messageId, bool disableNotification = false) const;
/**
* Use this method to send photos.
@@ -86,9 +96,11 @@ public:
* @param caption Optional. Photo caption.
* @param replyToMessageId Optional. If the message is a reply, ID of the original message.
* @param replyMarkup Optional. Additional interface options. An object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user.
+ * @param disableNotification Optional. Sends the message silenty.
* @return On success, the sent message is returned.
*/
- Message::Ptr sendPhoto(int64_t chatId, const InputFile::Ptr& photo, const std::string& caption = "", int32_t replyToMessageId = 0, const GenericReply::Ptr& replyMarkup = GenericReply::Ptr()) const;
+ Message::Ptr sendPhoto(int64_t chatId, const InputFile::Ptr& photo, const std::string& caption = "", int32_t replyToMessageId = 0,
+ const GenericReply::Ptr& replyMarkup = GenericReply::Ptr(), bool disableNotification = false) const;
/**
* Use this method to send photos.
@@ -97,31 +109,43 @@ public:
* @param caption Optional. Photo caption.
* @param replyToMessageId Optional. If the message is a reply, ID of the original message.
* @param replyMarkup Optional. Additional interface options. An object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user.
+ * @param disableNotification Optional. Sends the message silenty.
* @return On success, the sent message is returned.
*/
- Message::Ptr sendPhoto(int64_t chatId, const std::string& photoId, const std::string& caption = "", int32_t replyToMessageId = 0, const GenericReply::Ptr& replyMarkup = GenericReply::Ptr()) const;
+ Message::Ptr sendPhoto(int64_t chatId, const std::string& photoId, const std::string& caption = "", int32_t replyToMessageId = 0,
+ const GenericReply::Ptr& replyMarkup = GenericReply::Ptr(), bool disableNotification = false) const;
/**
* Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .ogg file encoded with OPUS (other formats may be sent as Document).
* @param chatId Unique identifier for the target chat.
* @param audio Audio to send.
* @param duration Duration of sent audio in seconds.
+ * @param performer Performer
+ * @param title Track name
* @param replyToMessageId Optional. If the message is a reply, ID of the original message.
* @param replyMarkup Optional. Additional interface options. An object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user.
+ * @param disableNotification Optional. Sends the message silenty.
* @return On success, the sent message is returned.
*/
- Message::Ptr sendAudio(int64_t chatId, const InputFile::Ptr& audio, int32_t duration = 0, int32_t replyToMessageId = 0, const GenericReply::Ptr& replyMarkup = GenericReply::Ptr()) const;
+ Message::Ptr sendAudio(int64_t chatId, const InputFile::Ptr& audio, int32_t duration = 0,
+ const std::string& performer = "", const std::string& title = "", int32_t replyToMessageId = 0,
+ const GenericReply::Ptr& replyMarkup = GenericReply::Ptr(), bool disableNotification = false) const;
/**
* Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .ogg file encoded with OPUS (other formats may be sent as Document).
* @param chatId Unique identifier for the target chat.
* @param audio Id of the audio that is already on the Telegram servers.
* @param duration Duration of sent audio in seconds.
+ * @param performer Performer
+ * @param title Track name
* @param replyToMessageId Optional. If the message is a reply, ID of the original message.
* @param replyMarkup Optional. Additional interface options. An object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user.
+ * @param disableNotification Optional. Sends the message silenty.
* @return On success, the sent message is returned.
*/
- Message::Ptr sendAudio(int64_t chatId, const std::string& audioId, int32_t duration = 0, int32_t replyToMessageId = 0, const GenericReply::Ptr& replyMarkup = GenericReply::Ptr()) const;
+ Message::Ptr sendAudio(int64_t chatId, const std::string& audioId, int32_t duration = 0,
+ const std::string& performer = "", const std::string& title = "", int32_t replyToMessageId = 0,
+ const GenericReply::Ptr& replyMarkup = GenericReply::Ptr(), bool disableNotification = false) const;
/**
* Use this method to send general files.
@@ -129,9 +153,11 @@ public:
* @param document Document to send.
* @param replyToMessageId Optional. If the message is a reply, ID of the original message.
* @param replyMarkup Optional. Additional interface options. An object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user.
+ * @param disableNotification Optional. Sends the message silenty.
* @return On success, the sent message is returned.
*/
- Message::Ptr sendDocument(int64_t chatId, const InputFile::Ptr& document, int32_t replyToMessageId = 0, const GenericReply::Ptr& replyMarkup = GenericReply::Ptr()) const;
+ Message::Ptr sendDocument(int64_t chatId, const InputFile::Ptr& document, int32_t replyToMessageId = 0,
+ const GenericReply::Ptr& replyMarkup = GenericReply::Ptr(), bool disableNotification = false) const;
/**
* Use this method to send general files.
@@ -139,9 +165,11 @@ public:
* @param document Id of the document that is already on the Telegram servers.
* @param replyToMessageId Optional. If the message is a reply, ID of the original message.
* @param replyMarkup Optional. Additional interface options. An object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user.
+ * @param disableNotification Optional. Sends the message silenty.
* @return On success, the sent message is returned.
*/
- Message::Ptr sendDocument(int64_t chatId, const std::string& documentId, int32_t replyToMessageId = 0, const GenericReply::Ptr& replyMarkup = GenericReply::Ptr()) const;
+ Message::Ptr sendDocument(int64_t chatId, const std::string& documentId, int32_t replyToMessageId = 0,
+ const GenericReply::Ptr& replyMarkup = GenericReply::Ptr(), bool disableNotification = false) const;
/**
* Use this method to send .webp stickers.
@@ -149,9 +177,11 @@ public:
* @param sticker Sticker to send.
* @param replyToMessageId Optional. If the message is a reply, ID of the original message.
* @param replyMarkup Optional. Additional interface options. An object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user.
+ * @param disableNotification Optional. Sends the message silenty.
* @return On success, the sent message is returned.
*/
- Message::Ptr sendSticker(int64_t chatId, const InputFile::Ptr& sticker, int32_t replyToMessageId = 0, const GenericReply::Ptr& replyMarkup = GenericReply::Ptr()) const;
+ Message::Ptr sendSticker(int64_t chatId, const InputFile::Ptr& sticker, int32_t replyToMessageId = 0,
+ const GenericReply::Ptr& replyMarkup = GenericReply::Ptr(), bool disableNotification = false) const;
/**
* Use this method to send .webp stickers.
@@ -159,9 +189,11 @@ public:
* @param sticker Id of the sticker that is already on the Telegram servers.
* @param replyToMessageId Optional. If the message is a reply, ID of the original message.
* @param replyMarkup Optional. Additional interface options. A object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user.
+ * @param disableNotification Optional. Sends the message silenty.
* @return On success, the sent message is returned.
*/
- Message::Ptr sendSticker(int64_t chatId, const std::string& stickerId, int32_t replyToMessageId = 0, const GenericReply::Ptr& replyMarkup = GenericReply::Ptr()) const;
+ Message::Ptr sendSticker(int64_t chatId, const std::string& stickerId, int32_t replyToMessageId = 0,
+ const GenericReply::Ptr& replyMarkup = GenericReply::Ptr(), bool disableNotification = false) const;
/**
* Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent as Document).
@@ -169,9 +201,11 @@ public:
* @param video Video to send.
* @param replyToMessageId Optional. If the message is a reply, ID of the original message.
* @param replyMarkup Optional. Additional interface options. An object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user.
+ * @param disableNotification Optional. Sends the message silenty.
* @return On success, the sent message is returned.
*/
- Message::Ptr sendVideo(int64_t chatId, const InputFile::Ptr& video, int32_t replyToMessageId = 0, const GenericReply::Ptr& replyMarkup = GenericReply::Ptr()) const;
+ Message::Ptr sendVideo(int64_t chatId, const InputFile::Ptr& video, int32_t replyToMessageId = 0,
+ const GenericReply::Ptr& replyMarkup = GenericReply::Ptr(), bool disableNotification = false) const;
/**
* Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent as Document).
@@ -179,9 +213,37 @@ public:
* @param video Id of the video that is already on the Telegram servers.
* @param replyToMessageId Optional. If the message is a reply, ID of the original message.
* @param replyMarkup Optional. Additional interface options. A object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user.
+ * @param disableNotification Optional. Sends the message silenty.
+ * @return On success, the sent message is returned.
+ */
+ Message::Ptr sendVideo(int64_t chatId, const std::string& videoId, int32_t replyToMessageId = 0,
+ const GenericReply::Ptr& replyMarkup = GenericReply::Ptr(), bool disableNotification = false) const;
+
+ /**
+ * Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message.
+ * @param chatId Unique identifier for the target chat.
+ * @param voice Audio file to send.
+ * @param duration Duration of send audio in seconds.
+ * @param replyToMessageId Optional. If the message is a reply, ID of the original message.
+ * @param replyMarkup Optional. Additional interface options. A object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user.
+ * @param disableNotification Optional. Sends the message silenty.
+ * @return On success, the sent message is returned.
+ */
+ Message::Ptr sendVoice(int64_t chatId, const InputFile::Ptr& voice, int duration = 0, int32_t replyToMessageId = 0,
+ const GenericReply::Ptr& replyMarkup = GenericReply::Ptr(), bool disableNotification = false) const;
+
+ /**
+ * Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message.
+ * @param chatId Unique identifier for the target chat.
+ * @param voiceId Id of the voice that is already on the Telegram servers.
+ * @param duration Duration of send audio in seconds.
+ * @param replyToMessageId Optional. If the message is a reply, ID of the original message.
+ * @param replyMarkup Optional. Additional interface options. A object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user.
+ * @param disableNotification Optional. Sends the message silenty.
* @return On success, the sent message is returned.
*/
- Message::Ptr sendVideo(int64_t chatId, const std::string& videoId, int32_t replyToMessageId = 0, const GenericReply::Ptr& replyMarkup = GenericReply::Ptr()) const;
+ Message::Ptr sendVoice(int64_t chatId, const std::string& voiceId, int duration = 0, int32_t replyToMessageId = 0,
+ const GenericReply::Ptr& replyMarkup = GenericReply::Ptr(), bool disableNotification = false) const;
/**
* Use this method to send point on the map.
@@ -190,9 +252,41 @@ public:
* @param longitude Longitude of location.
* @param replyToMessageId Optional. If the message is a reply, ID of the original message.
* @param replyMarkup Optional. Additional interface options. A object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user.
+ * @param disableNotification Optional. Sends the message silenty.
+ * @return On success, the sent message is returned.
+ */
+ Message::Ptr sendLocation(int64_t chatId, float latitude, float longitude, int32_t replyToMessageId = 0,
+ const GenericReply::Ptr& replyMarkup = GenericReply::Ptr(), bool disableNotification = false) const;
+
+ /**
+ * Use this method to send information about a venue. On success, the sent Message is returned.
+ * @param chatId Unique identifier for the target chat.
+ * @param latitude Latitude of location.
+ * @param longitude Longitude of location.
+ * @param title Name of the venue.
+ * @param address Address of the venue.
+ * @param foursquare_id Foursquare identifier of the venue.
+ * @param replyToMessageId Optional. If the message is a reply, ID of the original message.
+ * @param replyMarkup Optional. Additional interface options. A object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user.
+ * @param disableNotification Optional. Sends the message silenty.
+ * @return On success, the sent message is returned.
+ */
+ Message::Ptr sendVenue(int64_t chatId, float latitude, float longitude, std::string title, std::string address, std::string foursquareId = "",
+ bool disableNotification = false, int32_t replyToMessageId = 0, const GenericReply::Ptr& replyMarkup = GenericReply::Ptr()) const;
+
+ /**
+ * Use this method to send phone contacts. On success, the sent Message is returned.
+ * @param chatId Unique identifier for the target chat.
+ * @param phoneNumber Contact's phone number.
+ * @param firstName Contact's first name.
+ * @param lastName Contact's last name.
+ * @param disableNotification Optional. Sends the message silenty.
+ * @param replyToMessageId Optional. If the message is a reply, ID of the original message.
+ * @param replyMarkup Optional. Additional interface options. A object for a custom reply keyboard, instructions to hide keyboard or to force a reply from the user.
* @return On success, the sent message is returned.
*/
- Message::Ptr sendLocation(int64_t chatId, float latitude, float longitude, int32_t replyToMessageId = 0, const GenericReply::Ptr& replyMarkup = GenericReply::Ptr()) const;
+ Message::Ptr sendContact(int64_t chatId, std::string phoneNumber, std::string firstName, std::string lastName = "", bool disableNotification = false,
+ int32_t replyToMessageId = 0, const GenericReply::Ptr& replyMarkup = GenericReply::Ptr()) const;
/**
* Use this method when you need to tell the user that something is happening on the bot's side. The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear its typing status).
@@ -231,8 +325,7 @@ public:
* Ports currently supported for Webhooks: 443, 80, 88, 8443.
* @param url Optional. HTTPS url to send updates to. Use an empty string to remove webhook integration.
*/
- // TODO Add support to self-signed certificate
- void setWebhook(const std::string& url = "") const;
+ void setWebhook(const std::string& url = "", const InputFile::Ptr& certificate = nullptr) const;
/**
* Use this method to send answers to an inline query.
@@ -246,6 +339,20 @@ public:
void answerInlineQuery(const std::string& inlineQueryId, const std::vector<InlineQueryResult::Ptr>& results,
int32_t cacheTime=300, bool isPersonal=false, const std::string& nextOffset="") const;
+ /**
+ * Use this method to kick a user from a group or a supergroup.
+ * @param chatId Unique identifier for the target group.
+ * @param userId Unique identifier of the target user.
+ */
+ void kickChatMember(int64_t chatId, int32_t userId) const;
+
+ /**
+ * Use this method to unban a previously kicked user in a supergroup.
+ * @param chatId Unique identifier for the target group.
+ * @param userId Unique identifier of the target user.
+ */
+ void unbanChatMember(int64_t chatId, int32_t userId) const;
+
private:
boost::property_tree::ptree sendRequest(const std::string& method, const std::vector<HttpReqArg>& args = std::vector<HttpReqArg>()) const;