This commit is contained in:
Denny Dai 2015-06-30 22:44:40 +08:00
parent f94b5403f4
commit 1f1fd24782
3 changed files with 4 additions and 4 deletions

View File

@ -18,8 +18,8 @@ require_once(PATH.'classes'.DIRECTORY_SEPARATOR.TYPE.DIRECTORY_SEPARATOR.'init.p
foreach ($load_plugins as $value) { foreach ($load_plugins as $value) {
$plugin_name = substr($value, strlen(PATH.'plugins'.DIRECTORY_SEPARATOR), -4); $plugin_name = substr($value, strlen(PATH.'plugins'.DIRECTORY_SEPARATOR), -4);
if (preg_match("/^".preg_quote(TAG, '/').$plugin_name." (.*)$/", $text, $matches)) { if (preg_match("/^(".preg_quote(TAG, '/').$plugin_name."|".preg_quote(TAG, '/').$plugin_name.preg_quote('@').BOT_NAME.") (.*)$/", $text, $matches)) {
$plugin_text = $matches[1]; $plugin_text = $matches[2];
$plugin_sendto = $from; $plugin_sendto = $from;
require_once $value; require_once $value;
break; break;

View File

@ -3,7 +3,7 @@ define('TYPE', 'Telegram-Bot');
define('PATH', dirname(__FILE__).DIRECTORY_SEPARATOR); define('PATH', dirname(__FILE__).DIRECTORY_SEPARATOR);
define('TAG', '#'); define('TAG', '#');
define('OWNER_NAME', 'Denny Dai'); define('OWNER_NAME', 'Denny Dai');
define('BOT_NAME', 'Dx. Dennx'); define('BOT_NAME', 'D_bot');
define('HELP_BEGIN', "Welcome to use TG-BOT"); define('HELP_BEGIN', "Welcome to use TG-BOT");
define('HELP_END', "GitHub: https://github.com/dennydai/D-bot\nAuthor: @DennyDai"); define('HELP_END', "GitHub: https://github.com/dennydai/D-bot\nAuthor: @DennyDai");

View File

@ -1,5 +1,5 @@
<?php <?php
if (preg_match("/^".preg_quote(TAG, '/')."help$/", $text)) { if (preg_match("/^(".preg_quote(TAG, '/')."help)|(".preg_quote(TAG, '/').$plugin_name.preg_quote('@').BOT_NAME.")$/", $text)) {
foreach ($load_plugins as $value) { foreach ($load_plugins as $value) {
$plugin_name = substr($value, strlen(PATH.'plugins'.DIRECTORY_SEPARATOR), -4); $plugin_name = substr($value, strlen(PATH.'plugins'.DIRECTORY_SEPARATOR), -4);
$lines=file($value); $lines=file($value);