aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-03-14 20:32:57 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-03-14 20:32:57 -0400
commit59a4eb09916ad7c9e6cd8ea8b4d3a72189c284ce (patch)
treec546789615fb836d117b919e5fcf381d08a20981
parent1e90863cf79eb9674248ff3b8abb19d5c3936993 (diff)
downloadtanzanite-59a4eb09916ad7c9e6cd8ea8b4d3a72189c284ce.tar.gz
tanzanite-59a4eb09916ad7c9e6cd8ea8b4d3a72189c284ce.tar.bz2
tanzanite-59a4eb09916ad7c9e6cd8ea8b4d3a72189c284ce.zip
revert: changes I made to resolveNonCachedUser
-rw-r--r--src/lib/extensions/discord-akairo/BushClientUtil.ts14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/lib/extensions/discord-akairo/BushClientUtil.ts b/src/lib/extensions/discord-akairo/BushClientUtil.ts
index 9b63736..f5099f6 100644
--- a/src/lib/extensions/discord-akairo/BushClientUtil.ts
+++ b/src/lib/extensions/discord-akairo/BushClientUtil.ts
@@ -26,10 +26,12 @@ import { APIEmbed, APIMessage, OAuth2Scopes } from 'discord-api-types/v9';
import {
Constants as DiscordConstants,
Embed,
+ GuildMember,
Message,
PermissionFlagsBits,
PermissionsBitField,
PermissionsString,
+ ThreadMember,
User,
Util as DiscordUtil,
type CommandInteraction,
@@ -694,7 +696,17 @@ export class BushClientUtil extends ClientUtil {
*/
public async resolveNonCachedUser(user: UserResolvable | undefined | null): Promise<BushUser | undefined> {
if (user == null) return undefined;
- const resolvedUser = client.users.resolve(user);
+ const resolvedUser =
+ user instanceof User
+ ? <BushUser>user
+ : user instanceof GuildMember
+ ? <BushUser>user.user
+ : user instanceof ThreadMember
+ ? <BushUser>user.user
+ : user instanceof Message
+ ? <BushUser>user.author
+ : undefined;
+
return resolvedUser ?? (await client.users.fetch(user as Snowflake).catch(() => undefined));
}