mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-10 18:40:15 +08:00
Fix HelpCommand
This commit is contained in:
parent
ec747979a6
commit
f7c8534b4e
@ -76,8 +76,13 @@ public object BuiltInCommands {
|
||||
@Handler
|
||||
public suspend fun CommandSender.handle() {
|
||||
sendMessage(
|
||||
allRegisteredCommands.joinToString("\n\n") { "◆ ${it.usage}" }.lines().filterNot(String::isBlank)
|
||||
.joinToString("\n")
|
||||
allRegisteredCommands
|
||||
.joinToString("\n\n") { command ->
|
||||
val lines = command.usage.lines()
|
||||
if (lines.isEmpty()) "/${command.primaryName} ${command.description}"
|
||||
else
|
||||
"◆ " + lines.first() + "\n" + lines.drop(1).joinToString("\n") { " $it" }
|
||||
}.lines().filterNot(String::isBlank).joinToString("\n")
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -153,13 +153,13 @@ internal class CommandReflector(
|
||||
} else {
|
||||
append(CommandManager.commandPrefix)
|
||||
}
|
||||
if (command is CompositeCommand) {
|
||||
//if (command is CompositeCommand) {
|
||||
append(command.primaryName)
|
||||
append(" ")
|
||||
}
|
||||
//}
|
||||
append(subcommand.valueParameters.joinToString(" ") { it.render() })
|
||||
annotationResolver.getDescription(command, subcommand.originFunction)?.let { description ->
|
||||
append(" ")
|
||||
append(" # ")
|
||||
append(description)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user