refactor Emoji.resolveTokens() to include 🔑 emoji format
This commit is contained in:
parent
3806d8d445
commit
c8c79d3eae
1 changed files with 12 additions and 1 deletions
|
|
@ -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}}`)
|
||||
// },
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue