From fe7af3489af5881db33c315ca8cd22298c4715b9 Mon Sep 17 00:00:00 2001 From: Junseo Park Date: Tue, 23 Feb 2021 10:45:50 +0900 Subject: [PATCH] feat: handling invalid custom emoji --- utils/ShowdownExtensions.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/utils/ShowdownExtensions.ts b/utils/ShowdownExtensions.ts index ae944b8..b8d2a1f 100644 --- a/utils/ShowdownExtensions.ts +++ b/utils/ShowdownExtensions.ts @@ -1,6 +1,7 @@ import { Emoji, EmojiSyntax, Heading, ImageTag } from './Regex' import Twemoji from 'twemoji' import { KoreanbotsEmoji } from './Constants' +import { emoji } from 'node-emoji' export const anchorHeader = { type: 'output', @@ -34,7 +35,7 @@ export const customEmoji = { type: 'output', regex: EmojiSyntax, replace: function(__match: string, name: string) { - if(!name) return `:${name}:` - return `${name}` + if(!name || !KoreanbotsEmoji[name]) return `:${name}:` + return `${name}` } } \ No newline at end of file