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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 344 - (show annotations)
Mon Jul 29 17:29:40 2024 UTC (8 months, 1 week ago) by rakin
File MIME type: application/typescript
File size: 1737 byte(s)
chore: eslint autofix
1 import { 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 MessageEmbed from '../../client/MessageEmbed';
6 import { clearTimeoutv2, getTimeout, getTimeouts } from '../../utils/setTimeout';
7
8 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 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 const timeout = await getTimeout(parseInt(options.args[0]));
27 console.log(getTimeouts());
28
29 if (!timeout || timeout.row.guild_id !== msg.guild!.id) {
30 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 .addField('Command', `\`${timeout.row.cmd}\``)
49 .setFooter({
50 text: 'ID: ' + timeout.row.id
51 })
52 ]
53 });
54 }
55 }

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26