2015-05-29 11:20:55 -05:00
|
|
|
<?php
|
|
|
|
//init
|
2015-12-30 07:37:25 -06:00
|
|
|
$Pre_Type = substr(substr($_SERVER['PHP_SELF'], strrpos($_SERVER['PHP_SELF'], '/')+1), 0, -4);
|
2015-06-26 00:37:54 -05:00
|
|
|
require_once('config.php');
|
|
|
|
|
|
|
|
require(PATH.'classes'.DIRECTORY_SEPARATOR.TYPE.DIRECTORY_SEPARATOR.'Base.php');
|
|
|
|
require_once(PATH.'classes'.DIRECTORY_SEPARATOR.TYPE.DIRECTORY_SEPARATOR.'init.php');
|
|
|
|
|
|
|
|
//load plugins
|
2016-01-01 08:56:39 -06:00
|
|
|
$load_plugins = glob(PATH.'plugins'.DIRECTORY_SEPARATOR.'*.php');
|
2016-06-16 04:20:20 -05:00
|
|
|
|
|
|
|
foreach ($TAGs as $TAG) {
|
|
|
|
foreach ($load_plugins as $value) {
|
|
|
|
$plugin_name = substr($value, strlen(PATH.'plugins'.DIRECTORY_SEPARATOR), -4);
|
|
|
|
eval(file($value)[1]);
|
2016-03-09 02:54:41 -06:00
|
|
|
$plugin_sendto = $from;
|
2016-06-16 04:20:20 -05:00
|
|
|
if (preg_match("/^(".preg_quote($TAG, '/').$plugin_name."|".preg_quote($TAG, '/').$plugin_name.preg_quote('@').BOT_NAME.") (.*)$/", $text, $matches)) {
|
|
|
|
$plugin_text = $matches[2];
|
|
|
|
require_once $value;
|
|
|
|
break;
|
|
|
|
}elseif (($TAG.$plugin_name == $text or $TAG.$plugin_name.'@'.BOT_NAME == $text) and ($plugins[$plugin_name]["needArgu"] == false)) {
|
|
|
|
require_once $value;
|
|
|
|
break;
|
|
|
|
}elseif ($TAG.$plugin_name == $text or $TAG.$plugin_name.'@'.BOT_NAME == $text) {
|
|
|
|
if ($plugins[$plugin_name]["usage"]!=null) {
|
|
|
|
$BOT->msg($plugin_sendto, "Usage:\n".$plugins[$plugin_name]["usage"]);
|
|
|
|
}else{
|
|
|
|
$BOT->msg($plugin_sendto, "Missing argument(s)");
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2015-10-31 07:33:17 -05:00
|
|
|
}
|
2016-01-01 08:56:39 -06:00
|
|
|
}
|
2015-06-30 02:05:22 -05:00
|
|
|
|
2016-01-01 08:56:39 -06:00
|
|
|
//function
|
2016-06-16 04:20:20 -05:00
|
|
|
function PluginSet($desc,$usage=null,$needArgu=True,$visible=True){
|
2016-01-01 08:56:39 -06:00
|
|
|
global $plugins,$plugin_name,$TAG;
|
2016-06-16 04:20:20 -05:00
|
|
|
$plugins[$plugin_name]["desc"] = '/'.$plugin_name." ".$desc;
|
|
|
|
$plugins[$plugin_name]["usage"] = $usage;
|
|
|
|
$plugins[$plugin_name]["needArgu"] = $needArgu;
|
|
|
|
$plugins[$plugin_name]["visible"] = $visible;
|
2016-01-01 08:56:39 -06:00
|
|
|
}
|
2015-06-30 02:05:22 -05:00
|
|
|
|
2015-05-29 11:20:55 -05:00
|
|
|
?>
|