This commit is contained in:
Denny Dai 2015-06-30 14:11:15 +08:00
parent e321324785
commit 3cc20a8a89
6 changed files with 6 additions and 6 deletions

View File

@ -20,7 +20,7 @@ class Base
} }
public function msg($id, $msg) public function msg($id, $msg)
{ {
return $this->exec('sendMessage', array('chat_id' => $id, 'text' => $msg)); return $this->exec('sendMessage', array('chat_id' => $id, 'text' => $msg, 'disable_web_page_preview' => 1));
} }
} }

View File

@ -1,5 +1,5 @@
<?php <?php
PluginList("echo", "Echo what you typed."); PluginList("echo", "Echo what you typed.");
if (preg_match("/^".TAG."echo (.*)$/", $text, $matches)) { if (preg_match("/^".preg_quote(TAG, '/')."echo (.*)$/", $text, $matches)) {
$BOT->msg($from, $matches[1]); $BOT->msg($from, $matches[1]);
} }

View File

@ -1,6 +1,6 @@
<?php <?php
PluginList("help", "Ask for help"); PluginList("help", "Ask for help");
if (preg_match("/^".TAG."help$/", $text)) { if (preg_match("/^".preg_quote(TAG, '/')."help$/", $text)) {
$plugin_list = HELP_BEGIN."\n"; $plugin_list = HELP_BEGIN."\n";
foreach ($plugins as $value) { foreach ($plugins as $value) {
$plugin_list .= "\n".$value; $plugin_list .= "\n".$value;

View File

@ -1,6 +1,6 @@
<?php <?php
PluginList("ipto", "Change the form of IP address"); PluginList("ipto", "Change the form of IP address");
if (preg_match("/^".TAG."ipto (.*)$/", $text, $matches)) { if (preg_match("/^".preg_quote(TAG, '/')."ipto (.*)$/", $text, $matches)) {
$arr = explode('.',$matches[1]); $arr = explode('.',$matches[1]);
$msg = 'IP: '.$arr[0].'.'.$arr[1].'.'.$arr[2].'.'.$arr[3]; $msg = 'IP: '.$arr[0].'.'.$arr[1].'.'.$arr[2].'.'.$arr[3];
$msg .= "\nint: ".($arr[0] * pow(256,3) + $arr[1] * pow(256,2) + $arr[2] * 256 + $arr[3]); $msg .= "\nint: ".($arr[0] * pow(256,3) + $arr[1] * pow(256,2) + $arr[2] * 256 + $arr[3]);

View File

@ -1,6 +1,6 @@
<?php <?php
PluginList("trans", "translate"); PluginList("trans", "translate");
if (preg_match("/^".TAG."trans (.*)$/", $text, $matches)) { if (preg_match("/^".preg_quote(TAG, '/')."trans (.*)$/", $text, $matches)) {
$matches = explode(" ", $matches[1], 2); $matches = explode(" ", $matches[1], 2);
if (!isset($matches[1])) { if (!isset($matches[1])) {
$to = "en"; $to = "en";

View File

@ -1,6 +1,6 @@
<?php <?php
PluginList("tts", "Text To Speech"); PluginList("tts", "Text To Speech");
if (preg_match("/^".TAG."tts (.*)$/", $text, $matches)) { if (preg_match("/^".preg_quote(TAG, '/')."tts (.*)$/", $text, $matches)) {
$mp3 = file_get_contents("http://tts.baidu.com/text2audio?lan=zh&ie=UTF-8&text=".urlencode($matches[1])); $mp3 = file_get_contents("http://tts.baidu.com/text2audio?lan=zh&ie=UTF-8&text=".urlencode($matches[1]));
$file = fopen($from.".mp3","w"); $file = fopen($from.".mp3","w");
echo fwrite($file,$mp3); echo fwrite($file,$mp3);