diff --git a/src/modules/emoteRegistry.ts b/src/modules/emoteRegistry.ts index 6b22235..a7a6c6e 100644 --- a/src/modules/emoteRegistry.ts +++ b/src/modules/emoteRegistry.ts @@ -2,28 +2,27 @@ import {client} from "../index"; import FileManager from "./storage"; import {EmoteRegistryDump} from "../structures"; -function updateGlobalEmoteRegistry(): void { +async function updateGlobalEmoteRegistry(): Promise { const data: EmoteRegistryDump = {version: 1, list: []}; for (const guild of client.guilds.cache.values()) { - guild.fetch().then((g) => { - for (const emote of g.emojis.cache.values()) { - data.list.push({ - ref: emote.name, - id: emote.id, - name: emote.name, - requires_colons: emote.requiresColons ?? false, - animated: emote.animated ?? false, - url: emote.url, - guild_id: emote.guild.name, - guild_name: emote.guild.name - }); - } - }); + let g = await guild.fetch(); + for (const emote of g.emojis.cache.values()) { + data.list.push({ + ref: emote.name, + id: emote.id, + name: emote.name, + requires_colons: emote.requiresColons ?? false, + animated: emote.animated ?? false, + url: emote.url, + guild_id: emote.guild.name, + guild_name: emote.guild.name + }); + } } FileManager.open("data/public"); // generate folder if it doesn't exist - FileManager.write("public/emote-registry", data, true); + FileManager.write("public/emote-registry", data, false); } client.on("emojiCreate", updateGlobalEmoteRegistry);