yatbcpp  0.0.1
Yet another Telegram Bot CPP Library
Message.cc
Go to the documentation of this file.
1 //Message Object , represents an incoming message according to bot api definition as close as possible //
4 
5 #include <string>
6 #include <optional>
7 #include "types/User.h"
8 #include "types/Chat.h"
9 #include "types/MessageEntity.h"
10 #include "types/Audio.h"
11 #include "types/Document.h"
12 #include "types/Video.h"
13 #include "types/Voice.h"
14 #include "types/VideoNote.h"
15 #include "types/Contact.h"
16 #include "types/Location.h"
17 #include "types/Venue.h"
18 #include "types/Message.h"
19 
20 using namespace yatbcpp;
21 using namespace std;
22 
24 // Constructor Section //
26 
27 Message::Message(int32_t message_id, int32_t date, Chat chat):
28  message_id(message_id), date(date), chat(chat)
29 {
30 
31 }
32 
34  message_id(Message.message_id), date(Message.date), chat(Message.chat)
35 {
36  from = Message.from;
37  forward_from = Message.forward_from;
41  forward_date = Message.forward_date;
42  edit_date = Message.edit_date;
44  text = Message.text;
45  entities = Message.entities;
46  audio = Message.audio;
47  document = Message.document;
48  photo = Message.photo;
49  video = Message.video;
50  voice = Message.voice;
51  video_note = Message.video_note;
52  //TODO complete
53 }
54 
55 
57 // Setter Section //
59 
60 void Message::setFrom(const optional<User> &from) {
62 }
63 
64 void Message::setForward_from(const optional<User> &forward_from) {
66 }
67 
68 void Message::setForward_from_chat(const optional<Chat> &forward_from_chat) {
70 }
71 
74 }
75 
76 void Message::setForward_signature(const optional<string> &forward_signature) {
78 }
79 
80 void Message::setForward_date(const optional<int32_t> &forward_date) {
82 }
83 
84 //void Message::setReply_to_message(const optional<Message *> &reply_to_message) {
85 // Message::reply_to_message = reply_to_message;
86 //}
87 
88 void Message::setEdit_date(const optional<int32_t> &edit_date) {
90 }
91 
92 void Message::setAuthor_signature(const optional<string> &author_signature) {
94 }
95 
96 void Message::setText(const optional<string> &text) {
98 }
99 
100 void Message::addEntity(const MessageEntity &messageEntity){
101  entities.push_back(messageEntity);
102 }
103 
104 void Message::setAudio(const optional<Audio> &audio) {
106 }
107 
108 void Message::setDocument(const optional<Document> &document) {
110 }
111 
112 //todo game
113 
114 void Message::addPhoto(const PhotoSize &Photo) {
115  photo.push_back(Photo);
116 }
117 
118 //todo sticker
119 
120 void Message::setVideo(const optional<Video> &video) {
122 }
123 
124 void Message::setVoice(const optional<Voice> &voice) {
126 }
127 
128 void Message::setVideo_note(const optional<VideoNote> &video_note) {
130 }
131 
133  new_chat_members.push_back(new_chat_member);
134 }
135 
136 void Message::setCaption(const optional<string> &caption) {
138 }
139 
140 void Message::setContact(const optional<Contact> &contact) {
142 }
143 
144 void Message::setLocation(const optional<Location> &location) {
146 }
147 
148 void Message::setVenue(const optional<Venue> &venue) {
150 }
151 
152 void Message::setNew_chat_member(const optional<User> &new_chat_member) {
154 }
155 
156 void Message::setLeft_chat_member(const optional<User> &left_chat_member) {
158 }
159 
160 void Message::setNew_chat_title(const optional<string> &new_chat_title) {
162 }
163 
164 void Message::addNew_chat_photo(const PhotoSize &newchatphoto) {
165  new_chat_photo.push_back(newchatphoto);
166 }
167 
170 }
171 
174 }
175 
178 }
179 
182 }
183 
186 }
187 
190 }
191 
193 // Getter Section //
195 
196 int32_t Message::getMessage_id() const {
197  return message_id;
198 }
199 
200 const optional<User> &Message::getFrom() const {
201  return from;
202 }
203 
204 int32_t Message::getDate() const {
205  return date;
206 }
207 
208 const Chat &Message::getChat() const {
209  return chat;
210 }
211 
212 const optional<User> &Message::getForward_from() const {
213  return forward_from;
214 }
215 
216 const optional<Chat> &Message::getForward_from_chat() const {
217  return forward_from_chat;
218 }
219 
220 const optional<int32_t> &Message::getForward_from_message_id() const {
222 }
223 
224 const optional<string> &Message::getForward_signature() const {
225  return forward_signature;
226 }
227 
228 const optional<int32_t> &Message::getForward_date() const {
229  return forward_date;
230 }
231 
232 //const optional<Message *> &Message::getReply_to_message() const {
233 // return reply_to_message;
234 //}
235 
236 const optional<int32_t> &Message::getEdit_date() const {
237  return edit_date;
238 }
239 
240 const optional<string> &Message::getAuthor_signature() const {
241  return author_signature;
242 }
243 
244 const optional<string> &Message::getText() const {
245  return text;
246 }
247 
248 const vector<MessageEntity> &Message::getEntities() const {
249  return entities;
250 }
251 
252 const optional<Audio> &Message::getAudio() const {
253  return audio;
254 }
255 
256 const optional<Document> &Message::getDocument() const {
257  return document;
258 }
259 
260 const vector<PhotoSize> &Message::getPhoto() const {
261  return photo;
262 }
263 
264 const optional<Video> &Message::getVideo() const {
265  return video;
266 }
267 
268 const optional<Voice> &Message::getVoice() const {
269  return voice;
270 }
271 
272 const optional<VideoNote> &Message::getVideo_note() const {
273  return video_note;
274 }
275 
276 const vector<User> &Message::getNew_chat_members() const {
277  return new_chat_members;
278 }
279 
280 const optional<string> &Message::getCaption() const {
281  return caption;
282 }
283 
284 const optional<Contact> &Message::getContact() const {
285  return contact;
286 }
287 
288 const optional<Location> &Message::getLocation() const {
289  return location;
290 }
291 
292 const optional<Venue> &Message::getVenue() const {
293  return venue;
294 }
295 
296 const optional<User> &Message::getNew_chat_member() const {
297  return new_chat_member;
298 }
299 
300 const optional<User> &Message::getLeft_chat_member() const {
301  return left_chat_member;
302 }
303 
304 const optional<string> &Message::getNew_chat_title() const {
305  return new_chat_title;
306 }
307 
308 const vector<PhotoSize> &Message::getNew_chat_photo() const {
309  return new_chat_photo;
310 }
311 
312 const optional<bool> &Message::getDelete_chat_photo() const {
313  return delete_chat_photo;
314 }
315 
316 const optional<bool> &Message::getGroup_chat_created() const {
317  return group_chat_created;
318 }
319 
320 const optional<bool> &Message::getSupergroup_chat_created() const {
322 }
323 
324 const optional<bool> &Message::getChannel_chat_created() const {
325  return channel_chat_created;
326 }
327 
328 const optional<long> &Message::getMigrate_to_chat_id() const {
329  return migrate_to_chat_id;
330 }
331 
332 const optional<long> &Message::getMigrate_from_chat_id() const {
333  return migrate_from_chat_id;
334 }
335 
336 
337 
338 
339 
std::optional< long > migrate_to_chat_id
Definition: Message.h:231
void setSupergroup_chat_created(const std::optional< bool > &supergroup_chat_created)
Definition: Message.cc:176
std::optional< User > forward_from
Definition: Message.h:173
std::vector< User > new_chat_members
Definition: Message.h:205
std::optional< bool > delete_chat_photo
Definition: Message.h:223
std::optional< VideoNote > video_note
Definition: Message.h:203
void setNew_chat_member(const std::optional< User > &new_chat_member)
Definition: Message.cc:152
void setFrom(const std::optional< User > &from)
Definition: Message.cc:60
void setEdit_date(const std::optional< std::int32_t > &edit_date)
Definition: Message.cc:88
const std::optional< User > & getNew_chat_member() const
Definition: Message.cc:296
const std::optional< long > & getMigrate_to_chat_id() const
Definition: Message.cc:328
void setAuthor_signature(const std::optional< std::string > &author_signature)
Definition: Message.cc:92
std::optional< Video > video
Definition: Message.h:199
const std::optional< std::string > & getCaption() const
Definition: Message.cc:280
const std::vector< User > & getNew_chat_members() const
Definition: Message.cc:276
const std::optional< bool > & getDelete_chat_photo() const
Definition: Message.cc:312
std::vector< PhotoSize > photo
Definition: Message.h:197
std::int32_t getMessage_id() const
Definition: Message.cc:196
void setMigrate_from_chat_id(const std::optional< long > &migrate_from_chat_id)
Definition: Message.cc:188
std::optional< Contact > contact
Definition: Message.h:209
const std::optional< std::int32_t > & getEdit_date() const
Definition: Message.cc:236
const std::optional< VideoNote > & getVideo_note() const
Definition: Message.cc:272
void setForward_date(const std::optional< std::int32_t > &forward_date)
Definition: Message.cc:80
const std::optional< Document > & getDocument() const
Definition: Message.cc:256
void setForward_signature(const std::optional< std::string > &forward_signature)
Definition: Message.cc:76
void setNew_chat_title(const std::optional< std::string > &new_chat_title)
Definition: Message.cc:160
void setForward_from_message_id(const std::optional< std::int32_t > &forward_from_message_id)
Definition: Message.cc:72
void setVenue(const std::optional< Venue > &venue)
Definition: Message.cc:148
Definition: Bot.h:27
std::optional< std::int32_t > edit_date
Definition: Message.h:185
const std::optional< Chat > & getForward_from_chat() const
Definition: Message.cc:216
std::optional< Venue > venue
Definition: Message.h:213
void setChannel_chat_created(const std::optional< bool > &channel_chat_created)
Definition: Message.cc:180
std::optional< Voice > voice
Definition: Message.h:201
void setLeft_chat_member(const std::optional< User > &left_chat_member)
Definition: Message.cc:156
void setForward_from(const std::optional< User > &forward_from)
Definition: Message.cc:64
std::optional< Audio > audio
Definition: Message.h:193
const std::optional< bool > & getSupergroup_chat_created() const
Definition: Message.cc:320
std::int32_t message_id
Definition: Message.h:165
const std::optional< std::string > & getNew_chat_title() const
Definition: Message.cc:304
std::optional< std::string > caption
Definition: Message.h:207
std::optional< std::int32_t > forward_date
Definition: Message.h:181
std::optional< std::string > text
Definition: Message.h:189
const std::optional< User > & getForward_from() const
Definition: Message.cc:212
void setVideo(const std::optional< Video > &video)
Definition: Message.cc:120
const Chat & getChat() const
Definition: Message.cc:208
std::optional< bool > channel_chat_created
Definition: Message.h:229
const std::optional< Video > & getVideo() const
Definition: Message.cc:264
void setDelete_chat_photo(const std::optional< bool > &delete_chat_photo)
Definition: Message.cc:168
const std::vector< MessageEntity > & getEntities() const
Definition: Message.cc:248
const std::optional< std::string > & getAuthor_signature() const
Definition: Message.cc:240
std::optional< std::string > forward_signature
Definition: Message.h:179
std::optional< long > migrate_from_chat_id
Definition: Message.h:233
const std::optional< Voice > & getVoice() const
Definition: Message.cc:268
void setVideo_note(const std::optional< VideoNote > &video_note)
Definition: Message.cc:128
void setVoice(const std::optional< Voice > &voice)
Definition: Message.cc:124
std::optional< User > from
Definition: Message.h:167
void addPhoto(const PhotoSize &Photo)
Definition: Message.cc:114
std::optional< User > new_chat_member
Definition: Message.h:215
void addNew_chat_members(const User &new_chat_member)
Definition: Message.cc:132
void setText(const std::optional< std::string > &text)
Definition: Message.cc:96
const std::optional< long > & getMigrate_from_chat_id() const
Definition: Message.cc:332
void setGroup_chat_created(const std::optional< bool > &group_chat_created)
Definition: Message.cc:172
std::optional< Chat > forward_from_chat
Definition: Message.h:175
void setCaption(const std::optional< std::string > &caption)
Definition: Message.cc:136
void setAudio(const std::optional< Audio > &audio)
Definition: Message.cc:104
const std::optional< std::int32_t > & getForward_date() const
Definition: Message.cc:228
const std::vector< PhotoSize > & getNew_chat_photo() const
Definition: Message.cc:308
const std::optional< Contact > & getContact() const
Definition: Message.cc:284
void addEntity(const MessageEntity &messageEntity)
Definition: Message.cc:100
std::int32_t getDate() const
Definition: Message.cc:204
void setForward_from_chat(const std::optional< Chat > &forward_from_chat)
Definition: Message.cc:68
std::optional< std::int32_t > forward_from_message_id
Definition: Message.h:177
void setLocation(const std::optional< Location > &location)
Definition: Message.cc:144
std::vector< PhotoSize > new_chat_photo
Definition: Message.h:221
const std::optional< User > & getLeft_chat_member() const
Definition: Message.cc:300
std::optional< Location > location
Definition: Message.h:211
std::optional< std::string > author_signature
Definition: Message.h:187
const std::optional< bool > & getChannel_chat_created() const
Definition: Message.cc:324
std::vector< MessageEntity > entities
Definition: Message.h:191
Message(std::int32_t message_id, std::int32_t date, Chat chat)
std::optional< bool > group_chat_created
Definition: Message.h:225
const std::optional< bool > & getGroup_chat_created() const
Definition: Message.cc:316
std::optional< Document > document
Definition: Message.h:195
void setDocument(const std::optional< Document > &document)
Definition: Message.cc:108
const std::optional< std::string > & getText() const
Definition: Message.cc:244
const std::vector< PhotoSize > & getPhoto() const
Definition: Message.cc:260
void setContact(const std::optional< Contact > &contact)
Definition: Message.cc:140
const std::optional< std::int32_t > & getForward_from_message_id() const
Definition: Message.cc:220
const std::optional< Location > & getLocation() const
Definition: Message.cc:288
std::optional< User > left_chat_member
Definition: Message.h:217
const std::optional< std::string > & getForward_signature() const
Definition: Message.cc:224
std::int32_t date
Definition: Message.h:169
const std::optional< User > & getFrom() const
Definition: Message.cc:200
const std::optional< Audio > & getAudio() const
Definition: Message.cc:252
std::optional< bool > supergroup_chat_created
Definition: Message.h:227
std::optional< std::string > new_chat_title
Definition: Message.h:219
void addNew_chat_photo(const PhotoSize &newchatphoto)
Definition: Message.cc:164
const std::optional< Venue > & getVenue() const
Definition: Message.cc:292
void setMigrate_to_chat_id(const std::optional< long > &migrate_to_chat_id)
Definition: Message.cc:184