aboutsummaryrefslogtreecommitdiff
path: root/bot/src/commands/userinfo.js
blob: c0796617be8ba6dcf0596261b7e05553159b230d (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
import { SlashCommandBuilder, EmbedBuilder } from 'discord.js';
import { abEmbedColour } from '../storage/consts.js';

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