refactor Emoji.resolveTokens() to include 🔑 emoji format

This commit is contained in:
Nuno Duque Nunes 2026-06-12 16:49:24 +01:00
parent 3806d8d445
commit c8c79d3eae

View file

@ -88,6 +88,17 @@
},
resolveTokens(text: string): string {
return text.replace(/\{emoji:([^}]+)\}/g, (_, key: string) => Emoji.get(key) || `{emoji:${key}}`)
return text
// Handle <:key:> or <:key:123456> format
.replace(/<:([^:]+):(?:\d*)?>/g, (_, key) => Emoji.get(key) || `<:${key}:>`)
// Handle :key: format (simpler notation in update JSONs)
.replace(/:([a-z0-9_]+):/g, (match, key) => {
const emoji = Emoji.get(key);
return emoji || match; // leave as-is if not found
});
},
// resolveTokens(text: string): string {
// return text.replace(/\{emoji:([^}]+)\}/g, (_, key: string) => Emoji.get(key) || `{emoji:${key}}`)
// },
}