Muti-TAGs
This commit is contained in:
parent
1f1fd24782
commit
9a0ffb2fc0
17
BOT.php
17
BOT.php
@ -16,16 +16,17 @@ require_once(PATH.'classes'.DIRECTORY_SEPARATOR.TYPE.DIRECTORY_SEPARATOR.'init.p
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($load_plugins as $value) {
|
foreach ($TAGs as $TAG) {
|
||||||
$plugin_name = substr($value, strlen(PATH.'plugins'.DIRECTORY_SEPARATOR), -4);
|
foreach ($load_plugins as $value) {
|
||||||
if (preg_match("/^(".preg_quote(TAG, '/').$plugin_name."|".preg_quote(TAG, '/').$plugin_name.preg_quote('@').BOT_NAME.") (.*)$/", $text, $matches)) {
|
$plugin_name = substr($value, strlen(PATH.'plugins'.DIRECTORY_SEPARATOR), -4);
|
||||||
$plugin_text = $matches[2];
|
if (preg_match("/^(".preg_quote($TAG, '/').$plugin_name."|".preg_quote($TAG, '/').$plugin_name.preg_quote('@').BOT_NAME.") (.*)$/", $text, $matches)) {
|
||||||
$plugin_sendto = $from;
|
$plugin_text = $matches[2];
|
||||||
require_once $value;
|
$plugin_sendto = $from;
|
||||||
break;
|
require_once $value;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once PATH.'plugins'.DIRECTORY_SEPARATOR.'help.php';
|
require_once PATH.'plugins'.DIRECTORY_SEPARATOR.'help.php';
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
define('TYPE', 'Telegram-Bot');
|
define('TYPE', 'Telegram-Bot');
|
||||||
define('PATH', dirname(__FILE__).DIRECTORY_SEPARATOR);
|
define('PATH', dirname(__FILE__).DIRECTORY_SEPARATOR);
|
||||||
define('TAG', '#');
|
|
||||||
define('OWNER_NAME', 'Denny Dai');
|
define('OWNER_NAME', 'Denny Dai');
|
||||||
define('BOT_NAME', 'D_bot');
|
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");
|
||||||
|
$TAGs = array('#','/','!');
|
||||||
|
|
||||||
|
|
||||||
//For Telegram-Bot
|
//For Telegram-Bot
|
||||||
|
@ -8,6 +8,6 @@ function escapePeer($peer){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function PluginSet($desc){
|
function PluginSet($desc){
|
||||||
global $plugins,$plugin_name;
|
global $plugins,$plugin_name,$TAG;
|
||||||
$plugins[] .= TAG.$plugin_name." ".$desc;
|
$plugins[] .= $TAG.$plugin_name." ".$desc;
|
||||||
}
|
}
|
@ -1,14 +1,16 @@
|
|||||||
<?php
|
<?php
|
||||||
if (preg_match("/^(".preg_quote(TAG, '/')."help)|(".preg_quote(TAG, '/').$plugin_name.preg_quote('@').BOT_NAME.")$/", $text)) {
|
foreach ($TAGs as $TAG) {
|
||||||
foreach ($load_plugins as $value) {
|
if (preg_match("/^(".preg_quote($TAG, '/')."help)|(".preg_quote($TAG, '/').$plugin_name.preg_quote('@').BOT_NAME.")$/", $text)) {
|
||||||
$plugin_name = substr($value, strlen(PATH.'plugins'.DIRECTORY_SEPARATOR), -4);
|
foreach ($load_plugins as $value) {
|
||||||
$lines=file($value);
|
$plugin_name = substr($value, strlen(PATH.'plugins'.DIRECTORY_SEPARATOR), -4);
|
||||||
eval($lines[1]);
|
$lines=file($value);
|
||||||
|
eval($lines[1]);
|
||||||
|
}
|
||||||
|
$plugin_list = HELP_BEGIN."\n";
|
||||||
|
foreach ($plugins as $value) {
|
||||||
|
$plugin_list .= "\n".$value;
|
||||||
|
}
|
||||||
|
$plugin_list .= "\n\n".HELP_END;
|
||||||
|
$BOT->msg($from, $plugin_list);
|
||||||
}
|
}
|
||||||
$plugin_list = HELP_BEGIN."\n";
|
|
||||||
foreach ($plugins as $value) {
|
|
||||||
$plugin_list .= "\n".$value;
|
|
||||||
}
|
|
||||||
$plugin_list .= "\n\n".HELP_END;
|
|
||||||
$BOT->msg($from, $plugin_list);
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user