/[sudobot]/trunk/src/AntiRaid.js
ViewVC logotype

Diff of /trunk/src/AntiRaid.js

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

revision 10 by rakin, Mon Jul 29 17:28:12 2024 UTC revision 39 by rakin, Mon Jul 29 17:28:19 2024 UTC
# Line 7  module.exports = class AntiRaid { Line 7  module.exports = class AntiRaid {
7    
8      load(guild) {      load(guild) {
9          this.maxJoins = app.config.props[guild.id].raid.max_joins;          this.maxJoins = app.config.props[guild.id].raid.max_joins;
10          this.included = app.config.props[guild.id].raid.included;          this.excluded = app.config.props[guild.id].raid.excluded;
11          this.time = app.config.props[guild.id].raid.time;          this.time = app.config.props[guild.id].raid.time;
12            this.enabled = app.config.props[guild.id].raid.enabled;
13      }      }
14    
15      async start(member) {      async start(member) {
16            if (member.user.bot) {
17                console.log('bot');
18                return;
19            }
20    
21          await this.load(member.guild);          await this.load(member.guild);
22    
23            if (!this.enabled)
24                return;
25    
26          console.log('Joined');          console.log('Joined');
27    
28          setTimeout(() => {          setTimeout(() => {
# Line 24  module.exports = class AntiRaid { Line 33  module.exports = class AntiRaid {
33          this.joins++;          this.joins++;
34    
35          if (this.joins >= this.maxJoins) {          if (this.joins >= this.maxJoins) {
36              let role = member.guild.roles.cache.find(r => r.id === app.config.props[member.guild.id].gen_role);              let role = member.guild.roles.everyone;
37              let channels = member.guild.channels.cache.filter(channel => this.included.indexOf(channel.id) !== -1);              let channels = member.guild.channels.cache.filter(channel => this.excluded.indexOf(channel.id) === -1 && this.excluded.indexOf(channel.parent?.id) === -1 && channel.type === 'GUILD_TEXT');
38    
39              await lockAll(role, channels, true);              await lockAll(role, channels, true);
40          }          }

Legend:
Removed from v.10  
changed lines
  Added in v.39

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26