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 |
}; |
}; |