1 |
rakin |
51 |
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 |
|
|
} |