aboutsummaryrefslogtreecommitdiff
path: root/src/arguments/globalUser.ts
blob: 081eabfee9b1b5170aa77d0f6062465205c0f01c (plain)
1
2
3
4
5
6
7
8
import { BushUser, type BushArgumentTypeCaster } from '#lib';

// resolve non-cached users
export const globalUser: 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);
};