54fffa369d94594432fa557a6ada1482149b25f1
[pear] / Net / Telegram / SendMessage.php
1 <?php
2
3 require_once 'Call.php';
4 class Net_Telegram_SendMessage extends Net_Telegram_Call {
5     
6     var $chat_id; // the user id... or channel name ?
7     var $text;
8     var $parse_mode; // HTML|Markdown|MarkdownV2
9     var $entities; // array of entitiels
10     var $disable_web_page_preview; ///??
11     var $reply_to_message_id;
12     var $allow_sending_without_reply;  // if you are using reply_to and do not want to validate it...
13     var $reply_markup; // markup keyboards?!?!
14     
15     var $_types = array(
16         
17     );
18     
19      function __construct($tg, $o=false)
20     {
21         
22         
23         parent::__construct($tg, $o);
24         if (!empty($this->text)) {
25             $this->text = str_replace(array(
26                  '\\', '_', '*', '[', ']', '(', ')', '~', '`',  '>',
27                 '<', '&', '#', '+', '-', '=', '|', '{', '}', '.', '!'
28                 ), array(
29                     '\\\\', '\\_', '\\*', '\\[', '\\]', '\\(', '\\)', '\\~', '\\`',  '\\>',
30                     '\\<', '\\&', '\\#', '\\+', '\\-', '\\=', '\\|', '\\{', '\\}', '\\.', '\\!'
31                 ),
32                 $this->text);
33             
34             
35         }
36         
37     }
38     
39     function send()
40     {
41         $res = parent::send();
42        // print_R($res);
43         return $this->_telegram->factory('Message',$res);
44     }
45     
46     
47 }
48
49