blob: 6fb971a8e615251c2dc4c7733ce888fde8a21ada (
plain)
1
2
3
4
5
6
7
8
9
|
import { type BushArgumentTypeCaster } from '#lib';
import { type Snowflake } from 'discord-api-types';
export const discordEmojiTypeCaster: BushArgumentTypeCaster = (_, phrase): { name: string; id: Snowflake } | null => {
if (!phrase) return null;
const validEmoji: RegExpExecArray | null = client.consts.regex.discordEmoji.exec(phrase);
if (!validEmoji || !validEmoji.groups) return null;
return { name: validEmoji.groups.name, id: validEmoji.groups.id };
};
|