From a8d2c867ca35ea23d63123136e88730065ec9568 Mon Sep 17 00:00:00 2001 From: IRONM00N <64110067+IRONM00N@users.noreply.github.com> Date: Tue, 24 May 2022 20:59:37 -0400 Subject: fix: viewraw context command and perfomance --- src/context-menu-commands/user/userInfo.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/context-menu-commands') diff --git a/src/context-menu-commands/user/userInfo.ts b/src/context-menu-commands/user/userInfo.ts index 5f59a30..8ecde92 100644 --- a/src/context-menu-commands/user/userInfo.ts +++ b/src/context-menu-commands/user/userInfo.ts @@ -15,9 +15,14 @@ export default class UserInfoContextMenuCommand extends ContextMenuCommand { public override async exec(interaction: ContextMenuCommandInteraction) { await interaction.deferReply({ ephemeral: true }); - const user = await client.users.fetch(interaction.targetId); + const user = await client.users.fetch(interaction.targetId).catch(() => null); + if (!user) return interaction.reply(`⁉ I couldn't find that user`); + const guild = interaction.guild as BushGuild; - const member = await guild.members.fetch(interaction.targetId); + + const member = await guild.members.fetch(interaction.targetId).catch(() => null); + if (!member) return interaction.reply(`${util.format.input(user.tag)} doesn't appear to be a member of this server anymore.`); + const userEmbed = await UserInfoCommand.makeUserInfoEmbed(user, member, guild); return await interaction.editReply({ embeds: [userEmbed] }); -- cgit