aboutsummaryrefslogtreecommitdiff
path: root/src/arguments
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-09-30 20:45:54 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-09-30 20:45:54 -0400
commit535c0544086acc5af3d2806a203d6a9d6f8b94f9 (patch)
tree1238d38c5dd67ba0973887e9936a22b59b8db7fc /src/arguments
parent464425b731754c8b2024c3ac2c004758ee7ddb6d (diff)
downloadtanzanite-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.ts8
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);
+};