aboutsummaryrefslogtreecommitdiff
path: root/src/context-menu-commands/user/userInfo.ts
blob: 1e35093d242996d0deb471227c12a1ee11b62089 (plain)
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
import { BushGuild, BushGuildMember, BushUser } from '#lib';
import { ContextMenuCommand } from 'discord-akairo';
import { type ContextMenuInteraction } from 'discord.js';
import UserInfoCommand from '../../commands/info/userInfo.js';

export default class UserInfoContextMenuCommand extends ContextMenuCommand {
	public constructor() {
		super('userInfo', {
			name: 'User Info',
			type: 'USER',
			category: 'user'
		});
	}

	public override async exec(interaction: ContextMenuInteraction) {
		await interaction.deferReply({ ephemeral: true });

		const user = (await interaction.user.fetch()) as BushUser;
		const member = interaction.member as BushGuildMember;
		const guild = interaction.guild as BushGuild;
		const userEmbed = await UserInfoCommand.makeUserInfoEmbed(user, member, guild);

		return await interaction.editReply({ embeds: [userEmbed] });
	}
}