1 |
rakin |
25 |
const History = require("../src/History"); |
2 |
rakin |
5 |
const MessageEmbed = require("../src/MessageEmbed"); |
3 |
|
|
|
4 |
|
|
module.exports = { |
5 |
|
|
async handle(msg, cm) { |
6 |
|
|
if (typeof cm.args[0] === 'undefined') { |
7 |
|
|
await msg.reply({ |
8 |
|
|
embeds: [ |
9 |
|
|
new MessageEmbed() |
10 |
|
|
.setColor('#f14a60') |
11 |
|
|
.setDescription(`This command requires at least one argument.`) |
12 |
|
|
] |
13 |
|
|
}); |
14 |
|
|
|
15 |
|
|
return; |
16 |
|
|
} |
17 |
|
|
|
18 |
|
|
await app.db.get('SELECT * FROM warnings WHERE id = ?', [cm.args[0]], async (err, data) => { |
19 |
|
|
if (err) { |
20 |
|
|
console.log(err); |
21 |
|
|
} |
22 |
|
|
|
23 |
|
|
if (!data) { |
24 |
|
|
await msg.reply({ |
25 |
|
|
embeds: [ |
26 |
|
|
new MessageEmbed() |
27 |
|
|
.setColor('#f14a60') |
28 |
|
|
.setDescription(`No warning found.`) |
29 |
|
|
] |
30 |
|
|
}); |
31 |
|
|
|
32 |
|
|
return; |
33 |
|
|
} |
34 |
|
|
|
35 |
|
|
await app.db.get("DELETE FROM warnings WHERE id = ?", [cm.args[0]], async (err) => { |
36 |
|
|
if (err) { |
37 |
|
|
console.log(err); |
38 |
|
|
} |
39 |
|
|
|
40 |
rakin |
25 |
let user = { |
41 |
|
|
user: { |
42 |
|
|
tag: data.user_id |
43 |
|
|
} |
44 |
|
|
}; |
45 |
|
|
|
46 |
|
|
await History.create(data.user_id, msg.guild, 'warndel', msg.author.id, async (data2) => {}); |
47 |
|
|
|
48 |
|
|
try { |
49 |
|
|
user = await msg.guild.members.fetch(data.user_id); |
50 |
|
|
} |
51 |
|
|
catch(e) { |
52 |
|
|
|
53 |
|
|
} |
54 |
|
|
|
55 |
|
|
await app.logger.logWarndel(msg, user, data, msg.author); |
56 |
|
|
|
57 |
rakin |
5 |
await msg.reply({ |
58 |
|
|
embeds: [ |
59 |
|
|
new MessageEmbed() |
60 |
|
|
.setDescription('Warning deleted successfully.') |
61 |
|
|
] |
62 |
|
|
}); |
63 |
|
|
}); |
64 |
|
|
}); |
65 |
|
|
} |
66 |
|
|
}; |