A powerful and extendable Discord bot, with it's own module system :3
thevoid.cafe/projects/voidy
1import { Events } from "discord.js";
2import { Event } from "@voidy/framework";
3import { GuildConfig, type IGuildConfig } from "../schemas/GuildConfig";
4
5export default new Event({
6 id: "guildConfigReady",
7 name: Events.ClientReady,
8 once: true,
9
10 execute: async ({ client }) => {
11 const docs = await GuildConfig.find();
12 const cache = new Map<string, IGuildConfig>();
13
14 for (const doc of docs) {
15 cache.set(doc.guildId, doc.toObject());
16 }
17
18 client.data.set("guildConfig", cache);
19 console.log(`[Guild] Loaded ${cache.size} guild config(s) into cache`);
20 },
21});