1 |
rakin |
51 |
import { CommandInteraction, GuildMember, Interaction, Message } from 'discord.js'; |
2 |
|
|
import BaseCommand from '../../utils/structures/BaseCommand'; |
3 |
|
|
import DiscordClient from '../../client/Client'; |
4 |
|
|
import CommandOptions from '../../types/CommandOptions'; |
5 |
|
|
import InteractionOptions from '../../types/InteractionOptions'; |
6 |
|
|
import MessageEmbed from '../../client/MessageEmbed'; |
7 |
|
|
import Help from '../../utils/help'; |
8 |
|
|
import { clearTimeoutv2, getTimeout, getTimeouts } from '../../utils/setTimeout'; |
9 |
rakin |
46 |
|
10 |
rakin |
51 |
export default class DelQueueCommand extends BaseCommand { |
11 |
|
|
constructor() { |
12 |
|
|
super('delqueue', 'automation', []); |
13 |
|
|
} |
14 |
|
|
|
15 |
|
|
async run(client: DiscordClient, msg: Message, options: CommandOptions) { |
16 |
|
|
if (options.args[0] === undefined) { |
17 |
rakin |
46 |
await msg.reply({ |
18 |
|
|
embeds: [ |
19 |
|
|
new MessageEmbed() |
20 |
|
|
.setColor('#f14a60') |
21 |
|
|
.setDescription(`This command requires at least one argument.`) |
22 |
|
|
] |
23 |
|
|
}); |
24 |
|
|
|
25 |
|
|
return; |
26 |
|
|
} |
27 |
|
|
|
28 |
rakin |
51 |
const timeout = await getTimeout(parseInt(options.args[0])); |
29 |
rakin |
46 |
console.log(getTimeouts()); |
30 |
|
|
|
31 |
rakin |
51 |
if (!timeout || timeout.row.guild_id !== msg.guild!.id) { |
32 |
rakin |
46 |
await msg.reply({ |
33 |
|
|
embeds: [ |
34 |
|
|
new MessageEmbed() |
35 |
|
|
.setColor('#f14a60') |
36 |
|
|
.setDescription(`Invalid queue ID given.`) |
37 |
|
|
] |
38 |
|
|
}); |
39 |
|
|
|
40 |
|
|
return; |
41 |
|
|
} |
42 |
|
|
|
43 |
|
|
await clearTimeoutv2(timeout); |
44 |
|
|
|
45 |
|
|
await msg.reply({ |
46 |
|
|
embeds: [ |
47 |
|
|
new MessageEmbed() |
48 |
|
|
.setColor('#f14a60') |
49 |
|
|
.setDescription(`The queue has been deleted.`) |
50 |
rakin |
49 |
.addField('Command', `\`${timeout.row.cmd}\``) |
51 |
rakin |
46 |
.setFooter({ |
52 |
rakin |
51 |
text: 'ID: ' + timeout.row.id |
53 |
rakin |
46 |
}) |
54 |
|
|
] |
55 |
|
|
}); |
56 |
|
|
} |
57 |
rakin |
51 |
} |