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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26