aboutsummaryrefslogtreecommitdiff
path: root/bot/src/commands/stats.js
diff options
context:
space:
mode:
authorAndrew Lee <andrew@alee14.me>2025-03-29 17:20:25 -0400
committerAndrew Lee <andrew@alee14.me>2025-03-29 17:20:25 -0400
commitdb6df8c2a3817a753a9b903feb6311c620a91a65 (patch)
tree866153f9f2131e0d80bcef3b3c070723ba43515c /bot/src/commands/stats.js
parentf18f5fff1fd0b8336df464d6e6f62efbc29aa618 (diff)
downloadAleeBot-db6df8c2a3817a753a9b903feb6311c620a91a65.tar.gz
AleeBot-db6df8c2a3817a753a9b903feb6311c620a91a65.tar.bz2
AleeBot-db6df8c2a3817a753a9b903feb6311c620a91a65.zip
New command; Removed "Message too long" for content field
Diffstat (limited to 'bot/src/commands/stats.js')
-rw-r--r--bot/src/commands/stats.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/bot/src/commands/stats.js b/bot/src/commands/stats.js
new file mode 100644
index 0000000..9504386
--- /dev/null
+++ b/bot/src/commands/stats.js
@@ -0,0 +1,24 @@
+import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
+import { commandUsages } from '../models/command-usages.js';
+import { abEmbedColour } from '../storage/consts.js';
+
+export default {
+ data: new SlashCommandBuilder()
+ .setName('stats')
+ .setDescription('Shows how many times you executed a command.'),
+ async execute(interaction) {
+ let cmdUsage = await commandUsages.findAll({ where: { userID: interaction.user.id } });
+ const totalCommands = cmdUsage.length;
+ const guildCommands = cmdUsage.filter(cmd => cmd.guildID === interaction.guild.id).length;
+
+ const statsEmbed = new EmbedBuilder()
+ .setAuthor({ name: `Stats for ${interaction.user.username}`, iconURL: interaction.client.user.avatarURL() })
+ .addFields(
+ { name: 'Total Commands Executed', value: totalCommands.toString() },
+ { name: 'Total Commands Executed in this Guild', value: guildCommands.toString() }
+ )
+ .setColor(abEmbedColour);
+
+ return await interaction.reply({ embeds: [statsEmbed] });
+ }
+};