-
Notifications
You must be signed in to change notification settings - Fork 59
/
userInfoCommand.ts
36 lines (34 loc) · 983 Bytes
/
userInfoCommand.ts
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
29
30
31
32
33
34
35
36
import { ApplicationCommandType, time } from 'discord.js'
import { CommandConfig } from '@/types/CommandConfig'
export const userInfoCommand: CommandConfig = {
data: {
name: 'Show user info',
type: ApplicationCommandType.User,
},
ephemeral: true,
execute: async (botContext, interaction) => {
if (!interaction.guild || !interaction.isContextMenuCommand()) return
const member = interaction.guild.members.cache.get(interaction.targetId)
if (!member) return
await interaction.editReply({
embeds: [
{
title: member.user.tag,
description: `${member.user}`,
fields: [
{
name: 'Joined',
value: member.joinedAt ? time(member.joinedAt) : 'N/A',
inline: true,
},
{
name: 'Created',
value: time(member.user.createdAt),
inline: true,
},
],
},
],
})
},
}