diff options
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 }; }; |