Keep draft in composer when a slash command syntax errors (#8811)

This commit is contained in:
Michael Telatynski 2022-06-10 17:16:31 +01:00 committed by GitHub
parent 4171c008a4
commit 3f99f594de
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 13 deletions

View file

@ -59,7 +59,7 @@ export async function runSlashCommand(
args: string,
roomId: string,
threadId: string | null,
): Promise<IContent | null> {
): Promise<[content: IContent | null, success: boolean]> {
const result = cmd.run(roomId, threadId, args);
let messageContent: IContent | null = null;
let error = result.error;
@ -96,9 +96,10 @@ export async function runSlashCommand(
title: _t(title),
description: errText,
});
return [null, false];
} else {
logger.log("Command success.");
if (messageContent) return messageContent;
return [messageContent, true];
}
}