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

Contents of /trunk/src/commands/automation/QueuesCommand.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: 1729 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 { getTimeouts } from '../../utils/setTimeout';
9 import { timeProcess, timeSince } from '../../utils/util';
10
11 export default class QueuesCommand extends BaseCommand {
12 supportsInteractions: boolean = true;
13
14 constructor() {
15 super('queues', 'automation', []);
16 }
17
18 async run(client: DiscordClient, msg: Message | CommandInteraction, options: CommandOptions | InteractionOptions) {
19 const map = await getTimeouts();
20 let str = '';
21
22 await map.forEach(value => {
23 if (value.row.guild_id !== msg.guild!.id)
24 return;
25
26 console.log(new Date(value.row.time).getTime() - new Date().getTime());
27 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`;
28 });
29
30 await msg.reply({
31 embeds: [
32 new MessageEmbed()
33 .setTitle('Queue List')
34 .setDescription(str === '' ? 'No queue.' : str)
35 .setTimestamp()
36 ]
37 });
38 }
39 }

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26