diff --git a/BOT.php b/BOT.php index ea7a603..0298f16 100644 --- a/BOT.php +++ b/BOT.php @@ -8,15 +8,26 @@ require(PATH.'classes'.DIRECTORY_SEPARATOR.TYPE.DIRECTORY_SEPARATOR.'Base.php'); require_once(PATH.'classes'.DIRECTORY_SEPARATOR.TYPE.DIRECTORY_SEPARATOR.'init.php'); //load plugins + $load_plugins = glob(PATH.'plugins'.DIRECTORY_SEPARATOR.'*.php'); foreach ($load_plugins as $key => $value) { if ($value == PATH.'plugins'.DIRECTORY_SEPARATOR.'help.php') { unset($load_plugins[$key]); } } + foreach ($load_plugins as $value) { - require_once $value; + $plugin_name = substr($value, strlen(PATH.'plugins'.DIRECTORY_SEPARATOR), -4); + if (preg_match("/^".preg_quote(TAG, '/').$plugin_name." (.*)$/", $text, $matches)) { + $plugin_text = $matches[1]; + $plugin_sendto = $from; + require_once $value; + break; + } } + require_once PATH.'plugins'.DIRECTORY_SEPARATOR.'help.php'; + + ?> \ No newline at end of file diff --git a/config.php b/config.php index ea37cbc..3d5de22 100644 --- a/config.php +++ b/config.php @@ -1,5 +1,5 @@ msg($from, $matches[1]); -} \ No newline at end of file +PluginSet("Echo what you typed."); +$BOT->msg($plugin_sendto, $plugin_text); \ No newline at end of file diff --git a/plugins/help.php b/plugins/help.php index ed41660..bd516da 100644 --- a/plugins/help.php +++ b/plugins/help.php @@ -1,6 +1,10 @@ msg($from, $msg); -} \ No newline at end of file +PluginSet("Change the form of IP address"); +$arr = explode('.',$plugin_text); +$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 .= "\noct: 0".decoct($arr[0]).".0".decoct($arr[1]).".0".decoct($arr[2]).'.0'.decoct($arr[3]); +$msg .= "\nhex: 0x".dechex($arr[0]).".0x".dechex($arr[1]).".0x".dechex($arr[2]).'.0x'.dechex($arr[3]); +$msg .= "\nfucking hex: 0x0000000000".dechex($arr[0]).".0x0000000000".dechex($arr[1]).".0x0000000000".dechex($arr[2]).'.0x0000000000'.dechex($arr[3]); +$msg .= "\nYou can combine them with any combination. Such as: 0".decoct($arr[0]).'.0x0000000000'.dechex($arr[1]).'.'.$arr[2].'.0x'.dechex($arr[3]); +$BOT->msg($plugin_sendto, $msg); \ No newline at end of file diff --git a/plugins/trans.php b/plugins/trans.php index c53c318..7a638d5 100644 --- a/plugins/trans.php +++ b/plugins/trans.php @@ -1,7 +1,6 @@ msg($from, $msg); - -} \ No newline at end of file + $BOT->msg($from, $msg); \ No newline at end of file diff --git a/plugins/tts.php b/plugins/tts.php index b232e1f..910dbaa 100644 --- a/plugins/tts.php +++ b/plugins/tts.php @@ -1,10 +1,8 @@ send_audio($from, "/home/wwwroot/1.vps.dennx.com/".$from.".mp3"); - //unlink($matches[1].".mp3"); -} \ No newline at end of file + //unlink($matches[1].".mp3"); \ No newline at end of file