mirror of
https://github.com/matrix-org/matrix-hookshot.git
synced 2025-03-10 21:19:13 +00:00
Don't show errors on bridge rooms
This commit is contained in:
parent
3e17ab65f4
commit
2664ae9cfe
@ -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;
|
||||
}
|
@ -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");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user