yatbcpp  0.0.1
Yet another Telegram Bot CPP Library
sendMessage.cc
Go to the documentation of this file.
1 
2 #include <string>
3 #include <optional>
4 #include "methods/sendMessage.h"
5 
6 using namespace std;
7 using namespace yatbcpp;
8 
10 // Constructor Section //
12 
13 sendMessage::sendMessage(Chat C, string text) :
14  telegram_methodJSON("sendMessage"),
15  chat_id(to_string(C.getId())), text(move(text))
16 {
17 
18 }
19 
20 sendMessage::sendMessage(int64_t chat_id, string text) :
21  telegram_methodJSON("sendMessage"),
22  chat_id(to_string(chat_id)), text(move(text))
23 {
24 
25 }
26 
27 sendMessage::sendMessage(string chat_id, string text) :
28  telegram_methodJSON("sendMessage"),
29  chat_id(move(chat_id)), text(move(text))
30 {
31 
32 }
33 
35 // Outgoing Section //
37 
38 
39 Json::Value sendMessage::toJson() {
40  Json::Value Outgoing;
41  Outgoing["chat_id"] = getChat_id();
42  Outgoing["text"] = getText();
43  if(getParse_mode()){
44  Outgoing["parse_mode"] = getParse_mode().value();
45  }
46  if(getDisable_web_page_preview()){
47  Outgoing["disable_web_page_preview"] = getDisable_web_page_preview().value();
48  }
50  Outgoing["disable_notification"] = getDisable_notification().value();
51  }
53  Outgoing["reply_to_message_id"] = getReply_to_message_id().value();
54  }
55  //Todo add keyboard
56 
57  return Outgoing;
58 }
59 
61 // Setter Section //
63 
64 void sendMessage::setParse_mode(const optional<string> &parse_mode) {
65  sendMessage::parse_mode = parse_mode;
66 }
67 
68 void sendMessage::setDisable_web_page_preview(const optional<bool> &disable_web_page_preview) {
69  sendMessage::disable_web_page_preview = disable_web_page_preview;
70 }
71 
74 }
75 
78 }
79 
86 }
87 
94 }
95 
102 }
103 
105 // Getter Section //
107 
108 const string &sendMessage::getChat_id() const {
109  return chat_id;
110 }
111 
112 const string &sendMessage::getText() const {
113  return text;
114 }
115 
116 const optional<string> &sendMessage::getParse_mode() const {
117  return parse_mode;
118 }
119 
120 const optional<bool> &sendMessage::getDisable_web_page_preview() const {
121  return disable_web_page_preview;
122 }
123 
124 const optional<bool> &sendMessage::getDisable_notification() const {
125  return disable_notification;
126 }
127 
128 const optional<int32_t> &sendMessage::getReply_to_message_id() const {
129  return reply_to_message_id;
130 }
131 
132 const optional<ReplyMarkup> &sendMessage::getReply_markup() const {
133  return reply_markup;
134 }
135 
136 
137 
void setReply_to_message_id(const std::optional< std::int32_t > &reply_to_message_id)
Definition: sendMessage.cc:76
std::optional< int > reply_to_message_id
Definition: sendLocation.h:80
sendMessage(std::int64_t chat_id, std::string text)
const std::string & getChat_id() const
Definition: sendMessage.cc:108
const std::optional< std::int32_t > & getReply_to_message_id() const
Definition: sendMessage.cc:128
std::optional< bool > disable_notification
Definition: sendLocation.h:79
void setParse_mode(const std::optional< std::string > &parse_mode)
Definition: sendMessage.cc:64
std::optional< std::int32_t > reply_to_message_id
Definition: sendMessage.h:61
void setReplyMarkup(const ReplyKeyboardMarkup RKM)
Definition: sendMessage.cc:84
Definition: Bot.h:27
const std::optional< int > & getReply_to_message_id() const
std::optional< bool > disable_web_page_preview
Definition: sendMessage.h:59
const std::optional< bool > & getDisable_web_page_preview() const
Definition: sendMessage.cc:120
const std::string & getText() const
Definition: sendMessage.cc:112
std::optional< ReplyMarkup > reply_markup
Definition: sendMessage.h:62
void setDisable_notification(const std::optional< bool > &disable_notification)
Definition: sendMessage.cc:72
const std::optional< std::string > & getParse_mode() const
Definition: sendMessage.cc:116
std::optional< ReplyMarkup > reply_markup
Definition: sendLocation.h:81
const std::optional< bool > & getDisable_notification() const
Definition: sendMessage.cc:124
const std::optional< bool > & getDisable_notification() const
const std::string & getChat_id() const
Json::Value toJson()
Definition: sendMessage.cc:39
void setDisable_web_page_preview(const std::optional< bool > &disable_web_page_preview)
Definition: sendMessage.cc:68
std::optional< bool > disable_notification
Definition: sendMessage.h:60
const std::optional< ReplyMarkup > & getReply_markup() const
Definition: sendMessage.cc:132
std::optional< std::string > parse_mode
Definition: sendMessage.h:58