blob: 53267f2f40ab565e9329eb5af99529654156e670 [file] [log] [blame]
PineaFan752af462022-12-31 21:59:38 +00001import Discord, { Client, Interaction } from 'discord.js';
PineaFan64486c42022-12-28 09:21:04 +00002import { Logger } from "../utils/log.js";
3import Memory from "../utils/memory.js";
4import type { VerifySchema } from "../reflex/verify.js";
5import { Guilds, History, ModNotes, Premium } from "../utils/database.js";
6import EventScheduler from "../utils/eventScheduler.js";
7import type { RoleMenuSchema } from "../actions/roleMenu.js";
PineaFan100df682023-01-02 13:26:08 +00008// @ts-expect-error
PineaFan752af462022-12-31 21:59:38 +00009import config from "../config/main.json" assert { type: "json" };
pineafan6fb3e072022-05-20 19:27:23 +010010
PineaFan64486c42022-12-28 09:21:04 +000011
12class NucleusClient extends Client {
13 logger = Logger;
PineaFan752af462022-12-31 21:59:38 +000014 config: typeof config = config;
PineaFan64486c42022-12-28 09:21:04 +000015 verify: Record<string, VerifySchema> = {};
16 roleMenu: Record<string, RoleMenuSchema> = {};
17 memory: Memory = new Memory() as Memory;
18 noLog: string[] = [];
19 database: {
20 guilds: Guilds;
21 history: History;
22 notes: ModNotes;
23 premium: Premium;
24 eventScheduler: EventScheduler;
25 };
PineaFandf4996f2023-01-01 14:20:06 +000026 commands: Record<string, {
27 command: Discord.SlashCommandBuilder |
28 ((builder: Discord.SlashCommandBuilder) => Discord.SlashCommandBuilder) |
29 Discord.SlashCommandSubcommandBuilder | ((builder: Discord.SlashCommandSubcommandBuilder) => Discord.SlashCommandSubcommandBuilder) | Discord.SlashCommandSubcommandGroupBuilder | ((builder: Discord.SlashCommandSubcommandGroupBuilder) => Discord.SlashCommandSubcommandGroupBuilder),
30 callback: (interaction: Interaction) => Promise<void>,
31 check: (interaction: Interaction) => Promise<boolean> | boolean
32 }> = {};
33 // commands: Discord.Collection<string, [Function, Function]> = new Discord.Collection();
PineaFan64486c42022-12-28 09:21:04 +000034
35 constructor(database: typeof NucleusClient.prototype.database) {
36 super({ intents: 32767 });
37 this.database = database;
38 }
39}
40
41const client = new NucleusClient({
PineaFan100df682023-01-02 13:26:08 +000042 guilds: await new Guilds().setup(),
PineaFan64486c42022-12-28 09:21:04 +000043 history: new History(),
44 notes: new ModNotes(),
45 premium: new Premium(),
46 eventScheduler: new EventScheduler()
47});
pineafan6fb3e072022-05-20 19:27:23 +010048
Skyler Grey75ea9172022-08-06 10:22:23 +010049export default client;
PineaFan64486c42022-12-28 09:21:04 +000050export { NucleusClient };