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