diff options
Diffstat (limited to 'bot/src/commands/stats.js')
| -rw-r--r-- | bot/src/commands/stats.js | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/bot/src/commands/stats.js b/bot/src/commands/stats.js index 9504386..6924874 100644 --- a/bot/src/commands/stats.js +++ b/bot/src/commands/stats.js @@ -1,21 +1,26 @@ import { EmbedBuilder, SlashCommandBuilder } from 'discord.js'; import { commandUsages } from '../models/command-usages.js'; import { abEmbedColour } from '../storage/consts.js'; +import { quote } from '../models/quote.js'; export default { data: new SlashCommandBuilder() .setName('stats') - .setDescription('Shows how many times you executed a command.'), + .setDescription('Shows statistics of your interaction with AleeBot.'), async execute(interaction) { - let cmdUsage = await commandUsages.findAll({ where: { userID: interaction.user.id } }); + const cmdUsage = await commandUsages.findAll({ where: { userID: interaction.user.id } }); + const quoteSubmitted = await quote.findAll({ where: { submitter: interaction.user.id } }); + const totalCommands = cmdUsage.length; const guildCommands = cmdUsage.filter(cmd => cmd.guildID === interaction.guild.id).length; + const totalQuotes = quoteSubmitted.length; const statsEmbed = new EmbedBuilder() - .setAuthor({ name: `Stats for ${interaction.user.username}`, iconURL: interaction.client.user.avatarURL() }) + .setAuthor({ name: `AleeBot Stats for ${interaction.user.displayName}`, iconURL: interaction.client.user.avatarURL() }) .addFields( - { name: 'Total Commands Executed', value: totalCommands.toString() }, - { name: 'Total Commands Executed in this Guild', value: guildCommands.toString() } + { name: 'Total Commands Executed (Global)', value: totalCommands.toString() }, + { name: 'Total Commands Executed (Guild)', value: guildCommands.toString() }, + { name: 'Total Quotes Submitted', value: totalQuotes.toString() } ) .setColor(abEmbedColour); |
