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

Annotation of /trunk/commands/setconfig.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: 1188 byte(s)
Added new features
1 rakin 10 const MessageEmbed = require("../src/MessageEmbed");
2    
3     module.exports = {
4     async handle(msg, cm) {
5     if (typeof cm.args[1] === 'undefined') {
6     await msg.reply({
7     embeds: [
8     new MessageEmbed()
9     .setColor('#f14a60')
10     .setDescription(`This command requires at least two arguments.`)
11     ]
12     });
13    
14     return;
15     }
16    
17     const key = cm.args[0];
18     const value = cm.args[1];
19    
20     if (typeof app.config.props[msg.guild.id][key] === 'undefined') {
21     await msg.reply({
22     embeds: [
23     new MessageEmbed()
24     .setColor('#f14a60')
25     .setDescription(`The configuration key \`${key}\` not found.`)
26     ]
27     });
28    
29     return;
30     }
31    
32     await app.config.set(key, value);
33     await app.config.write();
34    
35     await msg.reply({
36     embeds: [
37     new MessageEmbed()
38     .setColor('#007bff')
39     .setDescription(`The configuration key \`${key}\` updated.`)
40     ]
41     });
42    
43     return;
44     }
45     };

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26