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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 344 - (hide annotations)
Mon Jul 29 17:29:40 2024 UTC (8 months, 2 weeks ago) by rakin
File MIME type: application/typescript
File size: 1644 byte(s)
chore: eslint autofix
1 rakin 344 import { CommandInteraction, 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 InteractionOptions from '../../types/InteractionOptions';
6     import MessageEmbed from '../../client/MessageEmbed';
7     import { getTimeouts } from '../../utils/setTimeout';
8     import { timeProcess, timeSince } from '../../utils/util';
9    
10     export default class QueuesCommand extends BaseCommand {
11     supportsInteractions: boolean = true;
12    
13     constructor() {
14     super('queues', 'automation', []);
15     }
16    
17     async run(client: DiscordClient, msg: Message | CommandInteraction, options: CommandOptions | InteractionOptions) {
18     const map = await getTimeouts();
19     let str = '';
20    
21     await map.forEach(value => {
22     if (value.row.guild_id !== msg.guild!.id)
23     return;
24    
25     console.log(new Date(value.row.time).getTime() - new Date().getTime());
26 rakin 339 str += `**ID: ${value.row.id}**\n**User Command**: \`${value.row.cmd}\`\n**Internal Command**: \`${value.row.params}\`\n**ETA**: ${timeProcess((new Date(value.row.time).getTime() - new Date().getTime()) / 1000).replace(' ago', '')}\n**Queue Added**: ${value.row.createdAt.toLocaleString()} (${timeSince(value.row.createdAt.getTime())})\n\n`;
27 rakin 51 });
28    
29     await msg.reply({
30     embeds: [
31     new MessageEmbed()
32     .setTitle('Queue List')
33     .setDescription(str === '' ? 'No queue.' : str)
34     .setTimestamp()
35     ]
36     });
37     }
38     }

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26