mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-18 15:00:00 +00:00
censor: if invite filtering is enabled, always remove unknown invites
This commit is contained in:
parent
a75a551ce5
commit
ca6eedb1be
2 changed files with 9 additions and 3 deletions
|
@ -590,7 +590,9 @@ export class AutomodPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
const invites: Array<Invite | null> = await Promise.all(uniqueInviteCodes.map(code => this.resolveInvite(code)));
|
const invites: Array<Invite | null> = await Promise.all(uniqueInviteCodes.map(code => this.resolveInvite(code)));
|
||||||
|
|
||||||
for (const invite of invites) {
|
for (const invite of invites) {
|
||||||
|
// Always match on unknown invites
|
||||||
if (!invite) return true;
|
if (!invite) return true;
|
||||||
|
|
||||||
if (trigger.include_guilds && trigger.include_guilds.includes(invite.guild.id)) {
|
if (trigger.include_guilds && trigger.include_guilds.includes(invite.guild.id)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -167,11 +167,15 @@ export class CensorPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
|
|
||||||
const inviteCodes = getInviteCodesInString(messageContent);
|
const inviteCodes = getInviteCodesInString(messageContent);
|
||||||
|
|
||||||
let invites: Invite[] = await Promise.all(inviteCodes.map(code => this.resolveInvite(code)));
|
const invites: Array<Invite | null> = await Promise.all(inviteCodes.map(code => this.resolveInvite(code)));
|
||||||
|
|
||||||
invites = invites.filter(v => !!v);
|
|
||||||
|
|
||||||
for (const invite of invites) {
|
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) {
|
if (!invite.guild && !allowGroupDMInvites) {
|
||||||
this.censorMessage(savedMessage, `group dm invites are not allowed`);
|
this.censorMessage(savedMessage, `group dm invites are not allowed`);
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Add table
Reference in a new issue