/[sudobot]/trunk/src/commands/automation/DelQueueCommand.ts
ViewVC logotype

Annotation of /trunk/src/commands/automation/DelQueueCommand.ts

Parent Directory Parent Directory | Revision Log Revision Log


Revision 72 - (hide annotations)
Mon Jul 29 17:28:29 2024 UTC (8 months, 1 week ago) by rakin
File MIME type: application/typescript
File size: 1848 byte(s)
Added proper help information
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 { clearTimeoutv2, getTimeout, getTimeouts } from '../../utils/setTimeout';
8 rakin 46
9 rakin 51 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 rakin 46 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 rakin 51 const timeout = await getTimeout(parseInt(options.args[0]));
28 rakin 46 console.log(getTimeouts());
29    
30 rakin 51 if (!timeout || timeout.row.guild_id !== msg.guild!.id) {
31 rakin 46 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 rakin 49 .addField('Command', `\`${timeout.row.cmd}\``)
50 rakin 46 .setFooter({
51 rakin 51 text: 'ID: ' + timeout.row.id
52 rakin 46 })
53     ]
54     });
55     }
56 rakin 51 }

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26