aboutsummaryrefslogtreecommitdiff
path: root/src/arguments/snowflake.ts
blob: b98a20f046157acb275f9fb768f523f633982b2a (plain)
1
2
3
4
5
6
7
8
import { BushArgumentTypeCaster, regex } from '#lib';
import type { Snowflake } from 'discord.js';

export const snowflake: BushArgumentTypeCaster<Snowflake | null> = (_, phrase) => {
	if (!phrase) return null;
	if (regex.snowflake.test(phrase)) return phrase;
	return null;
};