/[sudobot]/branches/2.x/src/commands/automation/DelQueueCommand.ts
ViewVC logotype

Contents of /branches/2.x/src/commands/automation/DelQueueCommand.ts

Parent Directory Parent Directory | Revision Log Revision Log


Revision 577 - (show annotations)
Mon Jul 29 18:52:37 2024 UTC (8 months ago) by rakinar2
File MIME type: application/typescript
File size: 1848 byte(s)
chore: add old version archive branches (2.x to 9.x-dev)
1 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 { clearTimeoutv2, getTimeout, getTimeouts } from '../../utils/setTimeout';
8
9 export default class DelQueueCommand extends BaseCommand {
10 constructor() {
11 super('delqueue', 'automation', []);
12 }
13
14 async run(client: DiscordClient, msg: Message, options: CommandOptions) {
15 if (options.args[0] === undefined) {
16 await msg.reply({
17 embeds: [
18 new MessageEmbed()
19 .setColor('#f14a60')
20 .setDescription(`This command requires at least one argument.`)
21 ]
22 });
23
24 return;
25 }
26
27 const timeout = await getTimeout(parseInt(options.args[0]));
28 console.log(getTimeouts());
29
30 if (!timeout || timeout.row.guild_id !== msg.guild!.id) {
31 await msg.reply({
32 embeds: [
33 new MessageEmbed()
34 .setColor('#f14a60')
35 .setDescription(`Invalid queue ID given.`)
36 ]
37 });
38
39 return;
40 }
41
42 await clearTimeoutv2(timeout);
43
44 await msg.reply({
45 embeds: [
46 new MessageEmbed()
47 .setColor('#f14a60')
48 .setDescription(`The queue has been deleted.`)
49 .addField('Command', `\`${timeout.row.cmd}\``)
50 .setFooter({
51 text: 'ID: ' + timeout.row.id
52 })
53 ]
54 });
55 }
56 }

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26