mirror of
https://github.com/the-draupnir-project/Draupnir.git
synced 2026-08-28 13:24:04 +00:00
Fix interface-manager badArgument hint.
This was printing arguments as their JSON serialized representation rather than their text presentation. It also couldn't handle missing arguments. We also verified that writing the protection name wrong for the commands will give you a message saying that the protection doesn't exist, rather than showing the help command.
This commit is contained in:
@@ -163,14 +163,12 @@ function formattedArgumentHint(error: ArgumentParseError): string {
|
||||
error.partialCommand.stream.getPosition()
|
||||
);
|
||||
let commandContext = "Command context:";
|
||||
for (const designator of error.partialCommand.designator) {
|
||||
commandContext += ` ${designator}`;
|
||||
}
|
||||
for (const argument of argumentsUpToError) {
|
||||
commandContext += ` ${JSON.stringify(argument)}`;
|
||||
commandContext += ` ${TextPresentationRenderer.render(argument)}`;
|
||||
}
|
||||
const badArgument = ` ${TextPresentationRenderer.render(error.partialCommand.stream.peekItem())}\n${Array(commandContext.length + 1).join(" ")} ^ expected ${printPresentationSchema(error.parameter.acceptor)} here`;
|
||||
return commandContext + badArgument;
|
||||
const badArgument = error.partialCommand.stream.peekItem();
|
||||
const badArgumentHint = ` ${badArgument === undefined ? "undefined" : TextPresentationRenderer.render(badArgument)}\n${Array(commandContext.length + 1).join(" ")} ^ expected ${printPresentationSchema(error.parameter.acceptor)} here`;
|
||||
return commandContext + badArgumentHint;
|
||||
}
|
||||
|
||||
export async function reactToEventWithResult(
|
||||
|
||||
Reference in New Issue
Block a user