mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-05 15:55:36 +08:00
refactor CommandHelpGenerator to CommandInfoUtil
This commit is contained in:
@@ -13,6 +13,7 @@ use ZM\Annotation\Http\RequestMapping;
|
||||
use ZM\Annotation\Swoole\OnCloseEvent;
|
||||
use ZM\Annotation\Swoole\OnOpenEvent;
|
||||
use ZM\Annotation\Swoole\OnRequestEvent;
|
||||
use ZM\Annotation\Swoole\OnStart;
|
||||
use ZM\API\CQ;
|
||||
use ZM\API\OneBotV11;
|
||||
use ZM\API\TuringAPI;
|
||||
@@ -24,6 +25,7 @@ use ZM\Event\EventDispatcher;
|
||||
use ZM\Exception\InterruptException;
|
||||
use ZM\Module\QQBot;
|
||||
use ZM\Requests\ZMRequest;
|
||||
use ZM\Utils\CommandInfoUtil;
|
||||
use ZM\Utils\MessageUtil;
|
||||
use ZM\Utils\ZMUtil;
|
||||
|
||||
@@ -232,7 +234,12 @@ class Hello
|
||||
#[CQCommand('帮助')]
|
||||
public function help(): string
|
||||
{
|
||||
$helps = MessageUtil::generateCommandHelp();
|
||||
$util = resolve(CommandInfoUtil::class);
|
||||
$commands = $util->get();
|
||||
$helps = [];
|
||||
foreach ($commands as $command) {
|
||||
$helps[] = $util->getHelp($command['id']);
|
||||
}
|
||||
array_unshift($helps, '帮助:');
|
||||
return implode("\n", $helps);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user