mirror of
https://github.com/keanuplayz/TravBot-v3.git
synced 2024-08-15 02:33:12 +00:00
Fix the emote registry (again)
This commit is contained in:
parent
5fc65e3c71
commit
389aa35124
1 changed files with 15 additions and 16 deletions
|
@ -2,28 +2,27 @@ import {client} from "../index";
|
||||||
import FileManager from "./storage";
|
import FileManager from "./storage";
|
||||||
import {EmoteRegistryDump} from "../structures";
|
import {EmoteRegistryDump} from "../structures";
|
||||||
|
|
||||||
function updateGlobalEmoteRegistry(): void {
|
async function updateGlobalEmoteRegistry(): Promise<void> {
|
||||||
const data: EmoteRegistryDump = {version: 1, list: []};
|
const data: EmoteRegistryDump = {version: 1, list: []};
|
||||||
|
|
||||||
for (const guild of client.guilds.cache.values()) {
|
for (const guild of client.guilds.cache.values()) {
|
||||||
guild.fetch().then((g) => {
|
let g = await guild.fetch();
|
||||||
for (const emote of g.emojis.cache.values()) {
|
for (const emote of g.emojis.cache.values()) {
|
||||||
data.list.push({
|
data.list.push({
|
||||||
ref: emote.name,
|
ref: emote.name,
|
||||||
id: emote.id,
|
id: emote.id,
|
||||||
name: emote.name,
|
name: emote.name,
|
||||||
requires_colons: emote.requiresColons ?? false,
|
requires_colons: emote.requiresColons ?? false,
|
||||||
animated: emote.animated ?? false,
|
animated: emote.animated ?? false,
|
||||||
url: emote.url,
|
url: emote.url,
|
||||||
guild_id: emote.guild.name,
|
guild_id: emote.guild.name,
|
||||||
guild_name: emote.guild.name
|
guild_name: emote.guild.name
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FileManager.open("data/public"); // generate folder if it doesn't exist
|
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);
|
client.on("emojiCreate", updateGlobalEmoteRegistry);
|
||||||
|
|
Loading…
Reference in a new issue