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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26