Add support for custom emoji in reactions

Signed-off-by: Ajay Bura <ajbura@gmail.com>
This commit is contained in:
Ajay Bura 2022-01-26 12:06:18 +05:30
parent e4f7c6add9
commit 20b99dce48
2 changed files with 33 additions and 5 deletions

View file

@ -147,6 +147,18 @@ function getShortcodeToEmoji(room) {
return allEmoji;
}
function getShortcodeToCustomEmoji(room) {
const allEmoji = new Map();
getRelevantPacks(room).reverse()
.flatMap((pack) => pack.getEmojis())
.forEach((emoji) => {
allEmoji.set(emoji.shortcode, emoji);
});
return allEmoji;
}
// Produces a special list of emoji specifically for auto-completion
//
// This list contains each emoji once, with all emoji being deduplicated by shortcode.
@ -167,5 +179,7 @@ function getEmojiForCompletion(room) {
}
export {
getUserImagePack, getShortcodeToEmoji, getRelevantPacks, getEmojiForCompletion,
getUserImagePack,
getShortcodeToEmoji, getShortcodeToCustomEmoji,
getRelevantPacks, getEmojiForCompletion,
};