mirror of
https://github.com/koreanbots/core.git
synced 2025-12-16 06:20:24 +00:00
feat: handling invalid custom emoji
This commit is contained in:
parent
97ef0d1833
commit
fe7af3489a
@ -1,6 +1,7 @@
|
|||||||
import { Emoji, EmojiSyntax, Heading, ImageTag } from './Regex'
|
import { Emoji, EmojiSyntax, Heading, ImageTag } from './Regex'
|
||||||
import Twemoji from 'twemoji'
|
import Twemoji from 'twemoji'
|
||||||
import { KoreanbotsEmoji } from './Constants'
|
import { KoreanbotsEmoji } from './Constants'
|
||||||
|
import { emoji } from 'node-emoji'
|
||||||
|
|
||||||
export const anchorHeader = {
|
export const anchorHeader = {
|
||||||
type: 'output',
|
type: 'output',
|
||||||
@ -34,7 +35,7 @@ export const customEmoji = {
|
|||||||
type: 'output',
|
type: 'output',
|
||||||
regex: EmojiSyntax,
|
regex: EmojiSyntax,
|
||||||
replace: function(__match: string, name: string) {
|
replace: function(__match: string, name: string) {
|
||||||
if(!name) return `:${name}:`
|
if(!name || !KoreanbotsEmoji[name]) return `:${name}:`
|
||||||
return `<img class="emoji" draggable="false" alt="${name}" src="${KoreanbotsEmoji[name]}"/>`
|
return `<img class="emoji special" draggable="false" alt="${name}" src="${KoreanbotsEmoji[name]}"/>`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user