mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2024-11-09 22:33:09 +02:00
34 lines
840 B
JavaScript
34 lines
840 B
JavaScript
/**
|
|
*
|
|
* @name DiscordTickets
|
|
* @author eartharoid <contact@eartharoid.me>
|
|
* @license GNU-GPLv3
|
|
*
|
|
*/
|
|
|
|
const { MessageEmbed } = require('discord.js');
|
|
|
|
module.exports = {
|
|
name: 'stats',
|
|
description: 'View ticket stats.',
|
|
usage: '',
|
|
aliases: ['data', 'statistics'],
|
|
|
|
args: false,
|
|
async execute(client, message, _args, {config, Ticket}) {
|
|
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())
|
|
);
|
|
}
|
|
}; |