too tired to desc

too tired to desc
This commit is contained in:
Denny Dai
2015-06-26 13:19:40 +08:00
parent 72a36e5164
commit 88c6a081dd
6 changed files with 11 additions and 16 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
<?php
PluginList("echo", "Echo what you typed.");
if (preg_match("/^".TAG."echo (.*)$/", $_GET['text'], $matches)) {
$BOT->exec("msg ".$from." ".$matches[1]);
$BOT->exec("msg ".$from." ".escapeString($matches[1]));
}
+3 -3
View File
@@ -12,9 +12,9 @@ if (preg_match("/^".TAG."trans (.*)$/", $_GET['text'], $matches)) {
$to = $matches[0];
$text = urlencode($matches[1]);
}
$trans = file_get_contents('http://api.microsofttranslator.com/v2/ajax.svc/TranslateArray2?appId=%22TKT68kjRgkUbVtIKst6Vo0Hxnb6g2f0K3tUMyn1gZ7nc*%22&to="'.$to.'"&options={}&texts=["'.$text.'"]');
preg_match('/"TranslatedText":"([^"]+)/i', $trans, $trans_result);
$msg = "Result: ".$trans_result[1];
$trans = file_get_contents('http://api.microsofttranslator.com/v2/ajax.svc/TranslateArray2?appId=%22TWQET6TO9c7Iw1yXOahFm8zfEzty5DUHuaTHkl5SCrHUPgu3ABP7aflbz8teet6IS%22&to="'.$to.'"&options={}&texts=["'.$text.'"]');
preg_match("/\[{.*?\}]/is", $trans, $trans_json);
$msg = "Result: ".json_decode($trans_json[0],true)[0]["TranslatedText"];
$BOT->exec("msg ".$from." ".escapeString($msg));
}