Correctly parse Revolt emojis

This commit is contained in:
Lea 2023-03-15 20:35:11 +01:00
parent bd05736c73
commit 38d58069c8
No known key found for this signature in database
GPG key ID: 1BAFFE8347019C42

View file

@ -13,7 +13,11 @@ async function fetchEmojiList(): Promise<Record<string, string>> {
const start = file.indexOf('...{') + 3; const start = file.indexOf('...{') + 3;
const end = file.indexOf('},') + 1; const end = file.indexOf('},') + 1;
return JSON5.parse(file.substring(start, end).trim()); return JSON5.parse(
file.substring(start, end)
.replace(/^\s*[0-9]+:/gm, (match) => `"${match.replace(/(^\s+)|(:$)/g, '')}":`)
.trim()
);
} }
const emojiUpdate = async () => { const emojiUpdate = async () => {