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

Annotation of /trunk/commands/lockall.js

Parent Directory Parent Directory | Revision Log Revision Log


Revision 10 - (hide annotations)
Mon Jul 29 17:28:12 2024 UTC (8 months, 1 week ago) by rakin
File MIME type: text/javascript
File size: 1287 byte(s)
Added new features
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     let channels = app.config.get('lockall');
8    
9     if (msg.mentions.channels.first()) {
10     channels = msg.mentions.channels;
11     }
12     else {
13     channels = await msg.guild.channels.cache.filter(c => channels.indexOf(c.id) !== -1);
14     }
15    
16     let role = cm.options.indexOf('--everyone') === -1 ? msg.guild.roles.cache.find(r => r.id === app.config.get('gen_role')) : msg.guild.roles.everyone;
17    
18     await this.lockAll(role, channels, cm.options.indexOf('--no-send') === -1);
19     },
20     async lockAll(role, channels, send) {
21     if (role) {
22     channels.forEach(async channel => {
23     if (send) {
24     channel.send({
25     embeds: [
26     new MessageEmbed()
27     .setDescription(':lock: This channel has been locked.')
28     ]
29     });
30     }
31    
32     channel.permissionOverwrites.edit(role, {
33     SEND_MESSAGES: false,
34     });
35     });
36     }
37     }
38     };

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26