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

// resolve non-cached users
export const globalUser: BushArgumentTypeCaster<Promise<BushUser | null>> = async (_, phrase) => {
	return client.users.resolve(phrase) ?? (await client.users.fetch(`${phrase}`).catch(() => null));
};