usage: msg($peer, $text)

This commit is contained in:
Denny Dai
2015-06-26 13:59:37 +08:00
parent fce895bb21
commit c3ada33e3b
6 changed files with 20 additions and 5 deletions
+1 -1
View File
@@ -15,6 +15,6 @@ if (preg_match("/^".TAG."trans (.*)$/", $_GET['text'], $matches)) {
$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));
$BOT->msg($from, $msg);
}