diff options
| author | Andrew Lee <andrew@alee14.me> | 2025-03-29 22:19:55 -0400 |
|---|---|---|
| committer | Andrew Lee <andrew@alee14.me> | 2025-03-29 22:19:55 -0400 |
| commit | 070825d2b779b114a1c345fbca210d324bf34d53 (patch) | |
| tree | 1a62f7676bc46b8bc799e8b4b486fa0ea2879f6f /bot/src/commands/stats.js | |
| parent | db6df8c2a3817a753a9b903feb6311c620a91a65 (diff) | |
| download | AleeBot-070825d2b779b114a1c345fbca210d324bf34d53.tar.gz AleeBot-070825d2b779b114a1c345fbca210d324bf34d53.tar.bz2 AleeBot-070825d2b779b114a1c345fbca210d324bf34d53.zip | |
Quote submit stats + input validation for author/year; API changes; Use toString for some stuff
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); |
