3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-15 05:41:51 +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 a75a551ce5
commit ca6eedb1be
2 changed files with 9 additions and 3 deletions

View file

@ -590,7 +590,9 @@ export class AutomodPlugin extends ZeppelinPlugin<TConfigSchema> {
const invites: Array<Invite | null> = await Promise.all(uniqueInviteCodes.map(code => this.resolveInvite(code)));
for (const invite of invites) {
// Always match on unknown invites
if (!invite) return true;
if (trigger.include_guilds && trigger.include_guilds.includes(invite.guild.id)) {
return true;
}

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;