/[sudobot]/trunk/src/automod/AntiRaid.ts
ViewVC logotype

Diff of /trunk/src/automod/AntiRaid.ts

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 51 by rakin, Mon Jul 29 17:28:23 2024 UTC revision 147 by rakin, Mon Jul 29 17:28:46 2024 UTC
# Line 36  export default class AntiRaid { Line 36  export default class AntiRaid {
36          this.joins++;          this.joins++;
37    
38          if (this.joins >= this.maxJoins) {          if (this.joins >= this.maxJoins) {
39              let role = member.guild.roles.everyone;              await this.trigger(member.guild);
40            }
41        }
42    
43        async trigger(guild: Guild) {
44            let role = guild.roles.everyone;
45                            
46              let channels = <Collection <string, TextChannel>> member.guild.channels.cache.filter(channel => {          let channels = <Collection <string, TextChannel>> guild.channels.cache.filter(channel => {
47                  let cond: boolean;              let cond: boolean;
48    
49                  if (this.exclude) {              if (this.exclude) {
50                      cond = this.channels.indexOf(channel.id) === -1 && this.channels.indexOf(channel.parent?.id!) === -1;                  cond = this.channels.indexOf(channel.id) === -1 && this.channels.indexOf(channel.parent?.id!) === -1;
51                  }              }
52                  else {              else {
53                      cond = this.channels.indexOf(channel.id) !== -1 || this.channels.indexOf(channel.parent?.id!) !== -1;                  cond = this.channels.indexOf(channel.id) !== -1 || this.channels.indexOf(channel.parent?.id!) !== -1;
54                  }              }
55    
56                  return cond && channel.type === 'GUILD_TEXT';              return cond && channel.type === 'GUILD_TEXT';
57              });          });
58    
59              await lockAll(this.client, role, channels, true);          await lockAll(this.client, role, channels, true);
         }  
60      }      }
61  };  };

Legend:
Removed from v.51  
changed lines
  Added in v.147

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26