From e78beed6c7e094ef48aad5d18da01b2bbed4536c Mon Sep 17 00:00:00 2001 From: IRONM00N <64110067+IRONM00N@users.noreply.github.com> Date: Sat, 19 Feb 2022 18:52:41 -0500 Subject: fix: a ton of shit --- src/arguments/globalUser.ts | 4 +--- src/arguments/roleWithDuration.ts | 8 ++++---- 2 files changed, 5 insertions(+), 7 deletions(-) (limited to 'src/arguments') 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> = 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> = 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 }; }; -- cgit