Merge pull request #4029 from thelounge/xpaw/emoji-dahes

Replace dashes to underscores in emoji autocompletion
This commit is contained in:
Pavel Djundik 2020-08-14 10:39:45 +03:00 committed by GitHub
commit 2d88ae7503
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 5 deletions

View File

@ -613,7 +613,7 @@
"dragon_face": "🐲",
"dragon": "🐉",
"sauropod": "🦕",
"t-rex": "🦖",
"t_rex": "🦖",
"whale": "🐳",
"whale2": "🐋",
"dolphin": "🐬",
@ -1082,7 +1082,7 @@
"game_die": "🎲",
"jigsaw": "🧩",
"teddy_bear": "🧸",
"pi_ata": "🪅",
"pinata": "🪅",
"nesting_dolls": "🪆",
"spades": "♠️",
"hearts": "♥️",
@ -1240,7 +1240,7 @@
"chart": "💹",
"email": "✉️",
"envelope": "✉️",
"e-mail": "📧",
"e_mail": "📧",
"incoming_envelope": "📨",
"envelope_with_arrow": "📩",
"outbox_tray": "📤",
@ -1376,7 +1376,7 @@
"no_bicycles": "🚳",
"no_smoking": "🚭",
"do_not_litter": "🚯",
"non-potable_water": "🚱",
"non_potable_water": "🚱",
"no_pedestrians": "🚷",
"no_mobile_phones": "📵",
"underage": "🔞",

View File

@ -19,7 +19,14 @@ const emojiModifiersRegex = /[\u{1f3fb}-\u{1f3ff}]|\u{fe0f}/gu;
const cleanEmoji = emoji.emoji.replace(emojiModifiersRegex, "");
fullNameEmojiMap[cleanEmoji] = emoji.description;
for (const alias of emoji.aliases) {
for (let alias of emoji.aliases) {
if (alias !== "-1") {
// Replace dashes to underscores except for :-1:
// This removes autocompletion prompt for :-P
// prompting for :non-potable_water:
alias = alias.replace(/-/g, "_");
}
emojiMap[alias] = emoji.emoji;
}
}