diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-05-24 20:59:37 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-05-24 20:59:37 -0400 |
commit | a8d2c867ca35ea23d63123136e88730065ec9568 (patch) | |
tree | 9ec59b779da0ffe0f2ea7c6e654aedc81f8b2c3a /src/context-menu-commands | |
parent | 9f5d9da2a37ecfec412b149ec7dc385ab7b6a98c (diff) | |
download | tanzanite-a8d2c867ca35ea23d63123136e88730065ec9568.tar.gz tanzanite-a8d2c867ca35ea23d63123136e88730065ec9568.tar.bz2 tanzanite-a8d2c867ca35ea23d63123136e88730065ec9568.zip |
fix: viewraw context command and perfomance
Diffstat (limited to 'src/context-menu-commands')
-rw-r--r-- | src/context-menu-commands/user/userInfo.ts | 9 |
1 files changed, 7 insertions, 2 deletions
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] }); |