add command help generator

This commit is contained in:
sunxyw
2022-03-21 04:34:08 +08:00
parent c7df37b17c
commit ca3a3df3ba
2 changed files with 85 additions and 1 deletions

View File

@@ -216,4 +216,17 @@ class Hello
Console::info('Unknown connection , I will close it.');
server()->disconnect(ctx()->getConnection()->getFd());
}
/**
* 输出帮助信息
*
* @CQCommand("帮助")
*/
#[CQCommand('帮助')]
public function help(): string
{
$helps = MessageUtil::generateCommandHelp();
array_unshift($helps, '帮助:');
return implode("\n", $helps);
}
}