aboutsummaryrefslogtreecommitdiff
path: root/src/arguments/globalUser.ts
blob: 3a71732b131638afa280c41fec8785b3db9f3ba4 (plain)
1
2
3
4
5
6
7
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);
};