-
Notifications
You must be signed in to change notification settings - Fork 8
/
VAR_BOT.php
44 lines (39 loc) · 1.74 KB
/
VAR_BOT.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
//init
$Pre_Type = substr(substr($_SERVER['PHP_SELF'], strrpos($_SERVER['PHP_SELF'], '/')+1), 0, -4);
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
$load_plugins = glob(PATH.'plugins'.DIRECTORY_SEPARATOR.'*.php');
foreach ($TAGs as $TAG) {
foreach ($load_plugins as $value) {
$plugin_name = substr($value, strlen(PATH.'plugins'.DIRECTORY_SEPARATOR), -4);
eval(file($value)[1]);
$plugin_sendto = $from;
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;
}
}
}
//function
function PluginSet($desc,$usage=null,$needArgu=True,$visible=True){
global $plugins,$plugin_name,$TAG;
$plugins[$plugin_name]["desc"] = '/'.$plugin_name." ".$desc;
$plugins[$plugin_name]["usage"] = $usage;
$plugins[$plugin_name]["needArgu"] = $needArgu;
$plugins[$plugin_name]["visible"] = $visible;
}
?>