1 |
rakin |
5 |
const MessageEmbed = require("../src/MessageEmbed"); |
2 |
|
|
|
3 |
|
|
module.exports = { |
4 |
|
|
async handle(msg, cm) { |
5 |
|
|
if (cm.args[1] === undefined) { |
6 |
|
|
await msg.reply({ |
7 |
|
|
embeds: [ |
8 |
|
|
new MessageEmbed() |
9 |
|
|
.setColor('#f14a60') |
10 |
|
|
.setDescription('This command requires at least 2 arguments.') |
11 |
|
|
] |
12 |
|
|
}); |
13 |
|
|
|
14 |
|
|
return; |
15 |
|
|
} |
16 |
|
|
|
17 |
|
|
let args = [...cm.args]; |
18 |
|
|
args.shift(); |
19 |
|
|
let content = args.join(' '); |
20 |
|
|
|
21 |
|
|
let status = cm.snippetManager.create(cm.args[0], content); |
22 |
|
|
|
23 |
|
|
if (status) { |
24 |
|
|
await msg.reply({ |
25 |
|
|
embeds: [ |
26 |
|
|
new MessageEmbed() |
27 |
|
|
.setDescription('New snippet added successfully!') |
28 |
|
|
] |
29 |
|
|
}); |
30 |
|
|
} |
31 |
|
|
else { |
32 |
|
|
await msg.reply({ |
33 |
|
|
embeds: [ |
34 |
|
|
new MessageEmbed() |
35 |
|
|
.setColor('#f14a60') |
36 |
|
|
.setDescription('A snippet already exists with that name.') |
37 |
|
|
] |
38 |
|
|
}); |
39 |
|
|
} |
40 |
|
|
} |
41 |
|
|
}; |