quote text
authorAlan <alan@roojs.com>
Wed, 28 Jun 2023 09:03:57 +0000 (17:03 +0800)
committerAlan <alan@roojs.com>
Wed, 28 Jun 2023 09:03:57 +0000 (17:03 +0800)
Net/Telegram/SendMessage.php

index 8492d8f..54fffa3 100644 (file)
@@ -16,9 +16,29 @@ class Net_Telegram_SendMessage extends Net_Telegram_Call {
         
     );
     
+     function __construct($tg, $o=false)
+    {
+        
+        
+        parent::__construct($tg, $o);
+        if (!empty($this->text)) {
+            $this->text = str_replace(array(
+                 '\\', '_', '*', '[', ']', '(', ')', '~', '`',  '>',
+                '<', '&', '#', '+', '-', '=', '|', '{', '}', '.', '!'
+                ), array(
+                    '\\\\', '\\_', '\\*', '\\[', '\\]', '\\(', '\\)', '\\~', '\\`',  '\\>',
+                    '\\<', '\\&', '\\#', '\\+', '\\-', '\\=', '\\|', '\\{', '\\}', '\\.', '\\!'
+                ),
+                $this->text);
+            
+            
+        }
+        
+    }
+    
     function send()
     {
-          $res = parent::send();
+        $res = parent::send();
        // print_R($res);
         return $this->_telegram->factory('Message',$res);
     }