You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
410 lines
54 KiB
410 lines
54 KiB
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
<html xmlns="http://www.w3.org/1999/xhtml"> |
|
<head> |
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> |
|
<meta http-equiv="X-UA-Compatible" content="IE=9"/> |
|
<meta name="generator" content="Doxygen 1.8.6"/> |
|
<title>LibTgBotPP: TelegramBot.cc Source File</title> |
|
<link href="tabs.css" rel="stylesheet" type="text/css"/> |
|
<script type="text/javascript" src="jquery.js"></script> |
|
<script type="text/javascript" src="dynsections.js"></script> |
|
<link href="navtree.css" rel="stylesheet" type="text/css"/> |
|
<script type="text/javascript" src="resize.js"></script> |
|
<script type="text/javascript" src="navtree.js"></script> |
|
<script type="text/javascript"> |
|
$(document).ready(initResizable); |
|
$(window).load(resizeHeight); |
|
</script> |
|
<link href="search/search.css" rel="stylesheet" type="text/css"/> |
|
<script type="text/javascript" src="search/search.js"></script> |
|
<script type="text/javascript"> |
|
$(document).ready(function() { searchBox.OnSelectItem(0); }); |
|
</script> |
|
<link href="doxygen.css" rel="stylesheet" type="text/css" /> |
|
</head> |
|
<body> |
|
<div id="top"><!-- do not remove this div, it is closed by doxygen! --> |
|
<div id="titlearea"> |
|
<table cellspacing="0" cellpadding="0"> |
|
<tbody> |
|
<tr style="height: 56px;"> |
|
<td style="padding-left: 0.5em;"> |
|
<div id="projectname">LibTgBotPP |
|
</div> |
|
</td> |
|
</tr> |
|
</tbody> |
|
</table> |
|
</div> |
|
<!-- end header part --> |
|
<!-- Generated by Doxygen 1.8.6 --> |
|
<script type="text/javascript"> |
|
var searchBox = new SearchBox("searchBox", "search",false,'Search'); |
|
</script> |
|
<div id="navrow1" class="tabs"> |
|
<ul class="tablist"> |
|
<li><a href="index.html"><span>Main Page</span></a></li> |
|
<li><a href="namespaces.html"><span>Namespaces</span></a></li> |
|
<li><a href="annotated.html"><span>Classes</span></a></li> |
|
<li class="current"><a href="files.html"><span>Files</span></a></li> |
|
<li> |
|
<div id="MSearchBox" class="MSearchBoxInactive"> |
|
<span class="left"> |
|
<img id="MSearchSelect" src="search/mag_sel.png" |
|
onmouseover="return searchBox.OnSearchSelectShow()" |
|
onmouseout="return searchBox.OnSearchSelectHide()" |
|
alt=""/> |
|
<input type="text" id="MSearchField" value="Search" accesskey="S" |
|
onfocus="searchBox.OnSearchFieldFocus(true)" |
|
onblur="searchBox.OnSearchFieldFocus(false)" |
|
onkeyup="searchBox.OnSearchFieldChange(event)"/> |
|
</span><span class="right"> |
|
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a> |
|
</span> |
|
</div> |
|
</li> |
|
</ul> |
|
</div> |
|
<div id="navrow2" class="tabs2"> |
|
<ul class="tablist"> |
|
<li><a href="files.html"><span>File List</span></a></li> |
|
<li><a href="globals.html"><span>File Members</span></a></li> |
|
</ul> |
|
</div> |
|
</div><!-- top --> |
|
<div id="side-nav" class="ui-resizable side-nav-resizable"> |
|
<div id="nav-tree"> |
|
<div id="nav-tree-contents"> |
|
<div id="nav-sync" class="sync"></div> |
|
</div> |
|
</div> |
|
<div id="splitbar" style="-moz-user-select:none;" |
|
class="ui-resizable-handle"> |
|
</div> |
|
</div> |
|
<script type="text/javascript"> |
|
$(document).ready(function(){initNavTree('TelegramBot_8cc_source.html','');}); |
|
</script> |
|
<div id="doc-content"> |
|
<!-- window showing the filter options --> |
|
<div id="MSearchSelectWindow" |
|
onmouseover="return searchBox.OnSearchSelectShow()" |
|
onmouseout="return searchBox.OnSearchSelectHide()" |
|
onkeydown="return searchBox.OnSearchSelectKey(event)"> |
|
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark"> </span>Macros</a></div> |
|
|
|
<!-- iframe showing the search results (closed by default) --> |
|
<div id="MSearchResultsWindow"> |
|
<iframe src="javascript:void(0)" frameborder="0" |
|
name="MSearchResults" id="MSearchResults"> |
|
</iframe> |
|
</div> |
|
|
|
<div class="header"> |
|
<div class="headertitle"> |
|
<div class="title">TelegramBot.cc</div> </div> |
|
</div><!--header--> |
|
<div class="contents"> |
|
<a href="TelegramBot_8cc.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="preprocessor">#include "<a class="code" href="TelegramBot_8h.html">Telegram/TelegramBot.h</a>"</span></div> |
|
<div class="line"><a name="l00002"></a><span class="lineno"> 2</span> </div> |
|
<div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="preprocessor">#include <iostream></span></div> |
|
<div class="line"><a name="l00004"></a><span class="lineno"> 4</span> </div> |
|
<div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="preprocessor">#include <curlpp/cURLpp.hpp></span></div> |
|
<div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="preprocessor">#include <curlpp/Easy.hpp></span></div> |
|
<div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="preprocessor">#include <curlpp/Infos.hpp></span></div> |
|
<div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="preprocessor">#include <curlpp/Options.hpp></span></div> |
|
<div class="line"><a name="l00009"></a><span class="lineno"> 9</span> </div> |
|
<div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="preprocessor">#include "<a class="code" href="http__build__query_8h.html">http_build_query.h</a>"</span></div> |
|
<div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="preprocessor">#include "<a class="code" href="json__encode_8h.html">json_encode.h</a>"</span></div> |
|
<div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="preprocessor">#include "<a class="code" href="std_8h.html">std.h</a>"</span></div> |
|
<div class="line"><a name="l00013"></a><span class="lineno"> 13</span> </div> |
|
<div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="preprocessor">#include "<a class="code" href="Message_8h.html">Telegram/Message.h</a>"</span></div> |
|
<div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="preprocessor">#include "<a class="code" href="MessageEntity_8h.html">Telegram/MessageEntity.h</a>"</span></div> |
|
<div class="line"><a name="l00016"></a><span class="lineno"> 16</span> </div> |
|
<div class="line"><a name="l00017"></a><span class="lineno"><a class="line" href="TelegramBot_8cc.html#a47cbcc6d148fe0c8f9fb95966026aa97"> 17</a></span> <span class="preprocessor">#define API_URL "https://api.telegram.org/bot"</span></div> |
|
<div class="line"><a name="l00018"></a><span class="lineno"> 18</span> <span class="preprocessor"></span></div> |
|
<div class="line"><a name="l00024"></a><span class="lineno"><a class="line" href="classTelegram_1_1TelegramBot.html#a99b561e695953e6b69a3ddf6937a4811"> 24</a></span> <a class="code" href="classTelegram_1_1TelegramBot.html#a99b561e695953e6b69a3ddf6937a4811">Telegram::TelegramBot::TelegramBot</a>() {</div> |
|
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span> </div> |
|
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span>  this-><a class="code" href="classTelegram_1_1TelegramBot.html#a1ca971ccfb242f7b8656eca3ab7666dd">api_url</a> = <span class="stringliteral">""</span>;</div> |
|
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span>  this-><a class="code" href="classTelegram_1_1TelegramBot.html#ae0d0fe5d54afcc9e6ee16b3d4f8ae895">init</a>();</div> |
|
<div class="line"><a name="l00028"></a><span class="lineno"> 28</span> }</div> |
|
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span> </div> |
|
<div class="line"><a name="l00038"></a><span class="lineno"><a class="line" href="classTelegram_1_1TelegramBot.html#a52f2a5f734bac5f83d2c0e5068618646"> 38</a></span> <a class="code" href="classTelegram_1_1TelegramBot.html#a99b561e695953e6b69a3ddf6937a4811">Telegram::TelegramBot::TelegramBot</a>(std::string token) {</div> |
|
<div class="line"><a name="l00039"></a><span class="lineno"> 39</span> </div> |
|
<div class="line"><a name="l00040"></a><span class="lineno"> 40</span>  this->api_url = <a class="code" href="TelegramBot_8cc.html#a47cbcc6d148fe0c8f9fb95966026aa97">API_URL</a> + token + <span class="stringliteral">"/"</span>;</div> |
|
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span>  this->init();</div> |
|
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span> }</div> |
|
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span> </div> |
|
<div class="line"><a name="l00049"></a><span class="lineno"><a class="line" href="classTelegram_1_1TelegramBot.html#a398bd76186e27d514afd835c5437c6ed"> 49</a></span> <span class="keywordtype">void</span> <a class="code" href="classTelegram_1_1TelegramBot.html#a398bd76186e27d514afd835c5437c6ed">Telegram::TelegramBot::addCommand</a>(<a class="code" href="structTelegram_1_1TCommand.html">TCommand</a> cmd) {</div> |
|
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span> </div> |
|
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span>  <span class="keywordflow">if</span> (cmd.<a class="code" href="structTelegram_1_1TCommand.html#a1c051d162e478b9f98efafbeeed19f9b">command</a>[0] != <span class="charliteral">'/'</span>) {</div> |
|
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span>  cmd.<a class="code" href="structTelegram_1_1TCommand.html#a1c051d162e478b9f98efafbeeed19f9b">command</a> = <span class="stringliteral">"/"</span> + cmd.<a class="code" href="structTelegram_1_1TCommand.html#a1c051d162e478b9f98efafbeeed19f9b">command</a>;</div> |
|
<div class="line"><a name="l00053"></a><span class="lineno"> 53</span>  }</div> |
|
<div class="line"><a name="l00054"></a><span class="lineno"> 54</span>  this->command_map[cmd.<a class="code" href="structTelegram_1_1TCommand.html#a1c051d162e478b9f98efafbeeed19f9b">command</a>] = cmd;</div> |
|
<div class="line"><a name="l00055"></a><span class="lineno"> 55</span> }</div> |
|
<div class="line"><a name="l00056"></a><span class="lineno"> 56</span> </div> |
|
<div class="line"><a name="l00065"></a><span class="lineno"><a class="line" href="classTelegram_1_1TelegramBot.html#aabd1a825b1d7f127f15bf336b985d70d"> 65</a></span> <span class="keywordtype">void</span> <a class="code" href="classTelegram_1_1TelegramBot.html#aabd1a825b1d7f127f15bf336b985d70d">Telegram::TelegramBot::setWebhook</a>(std::string url) {</div> |
|
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span> </div> |
|
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span>  std::map<std::string, std::string> params;</div> |
|
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span> </div> |
|
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>  params[<span class="stringliteral">"url"</span>] = url;</div> |
|
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>  this->apiRequest(<span class="stringliteral">"setWebhook"</span>, params);</div> |
|
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span> }</div> |
|
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span> </div> |
|
<div class="line"><a name="l00079"></a><span class="lineno"><a class="line" href="classTelegram_1_1TelegramBot.html#af6fbb842f679b33dd8a60f94f82d7c81"> 79</a></span> <span class="keywordtype">void</span> <a class="code" href="classTelegram_1_1TelegramBot.html#af6fbb842f679b33dd8a60f94f82d7c81">Telegram::TelegramBot::processMessage</a>(std::string message) {</div> |
|
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span> </div> |
|
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span>  this->msg = <span class="keyword">new</span> <a class="code" href="classTelegram_1_1Message.html">Telegram::Message</a>(message);</div> |
|
<div class="line"><a name="l00082"></a><span class="lineno"> 82</span> </div> |
|
<div class="line"><a name="l00083"></a><span class="lineno"> 83</span>  <a class="code" href="namespaceTelegram.html#aa7927193a64b09836112d3be24c45d85">Telegram::TMessageEntities</a> entities = this->msg->getEntities();</div> |
|
<div class="line"><a name="l00084"></a><span class="lineno"> 84</span> </div> |
|
<div class="line"><a name="l00085"></a><span class="lineno"> 85</span>  <span class="keywordflow">if</span> (entities.size() && (entities[0]->getType() == <span class="stringliteral">"bot_command"</span>)) {</div> |
|
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span>  this->sendMessage(this->processCommand(this->msg->getText()), this->msg->getChat()->getId());</div> |
|
<div class="line"><a name="l00087"></a><span class="lineno"> 87</span>  } <span class="keywordflow">else</span> {</div> |
|
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span>  this->sendMessage(<span class="stringliteral">"Hello "</span> + this->msg->getChat()->getUsername() + <span class="stringliteral">", you told me: '"</span> + msg->getText() + <span class="stringliteral">"'"</span>, this->msg->getChat()->getId());</div> |
|
<div class="line"><a name="l00089"></a><span class="lineno"> 89</span>  }</div> |
|
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span> }</div> |
|
<div class="line"><a name="l00091"></a><span class="lineno"> 91</span> </div> |
|
<div class="line"><a name="l00097"></a><span class="lineno"><a class="line" href="classTelegram_1_1TelegramBot.html#a18326a958f926cdea62339899a29a1e1"> 97</a></span> <a class="code" href="classTelegram_1_1User.html">Telegram::User</a> *<a class="code" href="classTelegram_1_1TelegramBot.html#a18326a958f926cdea62339899a29a1e1">Telegram::TelegramBot::getMe</a>(<span class="keywordtype">void</span>) {</div> |
|
<div class="line"><a name="l00098"></a><span class="lineno"> 98</span> </div> |
|
<div class="line"><a name="l00099"></a><span class="lineno"> 99</span>  Json::Value obj;</div> |
|
<div class="line"><a name="l00100"></a><span class="lineno"> 100</span>  std::map<std::string, std::string> params;</div> |
|
<div class="line"><a name="l00101"></a><span class="lineno"> 101</span> </div> |
|
<div class="line"><a name="l00102"></a><span class="lineno"> 102</span>  obj = this->apiRequestJson(<span class="stringliteral">"getMe"</span>, params);</div> |
|
<div class="line"><a name="l00103"></a><span class="lineno"> 103</span> </div> |
|
<div class="line"><a name="l00104"></a><span class="lineno"> 104</span>  <span class="keywordflow">return</span>(<span class="keyword">new</span> <a class="code" href="classTelegram_1_1User.html">Telegram::User</a>(obj[<span class="stringliteral">"result"</span>]));</div> |
|
<div class="line"><a name="l00105"></a><span class="lineno"> 105</span> }</div> |
|
<div class="line"><a name="l00106"></a><span class="lineno"> 106</span> </div> |
|
<div class="line"><a name="l00115"></a><span class="lineno"><a class="line" href="classTelegram_1_1TelegramBot.html#acd21ba91f309c6d5fbcf7dc0063375ae"> 115</a></span> <a class="code" href="classTelegram_1_1Message.html">Telegram::Message</a> *<a class="code" href="classTelegram_1_1TelegramBot.html#acd21ba91f309c6d5fbcf7dc0063375ae">Telegram::TelegramBot::sendMessage</a>(std::string message, Json::Int64 chat_id) {</div> |
|
<div class="line"><a name="l00116"></a><span class="lineno"> 116</span> </div> |
|
<div class="line"><a name="l00117"></a><span class="lineno"> 117</span>  <span class="keywordflow">return</span>(this->sendMessage(message, <a class="code" href="example01_8cc.html#a0d2f37137ee1fd6ff4a0ef803849dd63">SSTR</a>(chat_id)));</div> |
|
<div class="line"><a name="l00118"></a><span class="lineno"> 118</span> }</div> |
|
<div class="line"><a name="l00119"></a><span class="lineno"> 119</span> </div> |
|
<div class="line"><a name="l00128"></a><span class="lineno"><a class="line" href="classTelegram_1_1TelegramBot.html#a592741f23db9675eb5e6ae60f6ee926b"> 128</a></span> <a class="code" href="classTelegram_1_1Message.html">Telegram::Message</a>* <a class="code" href="classTelegram_1_1TelegramBot.html#acd21ba91f309c6d5fbcf7dc0063375ae">Telegram::TelegramBot::sendMessage</a>(std::string message, std::string chat_id) {</div> |
|
<div class="line"><a name="l00129"></a><span class="lineno"> 129</span> </div> |
|
<div class="line"><a name="l00130"></a><span class="lineno"> 130</span>  std::map<std::string, std::string> params;</div> |
|
<div class="line"><a name="l00131"></a><span class="lineno"> 131</span>  Json::Value obj;</div> |
|
<div class="line"><a name="l00132"></a><span class="lineno"> 132</span> </div> |
|
<div class="line"><a name="l00133"></a><span class="lineno"> 133</span>  params[<span class="stringliteral">"chat_id"</span>] = chat_id;</div> |
|
<div class="line"><a name="l00134"></a><span class="lineno"> 134</span>  params[<span class="stringliteral">"text"</span>] = message;</div> |
|
<div class="line"><a name="l00135"></a><span class="lineno"> 135</span> </div> |
|
<div class="line"><a name="l00136"></a><span class="lineno"> 136</span>  obj = this->apiRequestJson(<span class="stringliteral">"sendMessage"</span>, params);</div> |
|
<div class="line"><a name="l00137"></a><span class="lineno"> 137</span> </div> |
|
<div class="line"><a name="l00138"></a><span class="lineno"> 138</span>  <span class="keywordflow">return</span>(<span class="keyword">new</span> <a class="code" href="classTelegram_1_1Message.html">Telegram::Message</a>(obj[<span class="stringliteral">"result"</span>]));</div> |
|
<div class="line"><a name="l00139"></a><span class="lineno"> 139</span> }</div> |
|
<div class="line"><a name="l00140"></a><span class="lineno"> 140</span> </div> |
|
<div class="line"><a name="l00149"></a><span class="lineno"><a class="line" href="classTelegram_1_1TelegramBot.html#adb9d623814ecbbeeefef4faa073b73c3"> 149</a></span> <a class="code" href="classTelegram_1_1Message.html">Telegram::Message</a>* <a class="code" href="classTelegram_1_1TelegramBot.html#adb9d623814ecbbeeefef4faa073b73c3">Telegram::TelegramBot::sendPhoto</a>(std::string URL, Json::Int64 chat_id) {</div> |
|
<div class="line"><a name="l00150"></a><span class="lineno"> 150</span> </div> |
|
<div class="line"><a name="l00151"></a><span class="lineno"> 151</span>  <span class="keywordflow">return</span>(this->sendPhoto(URL, <a class="code" href="example01_8cc.html#a0d2f37137ee1fd6ff4a0ef803849dd63">SSTR</a>(chat_id)));</div> |
|
<div class="line"><a name="l00152"></a><span class="lineno"> 152</span> }</div> |
|
<div class="line"><a name="l00153"></a><span class="lineno"> 153</span> </div> |
|
<div class="line"><a name="l00162"></a><span class="lineno"><a class="line" href="classTelegram_1_1TelegramBot.html#a1f3a5159b2868b2aa7a84f3ca8f0104c"> 162</a></span> <a class="code" href="classTelegram_1_1Message.html">Telegram::Message</a>* <a class="code" href="classTelegram_1_1TelegramBot.html#adb9d623814ecbbeeefef4faa073b73c3">Telegram::TelegramBot::sendPhoto</a>(std::string URL, std::string chat_id) {</div> |
|
<div class="line"><a name="l00163"></a><span class="lineno"> 163</span> </div> |
|
<div class="line"><a name="l00164"></a><span class="lineno"> 164</span>  Json::Value obj;</div> |
|
<div class="line"><a name="l00165"></a><span class="lineno"> 165</span> </div> |
|
<div class="line"><a name="l00166"></a><span class="lineno"> 166</span>  std::map<std::string, std::string> params;</div> |
|
<div class="line"><a name="l00167"></a><span class="lineno"> 167</span> </div> |
|
<div class="line"><a name="l00168"></a><span class="lineno"> 168</span>  params[<span class="stringliteral">"chat_id"</span>] = chat_id;</div> |
|
<div class="line"><a name="l00169"></a><span class="lineno"> 169</span>  params[<span class="stringliteral">"photo"</span>] = URL;</div> |
|
<div class="line"><a name="l00170"></a><span class="lineno"> 170</span> </div> |
|
<div class="line"><a name="l00171"></a><span class="lineno"> 171</span>  <span class="keywordflow">if</span> ((URL.substr(0, 8) == <span class="stringliteral">"https://"</span>) || (URL.substr(0, 7) == <span class="stringliteral">"http://"</span>)) {</div> |
|
<div class="line"><a name="l00172"></a><span class="lineno"> 172</span>  obj = this->apiRequestJson(<span class="stringliteral">"sendPhoto"</span>, params);</div> |
|
<div class="line"><a name="l00173"></a><span class="lineno"> 173</span>  }</div> |
|
<div class="line"><a name="l00174"></a><span class="lineno"> 174</span> </div> |
|
<div class="line"><a name="l00175"></a><span class="lineno"> 175</span>  <span class="keywordflow">if</span> (URL.substr(0, 7) == <span class="stringliteral">"file://"</span>) {</div> |
|
<div class="line"><a name="l00176"></a><span class="lineno"> 176</span>  obj = this->apiRequestFile(URL.substr(7, std::string::npos), <span class="stringliteral">"photo"</span>, chat_id);</div> |
|
<div class="line"><a name="l00177"></a><span class="lineno"> 177</span>  }</div> |
|
<div class="line"><a name="l00178"></a><span class="lineno"> 178</span> </div> |
|
<div class="line"><a name="l00179"></a><span class="lineno"> 179</span>  <span class="keywordflow">return</span>(<span class="keyword">new</span> <a class="code" href="classTelegram_1_1Message.html">Telegram::Message</a>(obj[<span class="stringliteral">"result"</span>]));</div> |
|
<div class="line"><a name="l00180"></a><span class="lineno"> 180</span> }</div> |
|
<div class="line"><a name="l00181"></a><span class="lineno"> 181</span> </div> |
|
<div class="line"><a name="l00182"></a><span class="lineno"><a class="line" href="classTelegram_1_1TelegramBot.html#a7c54766f656974b35f03ea510d7b6a4f"> 182</a></span> <a class="code" href="classTelegram_1_1Message.html">Telegram::Message</a> *<a class="code" href="classTelegram_1_1TelegramBot.html#a7c54766f656974b35f03ea510d7b6a4f">Telegram::TelegramBot::getMessage</a>() {</div> |
|
<div class="line"><a name="l00183"></a><span class="lineno"> 183</span> </div> |
|
<div class="line"><a name="l00184"></a><span class="lineno"> 184</span>  <span class="keywordflow">return</span>(this->msg);</div> |
|
<div class="line"><a name="l00185"></a><span class="lineno"> 185</span> }</div> |
|
<div class="line"><a name="l00186"></a><span class="lineno"> 186</span> </div> |
|
<div class="line"><a name="l00192"></a><span class="lineno"><a class="line" href="classTelegram_1_1TelegramBot.html#aae9aba06108ce34f9766199c6588e1d6"> 192</a></span> <a class="code" href="namespaceTelegram.html#ad82f4bcddd3c7921e8842bb30170a1c2">Telegram::TCommandMap</a> <a class="code" href="classTelegram_1_1TelegramBot.html#aae9aba06108ce34f9766199c6588e1d6">Telegram::TelegramBot::getCommandMap</a>() {</div> |
|
<div class="line"><a name="l00193"></a><span class="lineno"> 193</span> </div> |
|
<div class="line"><a name="l00194"></a><span class="lineno"> 194</span>  <span class="keywordflow">return</span>(this->command_map);</div> |
|
<div class="line"><a name="l00195"></a><span class="lineno"> 195</span> }</div> |
|
<div class="line"><a name="l00196"></a><span class="lineno"> 196</span> </div> |
|
<div class="line"><a name="l00197"></a><span class="lineno"> 197</span> <span class="comment">// Private methods</span></div> |
|
<div class="line"><a name="l00198"></a><span class="lineno"> 198</span> </div> |
|
<div class="line"><a name="l00203"></a><span class="lineno"><a class="line" href="classTelegram_1_1TelegramBot.html#ae0d0fe5d54afcc9e6ee16b3d4f8ae895"> 203</a></span> <span class="keywordtype">void</span> <a class="code" href="classTelegram_1_1TelegramBot.html#ae0d0fe5d54afcc9e6ee16b3d4f8ae895">Telegram::TelegramBot::init</a>() {</div> |
|
<div class="line"><a name="l00204"></a><span class="lineno"> 204</span> </div> |
|
<div class="line"><a name="l00205"></a><span class="lineno"> 205</span>  std::cout << <span class="stringliteral">"Content-type: text/html\r\n\r\n"</span> << std::endl;</div> |
|
<div class="line"><a name="l00206"></a><span class="lineno"> 206</span> }</div> |
|
<div class="line"><a name="l00207"></a><span class="lineno"> 207</span> </div> |
|
<div class="line"><a name="l00216"></a><span class="lineno"><a class="line" href="classTelegram_1_1TelegramBot.html#a7e07f1ca99390958ef5c6c95cbf18258"> 216</a></span> <span class="keywordtype">void</span> <a class="code" href="classTelegram_1_1TelegramBot.html#a7e07f1ca99390958ef5c6c95cbf18258">Telegram::TelegramBot::apiRequest</a>(std::string method, std::map<std::string, std::string> parameters) {</div> |
|
<div class="line"><a name="l00217"></a><span class="lineno"> 217</span> </div> |
|
<div class="line"><a name="l00218"></a><span class="lineno"> 218</span>  parameters[<span class="stringliteral">"method"</span>] = method;</div> |
|
<div class="line"><a name="l00219"></a><span class="lineno"> 219</span> </div> |
|
<div class="line"><a name="l00220"></a><span class="lineno"> 220</span>  Json::Value jValues;</div> |
|
<div class="line"><a name="l00221"></a><span class="lineno"> 221</span>  Json::StyledWriter w;</div> |
|
<div class="line"><a name="l00222"></a><span class="lineno"> 222</span> </div> |
|
<div class="line"><a name="l00223"></a><span class="lineno"> 223</span>  <span class="keywordflow">for</span>(std::map<std::string, std::string>::iterator it = parameters.begin(); it != parameters.end(); ++it) {</div> |
|
<div class="line"><a name="l00224"></a><span class="lineno"> 224</span>  jValues[(*it).first] = (*it).second;</div> |
|
<div class="line"><a name="l00225"></a><span class="lineno"> 225</span>  }</div> |
|
<div class="line"><a name="l00226"></a><span class="lineno"> 226</span> </div> |
|
<div class="line"><a name="l00227"></a><span class="lineno"> 227</span>  <span class="keywordflow">try</span> {</div> |
|
<div class="line"><a name="l00228"></a><span class="lineno"> 228</span>  cURLpp::Easy handle;</div> |
|
<div class="line"><a name="l00229"></a><span class="lineno"> 229</span>  std::string url = this->api_url + method + <span class="stringliteral">"?"</span> + <a class="code" href="http__build__query_8cc.html#a1e3cd58bbf46d30f168bbc0ee5cc486b">http_build_query</a>(parameters);</div> |
|
<div class="line"><a name="l00230"></a><span class="lineno"> 230</span> </div> |
|
<div class="line"><a name="l00231"></a><span class="lineno"> 231</span>  handle.setOpt(cURLpp::Options::Url(url));</div> |
|
<div class="line"><a name="l00232"></a><span class="lineno"> 232</span>  handle.setOpt(cURLpp::Options::ConnectTimeout(5));</div> |
|
<div class="line"><a name="l00233"></a><span class="lineno"> 233</span>  handle.setOpt(cURLpp::Options::Timeout(60));</div> |
|
<div class="line"><a name="l00234"></a><span class="lineno"> 234</span>  handle.perform(); <span class="comment">// Do the curl request</span></div> |
|
<div class="line"><a name="l00235"></a><span class="lineno"> 235</span> </div> |
|
<div class="line"><a name="l00236"></a><span class="lineno"> 236</span>  <span class="keywordtype">int</span> code;</div> |
|
<div class="line"><a name="l00237"></a><span class="lineno"> 237</span>  code = cURLpp::Infos::ResponseCode::get(handle);</div> |
|
<div class="line"><a name="l00238"></a><span class="lineno"> 238</span>  }</div> |
|
<div class="line"><a name="l00239"></a><span class="lineno"> 239</span>  <span class="keywordflow">catch</span>(cURLpp::LogicError &e) {</div> |
|
<div class="line"><a name="l00240"></a><span class="lineno"> 240</span>  <a class="code" href="std_8cc.html#a55fa50be9360d756a7cf448d7e9e0cc9">Log</a>(e.what());</div> |
|
<div class="line"><a name="l00241"></a><span class="lineno"> 241</span>  }</div> |
|
<div class="line"><a name="l00242"></a><span class="lineno"> 242</span>  <span class="keywordflow">catch</span>(cURLpp::RuntimeError &e) {</div> |
|
<div class="line"><a name="l00243"></a><span class="lineno"> 243</span>  <a class="code" href="std_8cc.html#a55fa50be9360d756a7cf448d7e9e0cc9">Log</a>(e.what());</div> |
|
<div class="line"><a name="l00244"></a><span class="lineno"> 244</span>  }</div> |
|
<div class="line"><a name="l00245"></a><span class="lineno"> 245</span>  <span class="keywordflow">catch</span>(std::exception &e) {</div> |
|
<div class="line"><a name="l00246"></a><span class="lineno"> 246</span>  <a class="code" href="std_8cc.html#a55fa50be9360d756a7cf448d7e9e0cc9">Log</a>(e.what());</div> |
|
<div class="line"><a name="l00247"></a><span class="lineno"> 247</span>  }</div> |
|
<div class="line"><a name="l00248"></a><span class="lineno"> 248</span> }</div> |
|
<div class="line"><a name="l00249"></a><span class="lineno"> 249</span> </div> |
|
<div class="line"><a name="l00258"></a><span class="lineno"><a class="line" href="classTelegram_1_1TelegramBot.html#aba249898870b8250da0ac67ba6a55e88"> 258</a></span> Json::Value <a class="code" href="classTelegram_1_1TelegramBot.html#aba249898870b8250da0ac67ba6a55e88">Telegram::TelegramBot::apiRequestJson</a>(std::string method, std::map<std::string, std::string> parameters) {</div> |
|
<div class="line"><a name="l00259"></a><span class="lineno"> 259</span> </div> |
|
<div class="line"><a name="l00260"></a><span class="lineno"> 260</span>  std::stringstream result; <span class="comment">// Stores the result of the api call</span></div> |
|
<div class="line"><a name="l00261"></a><span class="lineno"> 261</span>  parameters[<span class="stringliteral">"method"</span>] = method;</div> |
|
<div class="line"><a name="l00262"></a><span class="lineno"> 262</span> </div> |
|
<div class="line"><a name="l00263"></a><span class="lineno"> 263</span>  <span class="keywordflow">try</span> {</div> |
|
<div class="line"><a name="l00264"></a><span class="lineno"> 264</span>  cURLpp::Easy handle;</div> |
|
<div class="line"><a name="l00265"></a><span class="lineno"> 265</span>  cURLpp::Cleanup cleaner;</div> |
|
<div class="line"><a name="l00266"></a><span class="lineno"> 266</span> </div> |
|
<div class="line"><a name="l00267"></a><span class="lineno"> 267</span>  std::list<std::string> header;</div> |
|
<div class="line"><a name="l00268"></a><span class="lineno"> 268</span>  header.push_back(<span class="stringliteral">"Content-Type: application/json"</span>);</div> |
|
<div class="line"><a name="l00269"></a><span class="lineno"> 269</span> </div> |
|
<div class="line"><a name="l00270"></a><span class="lineno"> 270</span>  handle.setOpt(cURLpp::Options::Url(this->api_url));</div> |
|
<div class="line"><a name="l00271"></a><span class="lineno"> 271</span>  handle.setOpt(cURLpp::Options::ConnectTimeout(5));</div> |
|
<div class="line"><a name="l00272"></a><span class="lineno"> 272</span>  handle.setOpt(cURLpp::Options::Timeout(60));</div> |
|
<div class="line"><a name="l00273"></a><span class="lineno"> 273</span>  handle.setOpt(cURLpp::Options::HttpHeader(header));</div> |
|
<div class="line"><a name="l00274"></a><span class="lineno"> 274</span>  handle.setOpt(cURLpp::Options::PostFields(<a class="code" href="json__encode_8cc.html#ad8ce82c71c39fc700005394fccc714e2">json_encode</a>(parameters)));</div> |
|
<div class="line"><a name="l00275"></a><span class="lineno"> 275</span>  handle.setOpt(cURLpp::Options::WriteStream(&result));</div> |
|
<div class="line"><a name="l00276"></a><span class="lineno"> 276</span> </div> |
|
<div class="line"><a name="l00277"></a><span class="lineno"> 277</span>  handle.perform(); <span class="comment">// Do the curl request</span></div> |
|
<div class="line"><a name="l00278"></a><span class="lineno"> 278</span>  }</div> |
|
<div class="line"><a name="l00279"></a><span class="lineno"> 279</span>  <span class="keywordflow">catch</span>(cURLpp::LogicError &e) {</div> |
|
<div class="line"><a name="l00280"></a><span class="lineno"> 280</span>  <a class="code" href="std_8cc.html#a55fa50be9360d756a7cf448d7e9e0cc9">Log</a>(e.what());</div> |
|
<div class="line"><a name="l00281"></a><span class="lineno"> 281</span>  }</div> |
|
<div class="line"><a name="l00282"></a><span class="lineno"> 282</span>  <span class="keywordflow">catch</span>(cURLpp::RuntimeError &e) {</div> |
|
<div class="line"><a name="l00283"></a><span class="lineno"> 283</span>  <a class="code" href="std_8cc.html#a55fa50be9360d756a7cf448d7e9e0cc9">Log</a>(e.what());</div> |
|
<div class="line"><a name="l00284"></a><span class="lineno"> 284</span>  }</div> |
|
<div class="line"><a name="l00285"></a><span class="lineno"> 285</span>  <span class="keywordflow">catch</span>(std::exception &e) {</div> |
|
<div class="line"><a name="l00286"></a><span class="lineno"> 286</span>  <a class="code" href="std_8cc.html#a55fa50be9360d756a7cf448d7e9e0cc9">Log</a>(e.what());</div> |
|
<div class="line"><a name="l00287"></a><span class="lineno"> 287</span>  }</div> |
|
<div class="line"><a name="l00288"></a><span class="lineno"> 288</span> </div> |
|
<div class="line"><a name="l00289"></a><span class="lineno"> 289</span>  Json::Reader jreader;</div> |
|
<div class="line"><a name="l00290"></a><span class="lineno"> 290</span>  Json::Value obj;</div> |
|
<div class="line"><a name="l00291"></a><span class="lineno"> 291</span>  jreader.parse(result.str(), obj);</div> |
|
<div class="line"><a name="l00292"></a><span class="lineno"> 292</span> </div> |
|
<div class="line"><a name="l00293"></a><span class="lineno"> 293</span>  <span class="keywordflow">return</span> (obj);</div> |
|
<div class="line"><a name="l00294"></a><span class="lineno"> 294</span> }</div> |
|
<div class="line"><a name="l00295"></a><span class="lineno"> 295</span> </div> |
|
<div class="line"><a name="l00305"></a><span class="lineno"><a class="line" href="classTelegram_1_1TelegramBot.html#afc52db678c8dacb568075b8c013eafde"> 305</a></span> Json::Value <a class="code" href="classTelegram_1_1TelegramBot.html#afc52db678c8dacb568075b8c013eafde">Telegram::TelegramBot::apiRequestFile</a>(std::string filename, std::string type, std::string chat_id) {</div> |
|
<div class="line"><a name="l00306"></a><span class="lineno"> 306</span> </div> |
|
<div class="line"><a name="l00307"></a><span class="lineno"> 307</span>  std::stringstream result; <span class="comment">// Stores the result of the api call</span></div> |
|
<div class="line"><a name="l00308"></a><span class="lineno"> 308</span>  cURLpp::Forms formParts; <span class="comment">// Parts to be sent</span></div> |
|
<div class="line"><a name="l00309"></a><span class="lineno"> 309</span> </div> |
|
<div class="line"><a name="l00310"></a><span class="lineno"> 310</span>  <span class="keywordflow">try</span> {</div> |
|
<div class="line"><a name="l00311"></a><span class="lineno"> 311</span>  cURLpp::Easy handle;</div> |
|
<div class="line"><a name="l00312"></a><span class="lineno"> 312</span>  cURLpp::Cleanup cleaner;</div> |
|
<div class="line"><a name="l00313"></a><span class="lineno"> 313</span> </div> |
|
<div class="line"><a name="l00314"></a><span class="lineno"> 314</span>  handle.setOpt(cURLpp::Options::Url(this->api_url + <span class="stringliteral">"send"</span> + type));</div> |
|
<div class="line"><a name="l00315"></a><span class="lineno"> 315</span>  {</div> |
|
<div class="line"><a name="l00316"></a><span class="lineno"> 316</span>  cURLpp::Forms parts;</div> |
|
<div class="line"><a name="l00317"></a><span class="lineno"> 317</span>  parts.push_back(<span class="keyword">new</span> cURLpp::FormParts::Content(<span class="stringliteral">"chat_id"</span>, chat_id));</div> |
|
<div class="line"><a name="l00318"></a><span class="lineno"> 318</span>  parts.push_back(<span class="keyword">new</span> cURLpp::FormParts::File(type, filename));</div> |
|
<div class="line"><a name="l00319"></a><span class="lineno"> 319</span>  handle.setOpt(cURLpp::Options::HttpPost(parts));</div> |
|
<div class="line"><a name="l00320"></a><span class="lineno"> 320</span>  }</div> |
|
<div class="line"><a name="l00321"></a><span class="lineno"> 321</span> </div> |
|
<div class="line"><a name="l00322"></a><span class="lineno"> 322</span>  handle.perform();</div> |
|
<div class="line"><a name="l00323"></a><span class="lineno"> 323</span> </div> |
|
<div class="line"><a name="l00324"></a><span class="lineno"> 324</span>  }</div> |
|
<div class="line"><a name="l00325"></a><span class="lineno"> 325</span>  <span class="keywordflow">catch</span>(cURLpp::LogicError &e) {</div> |
|
<div class="line"><a name="l00326"></a><span class="lineno"> 326</span>  <a class="code" href="std_8cc.html#a55fa50be9360d756a7cf448d7e9e0cc9">Log</a>(e.what());</div> |
|
<div class="line"><a name="l00327"></a><span class="lineno"> 327</span>  }</div> |
|
<div class="line"><a name="l00328"></a><span class="lineno"> 328</span>  <span class="keywordflow">catch</span>(cURLpp::RuntimeError &e) {</div> |
|
<div class="line"><a name="l00329"></a><span class="lineno"> 329</span>  <a class="code" href="std_8cc.html#a55fa50be9360d756a7cf448d7e9e0cc9">Log</a>(e.what());</div> |
|
<div class="line"><a name="l00330"></a><span class="lineno"> 330</span>  }</div> |
|
<div class="line"><a name="l00331"></a><span class="lineno"> 331</span>  <span class="keywordflow">catch</span>(std::exception &e) {</div> |
|
<div class="line"><a name="l00332"></a><span class="lineno"> 332</span>  <a class="code" href="std_8cc.html#a55fa50be9360d756a7cf448d7e9e0cc9">Log</a>(e.what());</div> |
|
<div class="line"><a name="l00333"></a><span class="lineno"> 333</span>  }</div> |
|
<div class="line"><a name="l00334"></a><span class="lineno"> 334</span> </div> |
|
<div class="line"><a name="l00335"></a><span class="lineno"> 335</span>  Json::Reader jreader;</div> |
|
<div class="line"><a name="l00336"></a><span class="lineno"> 336</span>  Json::Value obj;</div> |
|
<div class="line"><a name="l00337"></a><span class="lineno"> 337</span>  jreader.parse(result.str(), obj);</div> |
|
<div class="line"><a name="l00338"></a><span class="lineno"> 338</span> </div> |
|
<div class="line"><a name="l00339"></a><span class="lineno"> 339</span>  <span class="keywordflow">return</span> (obj);</div> |
|
<div class="line"><a name="l00340"></a><span class="lineno"> 340</span> }</div> |
|
<div class="line"><a name="l00341"></a><span class="lineno"> 341</span> </div> |
|
<div class="line"><a name="l00352"></a><span class="lineno"><a class="line" href="classTelegram_1_1TelegramBot.html#aed4dd1ce506259c0e82f0c46fe125ca4"> 352</a></span> std::string <a class="code" href="classTelegram_1_1TelegramBot.html#aed4dd1ce506259c0e82f0c46fe125ca4">Telegram::TelegramBot::processCommand</a>(std::string cmd) {</div> |
|
<div class="line"><a name="l00353"></a><span class="lineno"> 353</span> </div> |
|
<div class="line"><a name="l00354"></a><span class="lineno"> 354</span>  <span class="comment">// Process command</span></div> |
|
<div class="line"><a name="l00355"></a><span class="lineno"> 355</span>  std::string sCommand;</div> |
|
<div class="line"><a name="l00356"></a><span class="lineno"> 356</span>  std::string sResult;</div> |
|
<div class="line"><a name="l00357"></a><span class="lineno"> 357</span>  std::vector<std::string> vCmdLine = <a class="code" href="std_8cc.html#ae7427d6dcae9b9190db26d2e1b6700af">split</a>(cmd, <span class="charliteral">' '</span>);</div> |
|
<div class="line"><a name="l00358"></a><span class="lineno"> 358</span> </div> |
|
<div class="line"><a name="l00359"></a><span class="lineno"> 359</span>  <span class="keywordflow">if</span>((vCmdLine.size() > 0) && (this->command_map.find(vCmdLine[0]) != this->command_map.end())) {</div> |
|
<div class="line"><a name="l00360"></a><span class="lineno"> 360</span>  sCommand = vCmdLine[0];</div> |
|
<div class="line"><a name="l00361"></a><span class="lineno"> 361</span>  vCmdLine.erase(vCmdLine.begin()); <span class="comment">// First value is the command itself</span></div> |
|
<div class="line"><a name="l00362"></a><span class="lineno"> 362</span>  <a class="code" href="structTelegram_1_1TCommand.html">TCommand</a> cs = this->command_map[sCommand];</div> |
|
<div class="line"><a name="l00363"></a><span class="lineno"> 363</span>  sResult = (*cs.<a class="code" href="structTelegram_1_1TCommand.html#a3f2c8ecbfd34be25baa577afee2e6e52">callback</a>)(<span class="keyword">this</span>, vCmdLine);</div> |
|
<div class="line"><a name="l00364"></a><span class="lineno"> 364</span>  } <span class="keywordflow">else</span> {</div> |
|
<div class="line"><a name="l00365"></a><span class="lineno"> 365</span>  sResult = <span class="stringliteral">"Unknown command"</span>;</div> |
|
<div class="line"><a name="l00366"></a><span class="lineno"> 366</span>  }</div> |
|
<div class="line"><a name="l00367"></a><span class="lineno"> 367</span> </div> |
|
<div class="line"><a name="l00368"></a><span class="lineno"> 368</span>  <span class="keywordflow">return</span>(sResult);</div> |
|
<div class="line"><a name="l00369"></a><span class="lineno"> 369</span> }</div> |
|
<div class="ttc" id="classTelegram_1_1TelegramBot_html_ae0d0fe5d54afcc9e6ee16b3d4f8ae895"><div class="ttname"><a href="classTelegram_1_1TelegramBot.html#ae0d0fe5d54afcc9e6ee16b3d4f8ae895">Telegram::TelegramBot::init</a></div><div class="ttdeci">void init()</div><div class="ttdef"><b>Definition:</b> <a href="TelegramBot_8cc_source.html#l00203">TelegramBot.cc:203</a></div></div> |
|
<div class="ttc" id="structTelegram_1_1TCommand_html_a1c051d162e478b9f98efafbeeed19f9b"><div class="ttname"><a href="structTelegram_1_1TCommand.html#a1c051d162e478b9f98efafbeeed19f9b">Telegram::TCommand::command</a></div><div class="ttdeci">std::string command</div><div class="ttdoc">The command, e.g. /help. </div><div class="ttdef"><b>Definition:</b> <a href="TelegramBot_8h_source.html#l00027">TelegramBot.h:27</a></div></div> |
|
<div class="ttc" id="Message_8h_html"><div class="ttname"><a href="Message_8h.html">Message.h</a></div></div> |
|
<div class="ttc" id="example01_8cc_html_a0d2f37137ee1fd6ff4a0ef803849dd63"><div class="ttname"><a href="example01_8cc.html#a0d2f37137ee1fd6ff4a0ef803849dd63">SSTR</a></div><div class="ttdeci">#define SSTR(x)</div><div class="ttdef"><b>Definition:</b> <a href="example01_8cc_source.html#l00035">example01.cc:35</a></div></div> |
|
<div class="ttc" id="classTelegram_1_1Message_html"><div class="ttname"><a href="classTelegram_1_1Message.html">Telegram::Message</a></div><div class="ttdef"><b>Definition:</b> <a href="Message_8h_source.html#l00027">Message.h:27</a></div></div> |
|
<div class="ttc" id="std_8cc_html_ae7427d6dcae9b9190db26d2e1b6700af"><div class="ttname"><a href="std_8cc.html#ae7427d6dcae9b9190db26d2e1b6700af">split</a></div><div class="ttdeci">std::vector< std::string > split(const std::string &text, char sep)</div><div class="ttdef"><b>Definition:</b> <a href="std_8cc_source.html#l00042">std.cc:42</a></div></div> |
|
<div class="ttc" id="classTelegram_1_1TelegramBot_html_a18326a958f926cdea62339899a29a1e1"><div class="ttname"><a href="classTelegram_1_1TelegramBot.html#a18326a958f926cdea62339899a29a1e1">Telegram::TelegramBot::getMe</a></div><div class="ttdeci">Telegram::User * getMe(void)</div><div class="ttdef"><b>Definition:</b> <a href="TelegramBot_8cc_source.html#l00097">TelegramBot.cc:97</a></div></div> |
|
<div class="ttc" id="classTelegram_1_1TelegramBot_html_aabd1a825b1d7f127f15bf336b985d70d"><div class="ttname"><a href="classTelegram_1_1TelegramBot.html#aabd1a825b1d7f127f15bf336b985d70d">Telegram::TelegramBot::setWebhook</a></div><div class="ttdeci">void setWebhook(std::string)</div><div class="ttdef"><b>Definition:</b> <a href="TelegramBot_8cc_source.html#l00065">TelegramBot.cc:65</a></div></div> |
|
<div class="ttc" id="classTelegram_1_1TelegramBot_html_afc52db678c8dacb568075b8c013eafde"><div class="ttname"><a href="classTelegram_1_1TelegramBot.html#afc52db678c8dacb568075b8c013eafde">Telegram::TelegramBot::apiRequestFile</a></div><div class="ttdeci">Json::Value apiRequestFile(std::string, std::string, std::string)</div><div class="ttdef"><b>Definition:</b> <a href="TelegramBot_8cc_source.html#l00305">TelegramBot.cc:305</a></div></div> |
|
<div class="ttc" id="classTelegram_1_1TelegramBot_html_af6fbb842f679b33dd8a60f94f82d7c81"><div class="ttname"><a href="classTelegram_1_1TelegramBot.html#af6fbb842f679b33dd8a60f94f82d7c81">Telegram::TelegramBot::processMessage</a></div><div class="ttdeci">void processMessage(std::string)</div><div class="ttdef"><b>Definition:</b> <a href="TelegramBot_8cc_source.html#l00079">TelegramBot.cc:79</a></div></div> |
|
<div class="ttc" id="classTelegram_1_1TelegramBot_html_a7e07f1ca99390958ef5c6c95cbf18258"><div class="ttname"><a href="classTelegram_1_1TelegramBot.html#a7e07f1ca99390958ef5c6c95cbf18258">Telegram::TelegramBot::apiRequest</a></div><div class="ttdeci">void apiRequest(std::string, std::map< std::string, std::string >)</div><div class="ttdef"><b>Definition:</b> <a href="TelegramBot_8cc_source.html#l00216">TelegramBot.cc:216</a></div></div> |
|
<div class="ttc" id="classTelegram_1_1TelegramBot_html_aae9aba06108ce34f9766199c6588e1d6"><div class="ttname"><a href="classTelegram_1_1TelegramBot.html#aae9aba06108ce34f9766199c6588e1d6">Telegram::TelegramBot::getCommandMap</a></div><div class="ttdeci">std::map< std::string, TCommand > getCommandMap()</div><div class="ttdef"><b>Definition:</b> <a href="TelegramBot_8cc_source.html#l00192">TelegramBot.cc:192</a></div></div> |
|
<div class="ttc" id="classTelegram_1_1TelegramBot_html_aed4dd1ce506259c0e82f0c46fe125ca4"><div class="ttname"><a href="classTelegram_1_1TelegramBot.html#aed4dd1ce506259c0e82f0c46fe125ca4">Telegram::TelegramBot::processCommand</a></div><div class="ttdeci">std::string processCommand(std::string)</div><div class="ttdef"><b>Definition:</b> <a href="TelegramBot_8cc_source.html#l00352">TelegramBot.cc:352</a></div></div> |
|
<div class="ttc" id="structTelegram_1_1TCommand_html"><div class="ttname"><a href="structTelegram_1_1TCommand.html">Telegram::TCommand</a></div><div class="ttdef"><b>Definition:</b> <a href="TelegramBot_8h_source.html#l00026">TelegramBot.h:26</a></div></div> |
|
<div class="ttc" id="TelegramBot_8h_html"><div class="ttname"><a href="TelegramBot_8h.html">TelegramBot.h</a></div></div> |
|
<div class="ttc" id="http__build__query_8h_html"><div class="ttname"><a href="http__build__query_8h.html">http_build_query.h</a></div></div> |
|
<div class="ttc" id="classTelegram_1_1TelegramBot_html_a99b561e695953e6b69a3ddf6937a4811"><div class="ttname"><a href="classTelegram_1_1TelegramBot.html#a99b561e695953e6b69a3ddf6937a4811">Telegram::TelegramBot::TelegramBot</a></div><div class="ttdeci">TelegramBot()</div><div class="ttdef"><b>Definition:</b> <a href="TelegramBot_8cc_source.html#l00024">TelegramBot.cc:24</a></div></div> |
|
<div class="ttc" id="structTelegram_1_1TCommand_html_a3f2c8ecbfd34be25baa577afee2e6e52"><div class="ttname"><a href="structTelegram_1_1TCommand.html#a3f2c8ecbfd34be25baa577afee2e6e52">Telegram::TCommand::callback</a></div><div class="ttdeci">CommandCallback callback</div><div class="ttdoc">Pointer to the callback function. </div><div class="ttdef"><b>Definition:</b> <a href="TelegramBot_8h_source.html#l00028">TelegramBot.h:28</a></div></div> |
|
<div class="ttc" id="std_8cc_html_a55fa50be9360d756a7cf448d7e9e0cc9"><div class="ttname"><a href="std_8cc.html#a55fa50be9360d756a7cf448d7e9e0cc9">Log</a></div><div class="ttdeci">void Log(std::string msg)</div><div class="ttdef"><b>Definition:</b> <a href="std_8cc_source.html#l00091">std.cc:91</a></div></div> |
|
<div class="ttc" id="std_8h_html"><div class="ttname"><a href="std_8h.html">std.h</a></div></div> |
|
<div class="ttc" id="namespaceTelegram_html_ad82f4bcddd3c7921e8842bb30170a1c2"><div class="ttname"><a href="namespaceTelegram.html#ad82f4bcddd3c7921e8842bb30170a1c2">Telegram::TCommandMap</a></div><div class="ttdeci">std::map< std::string, TCommand > TCommandMap</div><div class="ttdoc">Map that stores the known commands. </div><div class="ttdef"><b>Definition:</b> <a href="TelegramBot_8h_source.html#l00031">TelegramBot.h:31</a></div></div> |
|
<div class="ttc" id="TelegramBot_8cc_html_a47cbcc6d148fe0c8f9fb95966026aa97"><div class="ttname"><a href="TelegramBot_8cc.html#a47cbcc6d148fe0c8f9fb95966026aa97">API_URL</a></div><div class="ttdeci">#define API_URL</div><div class="ttdef"><b>Definition:</b> <a href="TelegramBot_8cc_source.html#l00017">TelegramBot.cc:17</a></div></div> |
|
<div class="ttc" id="classTelegram_1_1TelegramBot_html_a398bd76186e27d514afd835c5437c6ed"><div class="ttname"><a href="classTelegram_1_1TelegramBot.html#a398bd76186e27d514afd835c5437c6ed">Telegram::TelegramBot::addCommand</a></div><div class="ttdeci">void addCommand(TCommand)</div><div class="ttdef"><b>Definition:</b> <a href="TelegramBot_8cc_source.html#l00049">TelegramBot.cc:49</a></div></div> |
|
<div class="ttc" id="classTelegram_1_1TelegramBot_html_a7c54766f656974b35f03ea510d7b6a4f"><div class="ttname"><a href="classTelegram_1_1TelegramBot.html#a7c54766f656974b35f03ea510d7b6a4f">Telegram::TelegramBot::getMessage</a></div><div class="ttdeci">Telegram::Message * getMessage()</div><div class="ttdef"><b>Definition:</b> <a href="TelegramBot_8cc_source.html#l00182">TelegramBot.cc:182</a></div></div> |
|
<div class="ttc" id="MessageEntity_8h_html"><div class="ttname"><a href="MessageEntity_8h.html">MessageEntity.h</a></div></div> |
|
<div class="ttc" id="namespaceTelegram_html_aa7927193a64b09836112d3be24c45d85"><div class="ttname"><a href="namespaceTelegram.html#aa7927193a64b09836112d3be24c45d85">Telegram::TMessageEntities</a></div><div class="ttdeci">std::vector< Telegram::MessageEntity * > TMessageEntities</div><div class="ttdef"><b>Definition:</b> <a href="MessageEntity_8h_source.html#l00023">MessageEntity.h:23</a></div></div> |
|
<div class="ttc" id="json__encode_8h_html"><div class="ttname"><a href="json__encode_8h.html">json_encode.h</a></div></div> |
|
<div class="ttc" id="classTelegram_1_1User_html"><div class="ttname"><a href="classTelegram_1_1User.html">Telegram::User</a></div><div class="ttdef"><b>Definition:</b> <a href="User_8h_source.html#l00009">User.h:9</a></div></div> |
|
<div class="ttc" id="classTelegram_1_1TelegramBot_html_aba249898870b8250da0ac67ba6a55e88"><div class="ttname"><a href="classTelegram_1_1TelegramBot.html#aba249898870b8250da0ac67ba6a55e88">Telegram::TelegramBot::apiRequestJson</a></div><div class="ttdeci">Json::Value apiRequestJson(std::string, std::map< std::string, std::string >)</div><div class="ttdef"><b>Definition:</b> <a href="TelegramBot_8cc_source.html#l00258">TelegramBot.cc:258</a></div></div> |
|
<div class="ttc" id="http__build__query_8cc_html_a1e3cd58bbf46d30f168bbc0ee5cc486b"><div class="ttname"><a href="http__build__query_8cc.html#a1e3cd58bbf46d30f168bbc0ee5cc486b">http_build_query</a></div><div class="ttdeci">std::string http_build_query(std::map< std::string, std::string > data)</div><div class="ttdef"><b>Definition:</b> <a href="http__build__query_8cc_source.html#l00003">http_build_query.cc:3</a></div></div> |
|
<div class="ttc" id="classTelegram_1_1TelegramBot_html_adb9d623814ecbbeeefef4faa073b73c3"><div class="ttname"><a href="classTelegram_1_1TelegramBot.html#adb9d623814ecbbeeefef4faa073b73c3">Telegram::TelegramBot::sendPhoto</a></div><div class="ttdeci">Telegram::Message * sendPhoto(std::string, Json::Int64)</div><div class="ttdef"><b>Definition:</b> <a href="TelegramBot_8cc_source.html#l00149">TelegramBot.cc:149</a></div></div> |
|
<div class="ttc" id="json__encode_8cc_html_ad8ce82c71c39fc700005394fccc714e2"><div class="ttname"><a href="json__encode_8cc.html#ad8ce82c71c39fc700005394fccc714e2">json_encode</a></div><div class="ttdeci">std::string json_encode(std::map< std::string, std::string > parameters)</div><div class="ttdef"><b>Definition:</b> <a href="json__encode_8cc_source.html#l00003">json_encode.cc:3</a></div></div> |
|
<div class="ttc" id="classTelegram_1_1TelegramBot_html_acd21ba91f309c6d5fbcf7dc0063375ae"><div class="ttname"><a href="classTelegram_1_1TelegramBot.html#acd21ba91f309c6d5fbcf7dc0063375ae">Telegram::TelegramBot::sendMessage</a></div><div class="ttdeci">Telegram::Message * sendMessage(std::string, Json::Int64)</div><div class="ttdef"><b>Definition:</b> <a href="TelegramBot_8cc_source.html#l00115">TelegramBot.cc:115</a></div></div> |
|
<div class="ttc" id="classTelegram_1_1TelegramBot_html_a1ca971ccfb242f7b8656eca3ab7666dd"><div class="ttname"><a href="classTelegram_1_1TelegramBot.html#a1ca971ccfb242f7b8656eca3ab7666dd">Telegram::TelegramBot::api_url</a></div><div class="ttdeci">std::string api_url</div><div class="ttdef"><b>Definition:</b> <a href="TelegramBot_8h_source.html#l00055">TelegramBot.h:55</a></div></div> |
|
</div><!-- fragment --></div><!-- contents --> |
|
</div><!-- doc-content --> |
|
<!-- start footer part --> |
|
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! --> |
|
<ul> |
|
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="TelegramBot_8cc.html">TelegramBot.cc</a></li> |
|
<li class="footer">Generated on Wed Jun 7 2017 20:37:38 for LibTgBotPP by |
|
<a href="http://www.doxygen.org/index.html"> |
|
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.6 </li> |
|
</ul> |
|
</div> |
|
</body> |
|
</html>
|
|
|