From 2356d2c44736fb83021dacb551625852111c8ce6 Mon Sep 17 00:00:00 2001 From: IRONM00N <64110067+IRONM00N@users.noreply.github.com> Date: Thu, 18 Aug 2022 22:42:12 -0400 Subject: restructure, experimental presence and member automod, fixed bugs probably made some more bugs --- lib/arguments/discordEmoji.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 lib/arguments/discordEmoji.ts (limited to 'lib/arguments/discordEmoji.ts') diff --git a/lib/arguments/discordEmoji.ts b/lib/arguments/discordEmoji.ts new file mode 100644 index 0000000..92d6502 --- /dev/null +++ b/lib/arguments/discordEmoji.ts @@ -0,0 +1,14 @@ +import { regex, type BushArgumentTypeCaster } from '#lib'; +import type { Snowflake } from 'discord.js'; + +export const discordEmoji: BushArgumentTypeCaster = (_, phrase) => { + if (!phrase) return null; + const validEmoji: RegExpExecArray | null = regex.discordEmoji.exec(phrase); + if (!validEmoji || !validEmoji.groups) return null; + return { name: validEmoji.groups.name, id: validEmoji.groups.id }; +}; + +export interface DiscordEmojiInfo { + name: string; + id: Snowflake; +} -- cgit