aboutsummaryrefslogtreecommitdiff
path: root/bot/src/plugins/analytics.js
diff options
context:
space:
mode:
authorAndrew Lee <andrew@alee14.me>2025-03-29 11:42:40 -0400
committerAndrew Lee <andrew@alee14.me>2025-03-29 11:42:40 -0400
commitf18f5fff1fd0b8336df464d6e6f62efbc29aa618 (patch)
treecc23d2aa33ccb9dcd67f6bda811e5f32b0edc766 /bot/src/plugins/analytics.js
parent879c2a05c86682564f1f68aa234fd8e5298e95f6 (diff)
downloadAleeBot-f18f5fff1fd0b8336df464d6e6f62efbc29aa618.tar.gz
AleeBot-f18f5fff1fd0b8336df464d6e6f62efbc29aa618.tar.bz2
AleeBot-f18f5fff1fd0b8336df464d6e6f62efbc29aa618.zip
Added analytics; try/catch for ready event
Diffstat (limited to 'bot/src/plugins/analytics.js')
-rw-r--r--bot/src/plugins/analytics.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/bot/src/plugins/analytics.js b/bot/src/plugins/analytics.js
new file mode 100644
index 0000000..137207f
--- /dev/null
+++ b/bot/src/plugins/analytics.js
@@ -0,0 +1,17 @@
+import { commandUsages } from '../models/command-usages.js';
+import { enableAnalytics } from '../storage/consts.js';
+
+export async function Analytics(command, interaction) {
+ if (enableAnalytics) {
+ if (!interaction.guild) return await commandUsages.create({
+ command: command.data.name,
+ userID: interaction.user.id
+ });
+
+ return await commandUsages.create({
+ command: command.data.name,
+ userID: interaction.user.id,
+ guildID: interaction.guild.id
+ });
+ }
+}