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

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