Don't show errors on bridge rooms

This commit is contained in:
Half-Shot 2020-07-20 13:12:24 +01:00
parent 3e17ab65f4
commit 2664ae9cfe
2 changed files with 3 additions and 3 deletions

View File

@ -51,7 +51,7 @@ export function compileBotCommands(prototype: any): {helpMessage: any, botComman
}
}
export function handleCommand(userId: string, command: string, botCommands: BotCommands, obj: any): string|null {
export function handleCommand(userId: string, command: string, botCommands: BotCommands, obj: any, errorOnUnknown=true): string|null {
const cmdLower = command.toLowerCase();
const parts = argvSplit(cmdLower);
for (let i = parts.length; i > 0; i--) {
@ -70,5 +70,5 @@ export function handleCommand(userId: string, command: string, botCommands: BotC
return null;
}
}
return "Command not understood";
return errorOnUnknown ? "Command not understood" : null;
}

View File

@ -159,7 +159,7 @@ export class GitHubRepoConnection implements IConnection {
}
public async onMessageEvent(ev: MatrixEvent<MatrixMessageContent>) {
const err = handleCommand(ev.sender, ev.content.body, GitHubRepoConnection.botCommands, this);
const err = handleCommand(ev.sender, ev.content.body, GitHubRepoConnection.botCommands, this, false);
if (err) {
await this.as.botIntent.sendText(this.roomId, err, "m.notice");
}