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