Skip to content

Commit

Permalink
Update plugins.php
Browse files Browse the repository at this point in the history
  • Loading branch information
nkxingxh committed Mar 3, 2023
1 parent f4a90ec commit 1aab70b
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions plugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,17 @@ public function __construct()
//初始化插件
public function _init()
{
hookRegister('miraiezHook', 'FriendMessage');
return true;
}
}

function miraiezHook(): void
function MiraiEzHook($_DATA): void
{
global $_PlainText;
if ($_PlainText == '/miraiez') {
replyMessage("欢迎使用 MiraiEz! 当前版本: " . pluginParent::_pluginVersion);
if ($_PlainText == '/MiraiEz') {
replyMessage($_DATA['sender']['id'] == MIRAIEZ_ADMIN_QQ
? ('Hello, MiraiEz! 当前版本: ' . pluginParent::_pluginVersion)
: 'Powered By MiraiEz!');
}
}

Expand Down Expand Up @@ -67,6 +68,7 @@ function loadPlugins(string $dir = 'plugins')

//if (defined('mdm_cli')) echo "开始遍历插件目录...\n";
//遍历所有插件文件
global $__pluginFile__;
foreach ($_plugins_files as $__pluginFile__) {
//if (defined('mdm_cli')) echo "检查 $__pluginFile__ ";
//判断是否为 .php 文件
Expand All @@ -76,7 +78,7 @@ function loadPlugins(string $dir = 'plugins')
}
if (is_file("$pluginsDir/$__pluginFile__")) {
//if (defined('mdm_cli')) echo "是插件文件\n";
$GLOBALS['__pluginFile__'] = $__pluginFile__; //设置当前插件文件名
//$GLOBALS['__pluginFile__'] = $__pluginFile__; //设置当前插件文件名
$GLOBALS['__pluginPackage__'] = pluginParent::_pluginPackage; //当前插件包名先设置为父插件 (用于兼容 v1 的直接函数挂钩插件)
include_once "$pluginsDir/$__pluginFile__"; //加载插件文件
} else {
Expand All @@ -85,6 +87,7 @@ function loadPlugins(string $dir = 'plugins')
}
unset($GLOBALS['__pluginFile__'], $GLOBALS['__pluginPackage__'], $_plugins_files);
//if (defined('mdm_cli')) echo "加载结束\n";
hookRegister('MiraiEzHook', 'FriendMessage');
}

/**
Expand Down

0 comments on commit 1aab70b

Please sign in to comment.