subcommand and /abort fixes

- use AbortController in /abort instead of execption
- allow quiet abort
- allow loud abort
- allow abort reason
- abort when aborted in subcommand
- break out of loops when aborted inside
- fix parsing of subcommands with multiple commands
This commit is contained in:
LenAnderson
2024-05-18 14:48:31 -04:00
parent 909ec4191d
commit 87cc28ae28
5 changed files with 100 additions and 25 deletions

View File

@ -161,6 +161,7 @@ export class SlashCommandClosure {
let args = {
_scope: this.scope,
_parserFlags: executor.parserFlags,
_abortController: this.abortController,
};
let value;
// substitute named arguments
@ -254,6 +255,7 @@ export class SlashCommandClosure {
if (this.abortController?.signal?.aborted) {
const result = new SlashCommandClosureResult();
result.isAborted = true;
result.isQuietlyAborted = this.abortController.signal.isQuiet;
result.abortReason = this.abortController.signal.reason.toString();
return result;
}