Big Change about Plugins

This commit is contained in:
Denny Dai
2015-06-30 15:05:22 +08:00
parent 3cc20a8a89
commit f94b5403f4
8 changed files with 38 additions and 32 deletions
+3 -6
View File
@@ -1,7 +1,6 @@
<?php
PluginList("trans", "translate");
if (preg_match("/^".preg_quote(TAG, '/')."trans (.*)$/", $text, $matches)) {
$matches = explode(" ", $matches[1], 2);
PluginSet("translate");
$matches = explode(" ", $plugin_text, 2);
if (!isset($matches[1])) {
$to = "en";
$text = urlencode($matches[0]);
@@ -15,6 +14,4 @@ if (preg_match("/^".preg_quote(TAG, '/')."trans (.*)$/", $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->msg($from, $msg);
}
$BOT->msg($from, $msg);