yatbcpp  0.0.1
Yet another Telegram Bot CPP Library
Message.h
Go to the documentation of this file.
1 //
2 // Created by norbert on 18.08.17.
3 //
4 
5 #ifndef YATBCPP_MESSAGE_H
6 #define YATBCPP_MESSAGE_H
7 
8 #include <string>
9 #include <optional>
10 #include "User.h"
11 #include "Chat.h"
12 #include "MessageEntity.h"
13 #include "Audio.h"
14 #include "Document.h"
15 #include "Video.h"
16 #include "Voice.h"
17 #include "VideoNote.h"
18 #include "Contact.h"
19 #include "Location.h"
20 #include "Venue.h"
21 
22 
23 namespace yatbcpp{
25  class Message{
26  public:
27  Message(std::int32_t message_id,std::int32_t date,Chat chat);
28 
29  Message(const Message& Message);
30 
31  void setFrom(const std::optional<User> &from);
32 
33  void setForward_from(const std::optional<User> &forward_from);
34 
35  void setForward_from_chat(const std::optional<Chat> &forward_from_chat);
36 
37  void setForward_from_message_id(const std::optional<std::int32_t> &forward_from_message_id);
38 
39  void setForward_signature(const std::optional<std::string> &forward_signature);
40 
41  void setForward_date(const std::optional<std::int32_t> &forward_date);
42 
43  void setEdit_date(const std::optional<std::int32_t> &edit_date);
44 
45  void setAuthor_signature(const std::optional<std::string> &author_signature);
46 
47  void setText(const std::optional<std::string> &text);
48 
49  void addEntity(const MessageEntity &messageEntity);
50 
51  void setAudio(const std::optional<Audio> &audio);
52 
53  void setDocument(const std::optional<Document> &document);
54 
55  void addPhoto(const PhotoSize &Photo);
56 
57  void setVideo(const std::optional<Video> &video);
58 
59  void setVoice(const std::optional<Voice> &voice);
60 
61  void setVideo_note(const std::optional<VideoNote> &video_note);
62 
64 
65  void setCaption(const std::optional<std::string> &caption);
66 
67  void setContact(const std::optional<Contact> &contact);
68 
69  void setLocation(const std::optional<Location> &location);
70 
71  void setVenue(const std::optional<Venue> &venue);
72 
73  void setNew_chat_member(const std::optional<User> &new_chat_member);
74 
75  void setLeft_chat_member(const std::optional<User> &left_chat_member);
76 
77  void setNew_chat_title(const std::optional<std::string> &new_chat_title);
78 
79  void addNew_chat_photo(const PhotoSize &newchatphoto);
80 
81  void setDelete_chat_photo(const std::optional<bool> &delete_chat_photo);
82 
83  void setGroup_chat_created(const std::optional<bool> &group_chat_created);
84 
85  void setSupergroup_chat_created(const std::optional<bool> &supergroup_chat_created);
86 
87  void setChannel_chat_created(const std::optional<bool> &channel_chat_created);
88 
89  void setMigrate_to_chat_id(const std::optional<long> &migrate_to_chat_id);
90 
91  void setMigrate_from_chat_id(const std::optional<long> &migrate_from_chat_id);
92 
93 
94  std::int32_t getMessage_id() const;
95 
96  const std::optional<User> &getFrom() const;
97 
98  std::int32_t getDate() const;
99 
100  const Chat &getChat() const;
101 
102  const std::optional<User> &getForward_from() const;
103 
104  const std::optional<Chat> &getForward_from_chat() const;
105 
106  const std::optional<std::int32_t> &getForward_from_message_id() const;
107 
108  const std::optional<std::string> &getForward_signature() const;
109 
110  const std::optional<std::int32_t> &getForward_date() const;
111 
112  const std::optional<std::int32_t> &getEdit_date() const;
113 
114  const std::optional<std::string> &getAuthor_signature() const;
115 
116  const std::optional<std::string> &getText() const;
117 
118  const std::vector<MessageEntity> &getEntities() const;
119 
120  const std::optional<Audio> &getAudio() const;
121 
122  const std::optional<Document> &getDocument() const;
123 
124  const std::vector<PhotoSize> &getPhoto() const;
125 
126  const std::optional<Video> &getVideo() const;
127 
128  const std::optional<Voice> &getVoice() const;
129 
130  const std::optional<VideoNote> &getVideo_note() const;
131 
132  const std::vector<User> &getNew_chat_members() const;
133 
134  const std::optional<std::string> &getCaption() const;
135 
136  const std::optional<Contact> &getContact() const;
137 
138  const std::optional<Location> &getLocation() const;
139 
140  const std::optional<Venue> &getVenue() const;
141 
142  const std::optional<User> &getNew_chat_member() const;
143 
144  const std::optional<User> &getLeft_chat_member() const;
145 
146  const std::optional<std::string> &getNew_chat_title() const;
147 
148  const std::vector<PhotoSize> &getNew_chat_photo() const;
149 
150  const std::optional<bool> &getDelete_chat_photo() const;
151 
152  const std::optional<bool> &getGroup_chat_created() const;
153 
154  const std::optional<bool> &getSupergroup_chat_created() const;
155 
156  const std::optional<bool> &getChannel_chat_created() const;
157 
158  const std::optional<long> &getMigrate_to_chat_id() const;
159 
160  const std::optional<long> &getMigrate_from_chat_id() const;
161 
162 
163  private:
165  std::int32_t message_id;
167  std::optional<User> from;//Optional
169  std::int32_t date;
173  std::optional<User> forward_from;
175  std::optional<Chat> forward_from_chat;
177  std::optional<std::int32_t> forward_from_message_id;
179  std::optional<std::string> forward_signature;
181  std::optional<std::int32_t> forward_date;
182 // Optional. For replies, the original message. Note that the Message object in this field will not contain further reply_to_message fields even if it itself is a reply.
183 // std::optional<Message*> reply_to_message;//=NULL;//Optional//sigh auch das noch//naja dann als pointer, ggf adden?
185  std::optional<std::int32_t> edit_date;
187  std::optional<std::string> author_signature;
189  std::optional<std::string> text;
191  std::vector<MessageEntity> entities;
193  std::optional<Audio> audio;
195  std::optional<Document> document;
197  std::vector<PhotoSize> photo;
199  std::optional<Video> video;
201  std::optional<Voice> voice;
203  std::optional<VideoNote> video_note;
205  std::vector<User> new_chat_members;
207  std::optional<std::string> caption;
209  std::optional<Contact> contact;
211  std::optional<Location> location;
213  std::optional <Venue> venue;
215  std::optional<User> new_chat_member;
217  std::optional<User> left_chat_member;
219  std::optional<std::string> new_chat_title;
221  std::vector<PhotoSize> new_chat_photo;
223  std::optional<bool> delete_chat_photo;
225  std::optional<bool> group_chat_created;
227  std::optional<bool> supergroup_chat_created;
229  std::optional<bool> channel_chat_created;
231  std::optional<long> migrate_to_chat_id;
233  std::optional<long> migrate_from_chat_id;
235 // std::optional<Message*> pinned_message;
236  //todo invoice
237  //todo payment
238 
239 
240 
241 
242  };
243 
244 }
245 
246 #endif //YATBCPP_MESSAGE_H
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