diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-09-30 20:45:54 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-09-30 20:45:54 -0400 |
commit | 535c0544086acc5af3d2806a203d6a9d6f8b94f9 (patch) | |
tree | 1238d38c5dd67ba0973887e9936a22b59b8db7fc /src/arguments | |
parent | 464425b731754c8b2024c3ac2c004758ee7ddb6d (diff) | |
download | tanzanite-535c0544086acc5af3d2806a203d6a9d6f8b94f9.tar.gz tanzanite-535c0544086acc5af3d2806a203d6a9d6f8b94f9.tar.bz2 tanzanite-535c0544086acc5af3d2806a203d6a9d6f8b94f9.zip |
globalUser, new embeded activies, per server avatars
Diffstat (limited to 'src/arguments')
-rw-r--r-- | src/arguments/globalUser.ts | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/arguments/globalUser.ts b/src/arguments/globalUser.ts new file mode 100644 index 0000000..3a71732 --- /dev/null +++ b/src/arguments/globalUser.ts @@ -0,0 +1,8 @@ +import { BushArgumentTypeCaster, BushUser } from '@lib'; + +// resolve non-cached users +export const globalUserTypeCaster: BushArgumentTypeCaster = async (_, phrase): Promise<BushUser | null> => { + return client.users.cache.has(phrase) + ? client.users.cache.get(`${phrase}`) ?? null + : await client.users.fetch(`${phrase}`).catch(() => null); +}; |