add unicode emoji convert

This commit is contained in:
kimpure 2026-05-21 16:27:25 +00:00
parent 94b6ba2d7d
commit e3e4e5c27d
No known key found for this signature in database

View file

@ -175,10 +175,45 @@ export const GIFMap = {
"images-ext-1.discordapp.net/external/2R41WcvNJwYMD69UKls2cDa_hEL-rzCRCFvOi2DDOVo/https/media.tenor.com/sU3RCOixDbgAAAPo/majo-no-tabitabi-the-journey-of-elaina.mp4": "일레이나 손짓", "images-ext-1.discordapp.net/external/2R41WcvNJwYMD69UKls2cDa_hEL-rzCRCFvOi2DDOVo/https/media.tenor.com/sU3RCOixDbgAAAPo/majo-no-tabitabi-the-journey-of-elaina.mp4": "일레이나 손짓",
}; };
export const Units = { export const UnicodeEmojis = {
"㎢": "제곱킬로미터", "㎢": "제곱킬로미터",
"㎡": "제곱미터", "㎡": "제곱미터",
"↑": "위쪽 화살표", "↓": "아래쪽 화살표",
"←": "왼쪽 화살표", "→": "오른쪽 화살표",
"↔": "좌우 화살표",
"↖": "왼쪽 위 화살표", "↗": "오른쪽 위 화살표",
"↘": "오른쪽 아래 화살표", "↙": "왼쪽 아래 화살표",
"🎀": "리본", "🐱": "고양이", "✨": "반짝임", "🍞": "빵",
"🧸": "인형", "🍓": "딸기", "🌸": "벚꽃", "🍰": "조각 케이크",
"🐾": "발자국", "👑": "왕관", "🦄": "유니콘", "🐰": "토끼",
"🦊": "여우", "🐻": "곰", "🐼": "판다", "🐥": "아기 병아리",
"🦋": "나비", "🌹": "장미", "🌷": "튤립", "🍀": "네잎클로버",
"🍁": "단풍잎", "🌙": "초승달", "⭐": "별", "🌈": "무지개",
"🌋": "화산", "🌊": "파도", "🔮": "수정구슬", "🍬": "사탕",
"🍭": "막대사탕", "🍫": "초콜릿", "🍩": "도넛", "🍪": "쿠키",
"🍨": "아이스크림", "🥞": "팬케이크", "🍎": "빨간 사과",
"🍒": "체리", "🍑": "복숭아", "🍇": "포도", "🧁": "컵케이크",
"🍋": "레몬", "🍌": "바나나", "🥑": "아보카도", "🥕": "당근",
"🍕": "피자", "🍔": "햄버거", "🍟": "감자튀김", "🍿": "팝콘",
"🧂": "소금", "🎈": "풍선", "🎉": "폭죽", "🎬": "슬레이트",
"🎁": "선물", "🎫": "티켓", "🏆": "트로피", "🎨": "팔레트",
"🎤": "마이크", "📱": "휴대전화", "🎼": "높은음자리표",
"🎸": "기타", "🎧": "헤드폰", "🎹": "키보드", "💻": "노트북",
"⌚": "시계", "📷": "카메라", "🔍": "돋보기", "💡": "전구",
"🕯️": "양초", "📜": "두루마리", "🔑": "열쇠", "🔒": "자물쇠",
"🔔": "종", "📣": "메가폰", "📦": "상자", "✉️": "편지",
"📌": "압정", "✂️": "가위", "🩹": "반창고", "🧬": "DNA",
"🧪": "시험관", "🔭": "망원경", "🚀": "로켓", "🛸": "UFO",
"🚲": "자전거", "🛹": "스케이트보드", "⚓": "닻", "⛺": "텐트",
"🧭": "나침반", "🗺️": "세계지도", "🏡": "집", "🏰": "성",
"🎡": "관람차", "🎠": "회전목마", "⛲": "분수", "💎": "보석",
"🪞": "거울", "💄": "립스틱",
} }
export const UnicodeEmojisRegex = new RegExp(
"[" +
Object.keys(UnicodeEmojis).join()
+ "]", "g "
);
export function processDots(input: string): string { export function processDots(input: string): string {
return input.replace(/[\.,]+$/, "") return input.replace(/[\.,]+$/, "")
@ -338,7 +373,6 @@ export function saferKorean(input: string): string {
return FloatKorean.convert(num) + postfix; return FloatKorean.convert(num) + postfix;
} }
}) })
.replace(/[㎡㎢]/g, (content: string) => Units[content as keyof typeof Units])
// Process symbol // Process symbol
.replace(/[\%\^\&\*\#\@\.\-\+\_\=\/\\♡\$\|\:\;\>\<]/g, (t) => ( .replace(/[\%\^\&\*\#\@\.\-\+\_\=\/\\♡\$\|\:\;\>\<]/g, (t) => (
@ -348,7 +382,7 @@ export function saferKorean(input: string): string {
.replace(/[ \t\f\r]+/g, " ") .replace(/[ \t\f\r]+/g, " ")
// Process emoji // Process emoji
.replace(/[↑↓←→↓↔↕↖↗↘↙]/g, "화살표") .replace(UnicodeEmojisRegex, (content: string) => (UnicodeEmojis[content as keyof typeof UnicodeEmojis] ?? content))
.replace(/\p{Emoji}/u, " ") .replace(/\p{Emoji}/u, " ")
.trim() .trim()
} }