aboutsummaryrefslogtreecommitdiff
path: root/src/arguments/discordEmoji.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/arguments/discordEmoji.ts')
-rw-r--r--src/arguments/discordEmoji.ts16
1 files changed, 4 insertions, 12 deletions
diff --git a/src/arguments/discordEmoji.ts b/src/arguments/discordEmoji.ts
index 9884c98..47e734d 100644
--- a/src/arguments/discordEmoji.ts
+++ b/src/arguments/discordEmoji.ts
@@ -1,17 +1,9 @@
import { Snowflake } from 'discord-api-types';
import { BushArgumentTypeCaster } from '../lib';
-export const discordEmojiTypeCaster: BushArgumentTypeCaster = (
- _,
- phrase
-): { name: string; id: Snowflake; animated: boolean } | null => {
- console.log(phrase);
+export const discordEmojiTypeCaster: BushArgumentTypeCaster = (_, phrase): { name: string; id: Snowflake } | null => {
if (!phrase) return null;
- const validEmoji = client.consts.regex.discordEmoji.test(phrase);
- console.log(validEmoji);
- if (!validEmoji) return null;
- const emoji = phrase.replace(/[<>]/g, '').split(':');
- const animated = emoji[0] === 'a';
- console.log(emoji);
- return { name: emoji[1], id: emoji[2], animated };
+ 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 };
};