3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-07-07 19:17:19 +00:00

Cache invites when resolving them

This commit is contained in:
Dragory 2019-10-13 00:21:35 +03:00
parent 6ff8c8d290
commit e3d734801d
3 changed files with 20 additions and 16 deletions

View file

@ -167,7 +167,7 @@ export class CensorPlugin extends ZeppelinPlugin<TConfigSchema> {
const inviteCodes = getInviteCodesInString(messageContent);
let invites: Invite[] = await Promise.all(inviteCodes.map(code => this.bot.getInvite(code).catch(() => null)));
let invites: Invite[] = await Promise.all(inviteCodes.map(code => this.resolveInvite(code)));
invites = invites.filter(v => !!v);