1 |
const MessageEmbed = require("../src/MessageEmbed"); |
2 |
|
3 |
module.exports = { |
4 |
async handle(msg, cm) { |
5 |
if (typeof cm.args[0] === 'undefined') { |
6 |
await msg.reply({ |
7 |
embeds: [ |
8 |
new MessageEmbed() |
9 |
.setColor('#f14a60') |
10 |
.setDescription(`This command requires at least one argument.`) |
11 |
] |
12 |
}); |
13 |
|
14 |
return; |
15 |
} |
16 |
|
17 |
await app.db.get("SELECT * FROM notes WHERE id = ? AND guild_id = ?", [cm.args[0], msg.guild.id], async (err, data) => { |
18 |
if (err) { |
19 |
console.log(err); |
20 |
} |
21 |
|
22 |
if (data === undefined) { |
23 |
await msg.reply({ |
24 |
embeds: [ |
25 |
new MessageEmbed() |
26 |
.setColor('#f14a60') |
27 |
.setDescription('No note found') |
28 |
] |
29 |
}); |
30 |
|
31 |
return; |
32 |
} |
33 |
|
34 |
await app.db.get('DELETE FROM notes WHERE id = ? AND guild_id = ?', [cm.args[0], msg.guild.id], async (err) => { |
35 |
if (err) { |
36 |
console.log(err); |
37 |
} |
38 |
|
39 |
await msg.reply({ |
40 |
embeds: [ |
41 |
new MessageEmbed() |
42 |
.setDescription('Note has been deleted') |
43 |
] |
44 |
}); |
45 |
}); |
46 |
}); |
47 |
|
48 |
} |
49 |
}; |