2021-06-19 23:57:12 +02:00
|
|
|
const Command = require('../Command');
|
|
|
|
|
|
|
|
class Queue extends Command {
|
|
|
|
|
2021-10-22 09:35:04 +02:00
|
|
|
constructor (client) {
|
2021-06-19 23:57:12 +02:00
|
|
|
super(client, {
|
|
|
|
name: 'queue',
|
2021-10-22 09:35:04 +02:00
|
|
|
aliases: [ 'mmq', 'mmqueue', 'q' ]
|
2021-06-19 23:57:12 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-10-22 09:35:04 +02:00
|
|
|
async execute (message) {
|
2021-06-19 23:57:12 +02:00
|
|
|
|
|
|
|
const { queue } = this.client.modmail;
|
|
|
|
if (!queue.length) return 'Queue is empty!';
|
|
|
|
|
2022-01-25 09:46:42 +01:00
|
|
|
await this.client.cache.verifyQueue();
|
2021-06-20 01:23:52 +02:00
|
|
|
const users = await this.client.resolveUsers(queue);
|
2021-06-19 23:57:12 +02:00
|
|
|
let str = ``,
|
|
|
|
count = 0;
|
|
|
|
for (const user of users) {
|
|
|
|
const _str = `${user.tag} (${user.id})\n`;
|
|
|
|
if ((str + _str).length > 2000) break;
|
|
|
|
str += _str;
|
|
|
|
count++;
|
|
|
|
}
|
|
|
|
|
|
|
|
const { channel } = message;
|
|
|
|
const embed = {
|
|
|
|
title: `${users.length} users in queue`,
|
|
|
|
description: str,
|
|
|
|
footer: {
|
|
|
|
text: `Showing ${count} users`
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
await channel.send({ embed });
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = Queue;
|