summaryrefslogtreecommitdiff
path: root/include/tgbot
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
parent5d73c438a57b5d0c0846972febc13c1710461185 (diff)
parent9ba69d7e87c9b8ff9997294b68550852ef0274b8 (diff)
Merge pull request #22 from aadeg/master
Diffstat (limited to 'include/tgbot')
-rw-r--r--include/tgbot/Api.h135
-rw-r--r--include/tgbot/EventBroadcaster.h19
-rw-r--r--include/tgbot/EventHandler.h2
-rw-r--r--include/tgbot/TgTypeParser.h9
-rw-r--r--include/tgbot/types/CallbackQuery.h52
-rw-r--r--include/tgbot/types/InlineKeyboardButton.h43
-rw-r--r--include/tgbot/types/InlineKeyboardMarkup.h32
-rw-r--r--include/tgbot/types/Message.h47
-rw-r--r--include/tgbot/types/MessageEntity.h43
-rw-r--r--include/tgbot/types/Update.h6
-rw-r--r--include/tgbot/types/Venue.h45
-rw-r--r--include/tgbot/types/Voice.h43
12 files changed, 453 insertions, 23 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;
diff --git a/include/tgbot/EventBroadcaster.h b/include/tgbot/EventBroadcaster.h
index d97dbbb..12daef3 100644
--- a/include/tgbot/EventBroadcaster.h
+++ b/include/tgbot/EventBroadcaster.h
@@ -31,6 +31,7 @@
#include "tgbot/types/Message.h"
#include "tgbot/types/InlineQuery.h"
#include "tgbot/types/ChosenInlineResult.h"
+#include "tgbot/types/CallbackQuery.h"
namespace TgBot {
@@ -48,6 +49,7 @@ public:
typedef std::function<void (const Message::Ptr&)> MessageListener;
typedef std::function<void (const InlineQuery::Ptr&)> InlineQueryListener;
typedef std::function<void (const ChosenInlineResult::Ptr&)> ChosenInlineResultListener;
+ typedef std::function<void (const CallbackQuery::Ptr&)> CallbackQueryListener;
/**
* Registers listener which receives all messages which the bot can ever receive.
@@ -82,14 +84,26 @@ public:
_onNonCommandMessageListeners.push_back(listener);
}
+ /**
+ * Registers listener which receives all the inline query.
+ * @param listener Listener.
+ */
inline void onInlineQuery(const InlineQueryListener& listener) {
_onInlineQueryListeners.push_back(listener);
}
+ /**
+ * Registers listener which receives all the chosen inline result.
+ * @param listener Listener.
+ */
inline void onChosenInlineResult(const ChosenInlineResultListener& listener){
_onChosenInlineResultListeners.push_back(listener);
}
+ inline void onCallbackQuery(const CallbackQueryListener& listener){
+ _onCallbackQueryListeners.push_back(listener);
+ }
+
private:
template<typename ListenerType, typename ObjectType>
inline void broadcast(const std::vector<ListenerType>& listeners, const ObjectType& object) const {
@@ -130,12 +144,17 @@ private:
broadcast<ChosenInlineResultListener, ChosenInlineResult::Ptr>(_onChosenInlineResultListeners, result);
}
+ inline void broadcastCallbackQuery(const CallbackQuery::Ptr& result) const {
+ broadcast<CallbackQueryListener, CallbackQuery::Ptr>(_onCallbackQueryListeners, result);
+ }
+
std::vector<MessageListener> _onAnyMessageListeners;
std::map<std::string, MessageListener> _onCommandListeners;
std::vector<MessageListener> _onUnknownCommandListeners;
std::vector<MessageListener> _onNonCommandMessageListeners;
std::vector<InlineQueryListener> _onInlineQueryListeners;
std::vector<ChosenInlineResultListener> _onChosenInlineResultListeners;
+ std::vector<CallbackQueryListener> _onCallbackQueryListeners;
};
}
diff --git a/include/tgbot/EventHandler.h b/include/tgbot/EventHandler.h
index 64f74cd..63ecde3 100644
--- a/include/tgbot/EventHandler.h
+++ b/include/tgbot/EventHandler.h
@@ -67,6 +67,8 @@ public:
_broadcaster->broadcastInlineQuery(update->inlineQuery);
if (update->chosenInlineResult != NULL)
_broadcaster->broadcastChosenInlineResult(update->chosenInlineResult);
+ if (update->callbackQuery != NULL)
+ _broadcaster->broadcastCallbackQuery(update->callbackQuery);
if (update->message != NULL)
handleMessage(update->message);
}
diff --git a/include/tgbot/TgTypeParser.h b/include/tgbot/TgTypeParser.h
index f52d106..17e9553 100644
--- a/include/tgbot/TgTypeParser.h
+++ b/include/tgbot/TgTypeParser.h
@@ -52,6 +52,9 @@
#include "tgbot/types/InlineQueryResultMpeg4Gif.h"
#include "tgbot/types/InlineQueryResultVideo.h"
#include "tgbot/types/ChosenInlineResult.h"
+#include "tgbot/types/CallbackQuery.h"
+#include "tgbot/types/InlineKeyboardMarkup.h"
+#include "tgbot/types/InlineKeyboardButton.h"
namespace TgBot {
@@ -114,6 +117,12 @@ public:
std::string parseInlineQueryResultVideo(const InlineQueryResultVideo::Ptr& object) const;
ChosenInlineResult::Ptr parseJsonAndGetChosenInlineResult(const boost::property_tree::ptree& data) const;
std::string parseChosenInlineResult(const ChosenInlineResult::Ptr& object) const;
+ CallbackQuery::Ptr parseJsonAndGetCallbackQuery(const boost::property_tree::ptree& data) const;
+ std::string parseCallbackQuery(const CallbackQuery::Ptr& object) const;
+ InlineKeyboardMarkup::Ptr parseJsonAndGetInlineKeyboardMarkup(const boost::property_tree::ptree& data) const;
+ std::string parseInlineKeyboardMarkup(const InlineKeyboardMarkup::Ptr& object) const;
+ InlineKeyboardButton::Ptr parseJsonAndGetInlineKeyboardButton(const boost::property_tree::ptree& data) const;
+ std::string parseInlineKeyboardButton(const InlineKeyboardButton::Ptr& object) const;
inline boost::property_tree::ptree parseJson(const std::string& json) const {
boost::property_tree::ptree tree;
diff --git a/include/tgbot/types/CallbackQuery.h b/include/tgbot/types/CallbackQuery.h
new file mode 100644
index 0000000..5f6871d
--- /dev/null
+++ b/include/tgbot/types/CallbackQuery.h
@@ -0,0 +1,52 @@
+//
+// Created by Andrea Giove on 17/04/16.
+//
+
+#ifndef TGBOT_CALLBACKQUERY_H
+#define TGBOT_CALLBACKQUERY_H
+
+#include <memory>
+#include <string>
+
+#include "tgbot/types/User.h"
+#include "tgbot/types/Message.h"
+
+namespace TgBot {
+
+/**
+ * This object represents an incoming callback query from a callback button in an inline keyboard.
+ * @ingroup types
+ */
+class CallbackQuery {
+public:
+ typedef std::shared_ptr<CallbackQuery> Ptr;
+
+ /**
+ * Unique identifier for this query.
+ */
+ std::string id;
+
+ /**
+ * Sender.
+ */
+ User::Ptr from;
+
+ /**
+ * Optional. Message with the callback button that originated the query. Note that message content and message date will not be available if the message is too old.
+ */
+ Message::Ptr message;
+
+ /**
+ * Optional. Identifier of the message sent via the bot in inline mode, that originated the query.
+ */
+ std::string inlineMessageId;
+
+ /**
+ * Data associated with the callback button. Be aware that a bad client can send arbitrary data in this field.
+ */
+ std::string data;
+
+};
+}
+
+#endif //TGBOT_CALLBACKQUERY_H
diff --git a/include/tgbot/types/InlineKeyboardButton.h b/include/tgbot/types/InlineKeyboardButton.h
new file mode 100644
index 0000000..1a71341
--- /dev/null
+++ b/include/tgbot/types/InlineKeyboardButton.h
@@ -0,0 +1,43 @@
+//
+// Created by Andrea Giove on 17/04/16.
+//
+
+#ifndef TGBOT_INLINEKEYBOARDBUTTON_H
+#define TGBOT_INLINEKEYBOARDBUTTON_H
+
+#include <string>
+#include <memory>
+
+namespace TgBot {
+
+/**
+ * This object represents one button of an inline keyboard. You must use exactly one of the optional fields.
+ * @ingroup types
+ */
+class InlineKeyboardButton {
+public:
+ typedef std::shared_ptr<InlineKeyboardButton> Ptr;
+
+ /**
+ * Label text on the button
+ */
+ std::string text;
+
+ /**
+ * Optional. HTTP url to be opened when button is pressed.
+ */
+ std::string url;
+
+ /**
+ * Optional. Data to be sent in a callback query to the bot when button is pressed.
+ */
+ std::string callbackData;
+
+ /**
+ * Optional. If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot‘s username and the specified inline query in the input field. Can be empty, in which case just the bot’s username will be inserted.
+ */
+ std::string switchInlineQuery;
+};
+}
+
+#endif //TGBOT_INLINEKEYBOARDBUTTON_H
diff --git a/include/tgbot/types/InlineKeyboardMarkup.h b/include/tgbot/types/InlineKeyboardMarkup.h
new file mode 100644
index 0000000..9097fa5
--- /dev/null
+++ b/include/tgbot/types/InlineKeyboardMarkup.h
@@ -0,0 +1,32 @@
+//
+// Created by Andrea Giove on 17/04/16.
+//
+
+#ifndef TGBOT_INLINEKEYBOARDMARKUP_H
+#define TGBOT_INLINEKEYBOARDMARKUP_H
+
+#include <vector>
+#include <memory>
+
+#include "tgbot/types/GenericReply.h"
+#include "tgbot/types/InlineKeyboardButton.h"
+
+namespace TgBot {
+
+/**
+ * This object represents an inline keyboard that appears right next to the message it belongs to.
+ * @ingroup types
+ */
+class InlineKeyboardMarkup : public GenericReply {
+public:
+ typedef std::shared_ptr<InlineKeyboardMarkup> Ptr;
+
+ /**
+ * Array of button rows, each represented by an Array of InlineKeyboardButton objects.
+ */
+ std::vector<std::vector<InlineKeyboardButton::Ptr>> inlineKeyboard;
+
+};
+}
+
+#endif //TGBOT_INLINEKEYBOARDMARKUP_H
diff --git a/include/tgbot/types/Message.h b/include/tgbot/types/Message.h
index ea53cf3..be1d313 100644
--- a/include/tgbot/types/Message.h
+++ b/include/tgbot/types/Message.h
@@ -37,6 +37,9 @@
#include "tgbot/types/Contact.h"
#include "tgbot/types/Location.h"
#include "tgbot/types/PhotoSize.h"
+#include "tgbot/types/MessageEntity.h"
+#include "tgbot/types/Venue.h"
+#include "tgbot/types/Voice.h"
namespace TgBot {
@@ -45,10 +48,18 @@ namespace TgBot {
* @ingroup types
*/
class Message {
-
public:
typedef std::shared_ptr<Message> Ptr;
+ Message(){
+ deleteChatPhoto = false;
+ groupChatCreated = false;
+ supergroupChatCreated = false;
+ channelChatCreated = false;
+ migrateToChatId = 0;
+ migrateFromChatId = 0;
+ }
+
/**
* Unique message identifier.
*/
@@ -90,6 +101,11 @@ public:
std::string text;
/**
+ * Optional. For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text.
+ */
+ std::vector<MessageEntity::Ptr> entities;
+
+ /**
* Optional. Message is an audio file, information about the file.
*/
Audio::Ptr audio;
@@ -114,7 +130,15 @@ public:
*/
Video::Ptr video;
- // TODO voice
+ /**
+ * Optional. Message is a voice message, information about the file.
+ */
+ Voice::Ptr voice;
+
+ /**
+ * Optional. Caption for the document, photo or video, 0-200 characters.
+ */
+ std::string caption;
/**
* Optional. Message is a shared contact, information about the contact.
@@ -127,14 +151,19 @@ public:
Location::Ptr location;
/**
+ * Optional. Message is a venue, information about the venue.
+ */
+ Venue::Ptr venue;
+
+ /**
* Optional. A new member was added to the group, information about them (this member may be bot itself).
*/
- User::Ptr newChatParticipant;
+ User::Ptr newChatMember;
/**
* Optional. A member was removed from the group, information about them (this member may be bot itself).
*/
- User::Ptr leftChatParticipant;
+ User::Ptr leftChatMember;
/**
* Optional. A group title was changed to this value.
@@ -157,11 +186,6 @@ public:
bool groupChatCreated;
/**
- * Optional. Text description of the photo or the video.
- */
- std::string caption;
-
- /**
* Optional. Service message: the supergroup has been created.
*/
bool supergroupChatCreated;
@@ -181,6 +205,11 @@ public:
*/
int64_t migrateFromChatId;
+ /**
+ * Optional. Specified message was pinned. Note that the Message object in this field will not contain further reply_to_message fields even if it is itself a reply.
+ */
+ Message::Ptr pinnedMessage;
+
};
}
diff --git a/include/tgbot/types/MessageEntity.h b/include/tgbot/types/MessageEntity.h
new file mode 100644
index 0000000..befcb3e
--- /dev/null
+++ b/include/tgbot/types/MessageEntity.h
@@ -0,0 +1,43 @@
+//
+// Created by Andrea Giove on 17/04/16.
+//
+
+#ifndef TGBOT_MESSAGEENTITY_H
+#define TGBOT_MESSAGEENTITY_H
+
+#include <memory>
+#include <string>
+
+namespace TgBot {
+
+/**
+ * This object represents one special entity in a text message. For example, hashtags, usernames, URLs, etc.
+ * @ingroup types
+ */
+class MessageEntity {
+public:
+ std::shared_ptr<MessageEntity> Ptr;
+
+ /**
+ * Type of the entity. One of mention (@username), hashtag, bot_command, url, email, bold (bold text), italic (italic text), code (monowidth string), pre (monowidth block), text_link (for clickable text URLs).
+ */
+ std::string type;
+
+ /**
+ * Offset in UTF-16 code units to the start of the entity.
+ */
+ int32_t offset;
+
+ /**
+ * Length of the entity in UTF-16 code units
+ */
+ int32_t length;
+
+ /**
+ * Optional. For “text_link” only, url that will be opened after user taps on the text
+ */
+ std::string url;
+};
+}
+
+#endif //TGBOT_MESSAGEENTITY_H
diff --git a/include/tgbot/types/Update.h b/include/tgbot/types/Update.h
index 9ae8d73..7a3c106 100644
--- a/include/tgbot/types/Update.h
+++ b/include/tgbot/types/Update.h
@@ -28,6 +28,7 @@
#include "tgbot/types/Message.h"
#include "tgbot/types/InlineQuery.h"
#include "tgbot/types/ChosenInlineResult.h"
+#include "tgbot/types/CallbackQuery.h"
namespace TgBot {
@@ -59,6 +60,11 @@ public:
* Optional. The result of an inline query that was chosen by a user and sent to their chat partner.
*/
ChosenInlineResult::Ptr chosenInlineResult;
+
+ /**
+ * Optional. New incoming callback query.
+ */
+ CallbackQuery::Ptr callbackQuery;
};
}
diff --git a/include/tgbot/types/Venue.h b/include/tgbot/types/Venue.h
new file mode 100644
index 0000000..5040cce
--- /dev/null
+++ b/include/tgbot/types/Venue.h
@@ -0,0 +1,45 @@
+//
+// Created by Andrea Giove on 17/04/16.
+//
+
+#ifndef TGBOT_VENUE_H
+#define TGBOT_VENUE_H
+
+#include <memory>
+#include <string>
+
+#include "tgbot/types/Location.h"
+
+namespace TgBot {
+
+/**
+ * This object represents a venue.
+ * @ingroup types
+ */
+class Venue {
+public:
+ typedef std::shared_ptr<Venue> Ptr;
+
+ /**
+ * Venue location.
+ */
+ Location::Ptr location;
+
+ /**
+ * Name of the venue.
+ */
+ std::string title;
+
+ /**
+ * Address of the venue.
+ */
+ std::string address;
+
+ /**
+ * Optional. Foursquare identifier of the venue.
+ */
+ std::string foursquare_id;
+};
+}
+
+#endif //TGBOT_VENUE_H
diff --git a/include/tgbot/types/Voice.h b/include/tgbot/types/Voice.h
new file mode 100644
index 0000000..385257d
--- /dev/null
+++ b/include/tgbot/types/Voice.h
@@ -0,0 +1,43 @@
+//
+// Created by Andrea Giove on 17/04/16.
+//
+
+#ifndef TGBOT_VOICE_H
+#define TGBOT_VOICE_H
+
+#include <memory>
+#include <string>
+
+namespace TgBot {
+
+/**
+ * This object represents a voice note.
+ * @ingroup types
+ */
+class Voice {
+public:
+ std::shared_ptr<Voice> Ptr;
+
+ /**
+ * Unique identifier for this file.
+ */
+ std::string file_id;
+
+ /**
+ * Duration of the audio in seconds as defined by sender.
+ */
+ int32_t duration;
+
+ /**
+ * Optional. MIME type of the file as defined by sender;
+ */
+ std::string mime_type;
+
+ /**
+ * Optional. File size.
+ */
+ int32_t file_size;
+};
+}
+
+#endif //TGBOT_VOICE_H