mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-15 05:41:51 +00:00
fix(censor): don't crash on invalid invites
This commit is contained in:
parent
1f4b89700c
commit
622a8c3316
1 changed files with 1 additions and 7 deletions
|
@ -89,13 +89,7 @@ export class CensorPlugin extends Plugin {
|
||||||
const inviteCodes = getInviteCodesInString(msg.content);
|
const inviteCodes = getInviteCodesInString(msg.content);
|
||||||
|
|
||||||
let invites: Invite[] = await Promise.all(
|
let invites: Invite[] = await Promise.all(
|
||||||
inviteCodes.map(code => {
|
inviteCodes.map(code => this.bot.getInvite(code).catch(() => null))
|
||||||
try {
|
|
||||||
return this.bot.getInvite(code);
|
|
||||||
} catch (e) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
);
|
);
|
||||||
|
|
||||||
invites = invites.filter(v => !!v);
|
invites = invites.filter(v => !!v);
|
||||||
|
|
Loading…
Add table
Reference in a new issue