attempt #1 to fix Emoji.resolveTokens()

This commit is contained in:
Nuno Duque Nunes 2026-06-12 16:55:25 +01:00
parent c8c79d3eae
commit f97a77a5e9

View file

@ -87,15 +87,20 @@
_map = null; _map = null;
}, },
// resolveTokens(text: string): string {
// 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 { resolveTokens(text: string): string {
return text // Only replace <:key:> pattern (no ID) — leave real Discord emojis untouched
// Handle <:key:> or <:key:123456> format return text.replace(/<:([^:]+):>/g, (_, key) => Emoji.get(key) || `<:${key}:>`);
.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 { // resolveTokens(text: string): string {