diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-02-19 18:52:41 -0500 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-02-19 18:52:41 -0500 |
commit | e78beed6c7e094ef48aad5d18da01b2bbed4536c (patch) | |
tree | 32676793af5f7bdc39d438ff284fa5b959274e96 /src/arguments | |
parent | a3103b629250de3fb97a40a4f9ff7e7ba28f4d16 (diff) | |
download | tanzanite-e78beed6c7e094ef48aad5d18da01b2bbed4536c.tar.gz tanzanite-e78beed6c7e094ef48aad5d18da01b2bbed4536c.tar.bz2 tanzanite-e78beed6c7e094ef48aad5d18da01b2bbed4536c.zip |
fix: a ton of shit
Diffstat (limited to 'src/arguments')
-rw-r--r-- | src/arguments/globalUser.ts | 4 | ||||
-rw-r--r-- | src/arguments/roleWithDuration.ts | 8 |
2 files changed, 5 insertions, 7 deletions
diff --git a/src/arguments/globalUser.ts b/src/arguments/globalUser.ts index 69d3e89..08350d2 100644 --- a/src/arguments/globalUser.ts +++ b/src/arguments/globalUser.ts @@ -2,7 +2,5 @@ import { type BushArgumentTypeCaster, type BushUser } from '#lib'; // resolve non-cached users export const globalUser: BushArgumentTypeCaster<Promise<BushUser | null>> = async (_, phrase) => { - return client.users.cache.has(phrase) - ? client.users.cache.get(`${phrase}`) ?? null - : await client.users.fetch(`${phrase}`).catch(() => null); + return client.users.resolve(phrase) ?? (await client.users.fetch(`${phrase}`).catch(() => null)); }; diff --git a/src/arguments/roleWithDuration.ts b/src/arguments/roleWithDuration.ts index d619b9e..5f1da98 100644 --- a/src/arguments/roleWithDuration.ts +++ b/src/arguments/roleWithDuration.ts @@ -3,10 +3,10 @@ import { type Role } from 'discord.js'; export const roleWithDuration: BushArgumentTypeCaster<Promise<RoleWithDuration | null>> = async (message, phrase) => { // eslint-disable-next-line prefer-const - let { duration, contentWithoutTime } = client.util.parseDuration(phrase); - if (contentWithoutTime === null || contentWithoutTime === undefined) return null; - contentWithoutTime = contentWithoutTime.trim(); - const role = await util.arg.cast('role', message, contentWithoutTime); + let { duration, content } = client.util.parseDuration(phrase); + if (content === null || content === undefined) return null; + content = content.trim(); + const role = await util.arg.cast('role', message, content); if (!role) return null; return { duration, role }; }; |