/[sudobot]/branches/2.x/src/commands/automation/QueuesCommand.ts
ViewVC logotype

Annotation of /branches/2.x/src/commands/automation/QueuesCommand.ts

Parent Directory Parent Directory | Revision Log Revision Log


Revision 577 - (hide annotations)
Mon Jul 29 18:52:37 2024 UTC (8 months ago) by rakinar2
File MIME type: application/typescript
File size: 1692 byte(s)
chore: add old version archive branches (2.x to 9.x-dev)
1 rakinar2 577 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 { 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     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**: ${new Date(value.row.created_at).toLocaleString()} (${timeSince(new Date(value.row.created_at).getTime())})\n\n`;
27     });
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