attempt #1 to fix Emoji.resolveTokens()
This commit is contained in:
parent
c8c79d3eae
commit
f97a77a5e9
1 changed files with 13 additions and 8 deletions
|
|
@ -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 {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue