From b29a217f76483e000bd9d75d30250d11a0a88c4d Mon Sep 17 00:00:00 2001 From: IRONM00N <64110067+IRONM00N@users.noreply.github.com> Date: Thu, 19 Aug 2021 12:03:21 -0400 Subject: added steal command, revamped error handling and other stuff --- src/commands/info/snowflakeInfo.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/commands/info/snowflakeInfo.ts') diff --git a/src/commands/info/snowflakeInfo.ts b/src/commands/info/snowflakeInfo.ts index c4d71da..02c8d39 100644 --- a/src/commands/info/snowflakeInfo.ts +++ b/src/commands/info/snowflakeInfo.ts @@ -88,7 +88,7 @@ export default class SnowflakeInfoCommand extends BushCommand { } // Guild - else if (client.guilds.cache.has(snowflake)) { + if (client.guilds.cache.has(snowflake)) { const guild: Guild = client.guilds.cache.get(snowflake)!; const guildInfo = [ `**Name:** ${guild.name}`, @@ -101,8 +101,9 @@ export default class SnowflakeInfoCommand extends BushCommand { } // User - else if (client.users.cache.has(snowflake)) { - const user: User = client.users.cache.get(snowflake)!; + const fetchedUser = await client.users.fetch(`${snowflake}`).catch(() => undefined); + if (client.users.cache.has(snowflake) || fetchedUser) { + const user: User = (client.users.cache.get(snowflake) ?? fetchedUser)!; const userInfo = [`**Name:** <@${user.id}> (${user.tag})`]; if (user.avatar) snowflakeEmbed.setThumbnail(user.avatarURL({ size: 2048, dynamic: true })!); snowflakeEmbed.addField('ยป User Info', userInfo.join('\n')); @@ -110,7 +111,7 @@ export default class SnowflakeInfoCommand extends BushCommand { } // Emoji - else if (client.emojis.cache.has(snowflake)) { + if (client.emojis.cache.has(snowflake)) { const emoji: Emoji = client.emojis.cache.get(snowflake)!; const emojiInfo = [`**Name:** ${emoji.name}`, `**Animated:** ${emoji.animated}`]; if (emoji.url) snowflakeEmbed.setThumbnail(emoji.url); @@ -119,7 +120,7 @@ export default class SnowflakeInfoCommand extends BushCommand { } // Role - else if (message.guild && message.guild.roles.cache.has(snowflake)) { + if (message.guild && message.guild.roles.cache.has(snowflake)) { const role: Role = message.guild.roles.cache.get(snowflake)!; const roleInfo = [ `**Name:** <@&${role.id}> (${role.name})`, -- cgit