blob: a02766f72fb131cd9687a95e2830128cba2fa0be [file] [log] [blame]
PineaFana34d04b2023-01-03 22:05:42 +00001import { ContextMenuCommandBuilder, GuildMember, UserContextMenuCommandInteraction } from "discord.js";
2import { userAbout } from "../../commands/user/about.js";
3
Skyler Greyda16adf2023-03-05 10:22:12 +00004const command = new ContextMenuCommandBuilder().setName("User info");
PineaFana34d04b2023-01-03 22:05:42 +00005
6const callback = async (interaction: UserContextMenuCommandInteraction) => {
TheCodedProfc016f9f2023-04-23 16:01:38 -04007 const guild = interaction.guild!;
8 let member = interaction.targetMember as GuildMember | null;
9 if (!member) member = await guild.members.fetch(interaction.targetId);
10 await userAbout(guild, member as GuildMember, interaction);
Skyler Greyda16adf2023-03-05 10:22:12 +000011};
PineaFana34d04b2023-01-03 22:05:42 +000012
Skyler Grey789e2fd2023-04-23 21:09:40 +000013const check = async (interaction: UserContextMenuCommandInteraction) => {
14 if (!interaction.inGuild()) return "You must be in a server to use this command.";
15
PineaFana34d04b2023-01-03 22:05:42 +000016 return true;
Skyler Greyda16adf2023-03-05 10:22:12 +000017};
PineaFana34d04b2023-01-03 22:05:42 +000018
Skyler Greyda16adf2023-03-05 10:22:12 +000019export { command, callback, check };