diff --git a/BOT.php b/BOT.php index c07a0a7..ead8735 100644 --- a/BOT.php +++ b/BOT.php @@ -2,36 +2,36 @@ //init require_once('config.php'); require_once('functions.php'); -$plugins = []; +$plugins = array(); 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 ($TAGs as $TAG) { - foreach ($load_plugins as $value) { - $plugin_name = substr($value, strlen(PATH.'plugins'.DIRECTORY_SEPARATOR), -4); - if (preg_match("/^(".preg_quote($TAG, '/').$plugin_name."|".preg_quote($TAG, '/').$plugin_name.preg_quote('@').BOT_NAME.") (.*)$/", $text, $matches)) { - $plugin_text = $matches[2]; - $plugin_sendto = $from; - require_once $value; - break; - }elseif (preg_match("/^(".preg_quote($TAG, '/').$plugin_name.")|(".preg_quote($TAG, '/').$plugin_name.preg_quote('@').BOT_NAME.")$/", $text)) { - $plugin_text = $matches[2]; - $plugin_sendto = $from; - require_once $value; - break; - } - } - } - require_once PATH.'plugins'.DIRECTORY_SEPARATOR.'help.php'; + $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 ($TAGs as $TAG) { + foreach ($load_plugins as $value) { + $plugin_name = substr($value, strlen(PATH.'plugins'.DIRECTORY_SEPARATOR), -4); + if (preg_match("/^(".preg_quote($TAG, '/').$plugin_name."|".preg_quote($TAG, '/').$plugin_name.preg_quote('@').BOT_NAME.") (.*)$/", $text, $matches)) { + $plugin_text = $matches[2]; + $plugin_sendto = $from; + require_once $value; + break; + }elseif (preg_match("/^(".preg_quote($TAG, '/').$plugin_name.")|(".preg_quote($TAG, '/').$plugin_name.preg_quote('@').BOT_NAME.")$/", $text)) { + $plugin_text = $matches[2]; + $plugin_sendto = $from; + require_once $value; + break; + } + } + } + require_once PATH.'plugins'.DIRECTORY_SEPARATOR.'help.php'; diff --git a/classes/Wechat/Base.php b/classes/Wechat/Base.php new file mode 100644 index 0000000..0fcbd5b --- /dev/null +++ b/classes/Wechat/Base.php @@ -0,0 +1,20 @@ +exec(" + + +".time()." + + +".rand(1,9999999999999)." +"); + } +} \ No newline at end of file diff --git a/classes/Wechat/init.php b/classes/Wechat/init.php new file mode 100644 index 0000000..3ddb5be --- /dev/null +++ b/classes/Wechat/init.php @@ -0,0 +1,14 @@ +<\/ToUserName>/', $raw, $FromUserName); +$FromUserName = $FromUserName[1]; +preg_match('/<\/FromUserName>/', $raw, $ToUserName); +$ToUserName = $ToUserName[1]; +preg_match('/<\/Content>/', $raw, $Content); +$Content = $Content[1]; + + $from = $ToUserName; + $text = $Content; \ No newline at end of file diff --git a/config.php b/config.php index bf33f7e..f848f46 100644 --- a/config.php +++ b/config.php @@ -13,4 +13,7 @@ define('TB_TOKEN', 'YOU_TELEGRAM_BOT_TOKEN_HERE'); define('TB_API_URL', 'https://api.telegram.org/bot'.TB_TOKEN.'/'); //For plugins -define('PLUGIN_GITHUB_TOKEN', 'YOU_GITHUB_TOKEN_HERE'); \ No newline at end of file +define('PLUGIN_GITHUB_TOKEN', 'YOU_GITHUB_TOKEN_HERE'); + +//For Wechat +define('WC_UserName', 'YOU_WECHAT_USERNAME_HERE');