aboutsummaryrefslogtreecommitdiff
path: root/bot/src/plugins/analytics.js
blob: 137207fe779f58a9c906c2ec052a27e1ea27b554 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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
        });
    }
}