aboutsummaryrefslogtreecommitdiff
path: root/bot/src/commands/userinfo.js
blob: 311da1248731327db413a4f91db9e85ba8c565c2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { SlashCommandBuilder, EmbedBuilder } from 'discord.js';
import { abEmbedColour } from '../storage/consts.js';

export default {
    data: new SlashCommandBuilder()
        .setName('userinfo')
        .setDescription('Information about a user.')
        .setContexts(0)
        .addUserOption(option =>
            option
                .setName('username')
                .setDescription('The user to get the information of')),
    async execute(interaction) {
        const user = interaction.options.getUser('username') || interaction.user;
        const member = interaction.guild.members.cache.get(user.id);
        const userEmbed = new EmbedBuilder()
            .setAuthor({ name: user.username, iconURL: user.avatarURL() })
            .setDescription('User Information')
            .setThumbnail(user.avatarURL())
            .addFields(
                { name: 'Names', value: `**Display Name:**  ${member.displayName}\n**Username:**  ${user.username}` },
                { name: 'Identity', value: `**User ID:** ${user.id}` },
                { name: 'Create and Join Times', value: `**Created At:**  ${user.createdAt.toUTCString()}\n**Joined Guild At:**  ${member.joinedAt.toUTCString()}` }
            )
            .setColor(abEmbedColour);
        return await interaction.reply({ embeds: [userEmbed] });
    }
};