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

censor: if invite filtering is enabled, always remove unknown invites

This commit is contained in:
Dragory 2019-10-13 22:05:26 +03:00
parent 4561ae7119
commit a89d88e688
2 changed files with 9 additions and 3 deletions

View file

@ -167,11 +167,15 @@ export class CensorPlugin extends ZeppelinPlugin<TConfigSchema> {
const inviteCodes = getInviteCodesInString(messageContent);
let invites: Invite[] = await Promise.all(inviteCodes.map(code => this.resolveInvite(code)));
invites = invites.filter(v => !!v);
const invites: Array<Invite | null> = await Promise.all(inviteCodes.map(code => this.resolveInvite(code)));
for (const invite of invites) {
// Always filter unknown invites if invite filtering is enabled
if (invite == null) {
this.censorMessage(savedMessage, `unknown invite not found in whitelist`);
return true;
}
if (!invite.guild && !allowGroupDMInvites) {
this.censorMessage(savedMessage, `group dm invites are not allowed`);
return true;