aboutsummaryrefslogtreecommitdiff
path: root/src/commands/info/snowflakeInfo.ts
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-08-19 12:03:21 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-08-19 12:03:21 -0400
commitb29a217f76483e000bd9d75d30250d11a0a88c4d (patch)
tree041b13dc115cf94aff81cda17cf088f2290c2a14 /src/commands/info/snowflakeInfo.ts
parent5984cc283ca50099d0e266b994324446316c0013 (diff)
downloadtanzanite-b29a217f76483e000bd9d75d30250d11a0a88c4d.tar.gz
tanzanite-b29a217f76483e000bd9d75d30250d11a0a88c4d.tar.bz2
tanzanite-b29a217f76483e000bd9d75d30250d11a0a88c4d.zip
added steal command, revamped error handling and other stuff
Diffstat (limited to 'src/commands/info/snowflakeInfo.ts')
-rw-r--r--src/commands/info/snowflakeInfo.ts11
1 files changed, 6 insertions, 5 deletions
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})`,