/[sudobot]/trunk/commands/unlockall.js
ViewVC logotype

Annotation of /trunk/commands/unlockall.js

Parent Directory Parent Directory | Revision Log Revision Log


Revision 21 - (hide annotations)
Mon Jul 29 17:28:15 2024 UTC (8 months, 1 week ago) by rakin
File MIME type: text/javascript
File size: 1720 byte(s)
Updated spam and anti raid systems
1 rakin 10 const { Permissions } = require("discord.js");
2     const MessageEmbed = require("../src/MessageEmbed");
3    
4     module.exports = {
5     needsOptionParse: true,
6     async handle(msg, cm) {
7 rakin 21 let channels = cm.options.indexOf('--raid') !== -1 ? app.config.get('raid').excluded : app.config.get('lockall');
8 rakin 10
9     if (msg.mentions.channels.first()) {
10     channels = msg.mentions.channels;
11     }
12     else {
13 rakin 21 channels = await msg.guild.channels.cache.filter(c => ((cm.options.indexOf('--raid') !== -1 && channels.indexOf(c.id) === -1 && channels.indexOf(c.parent?.id) === -1 && c.type === 'GUILD_TEXT') || (cm.options.indexOf('--raid') === -1 && channels.indexOf(c.id) !== -1)));
14 rakin 10 }
15    
16     await this.unlockAll(msg, cm, channels);
17     },
18     async unlockAll(msg, cm, channels) {
19     let role = cm.options.indexOf('--everyone') === -1 ? msg.guild.roles.cache.find(r => r.id === app.config.get('gen_role')) : msg.guild.roles.everyone;
20    
21     if (role) {
22     channels.forEach(async channel => {
23 rakin 21 try {
24     if (cm.options.indexOf('--no-send') === -1) {
25     channel.send({
26     embeds: [
27     new MessageEmbed()
28     .setDescription(':closed_lock_with_key: This channel has been unlocked.')
29     ]
30     });
31     }
32    
33     channel.permissionOverwrites.edit(role, {
34     SEND_MESSAGES: true,
35 rakin 10 });
36     }
37 rakin 21 catch(e) {
38     console.log(e);
39     }
40 rakin 10 });
41     }
42     }
43     };

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26