2020-08-17 16:46:23 +03:00
|
|
|
/**
|
2020-10-03 17:08:10 +03:00
|
|
|
*
|
2020-08-17 16:46:23 +03:00
|
|
|
* @name DiscordTickets
|
|
|
|
* @author eartharoid <contact@eartharoid.me>
|
|
|
|
* @license GNU-GPLv3
|
2020-10-03 17:08:10 +03:00
|
|
|
*
|
2020-08-17 16:46:23 +03:00
|
|
|
*/
|
|
|
|
|
2020-08-23 00:40:27 +03:00
|
|
|
const { MessageEmbed } = require('discord.js');
|
2020-08-17 16:46:23 +03:00
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
name: 'stats',
|
|
|
|
description: 'View ticket stats.',
|
|
|
|
usage: '',
|
2020-08-23 00:40:27 +03:00
|
|
|
aliases: ['data', 'statistics'],
|
2020-10-15 00:37:57 +03:00
|
|
|
|
2020-08-17 16:46:23 +03:00
|
|
|
args: false,
|
2020-10-03 19:18:07 +03:00
|
|
|
async execute(client, message, _args, {config, Ticket}) {
|
2020-08-23 00:40:27 +03:00
|
|
|
const guild = client.guilds.cache.get(config.guild);
|
|
|
|
|
|
|
|
let open = await Ticket.count({ where: { open: true } });
|
|
|
|
let closed = await Ticket.count({ where: { open: false } });
|
|
|
|
|
|
|
|
message.channel.send(
|
|
|
|
new MessageEmbed()
|
|
|
|
.setColor(config.colour)
|
|
|
|
.setTitle(':bar_chart: Statistics')
|
|
|
|
.addField('Open tickets', open, true)
|
|
|
|
.addField('Closed tickets', closed, true)
|
|
|
|
.addField('Total tickets', open + closed, true)
|
|
|
|
.setFooter(guild.name, guild.iconURL())
|
|
|
|
);
|
2020-08-17 16:46:23 +03:00
|
|
|
}
|
|
|
|
};
|