blob: 61cf3bf22bc0bce811f11db3d0ac39acd1a952a0 [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";
PineaFan752af462022-12-31 21:59:38 +00008import config from "../config/main.json" assert { type: "json" };
pineafan6fb3e072022-05-20 19:27:23 +01009
PineaFan64486c42022-12-28 09:21:04 +000010
11class NucleusClient extends Client {
12 logger = Logger;
PineaFan752af462022-12-31 21:59:38 +000013 config: typeof config = config;
PineaFan64486c42022-12-28 09:21:04 +000014 verify: Record<string, VerifySchema> = {};
15 roleMenu: Record<string, RoleMenuSchema> = {};
16 memory: Memory = new Memory() as Memory;
17 noLog: string[] = [];
18 database: {
19 guilds: Guilds;
20 history: History;
21 notes: ModNotes;
22 premium: Premium;
23 eventScheduler: EventScheduler;
24 };
PineaFandf4996f2023-01-01 14:20:06 +000025 commands: Record<string, {
26 command: Discord.SlashCommandBuilder |
27 ((builder: Discord.SlashCommandBuilder) => Discord.SlashCommandBuilder) |
28 Discord.SlashCommandSubcommandBuilder | ((builder: Discord.SlashCommandSubcommandBuilder) => Discord.SlashCommandSubcommandBuilder) | Discord.SlashCommandSubcommandGroupBuilder | ((builder: Discord.SlashCommandSubcommandGroupBuilder) => Discord.SlashCommandSubcommandGroupBuilder),
29 callback: (interaction: Interaction) => Promise<void>,
30 check: (interaction: Interaction) => Promise<boolean> | boolean
31 }> = {};
32 // commands: Discord.Collection<string, [Function, Function]> = new Discord.Collection();
PineaFan64486c42022-12-28 09:21:04 +000033
34 constructor(database: typeof NucleusClient.prototype.database) {
35 super({ intents: 32767 });
36 this.database = database;
37 }
38}
39
40const client = new NucleusClient({
41 guilds: new Guilds(),
42 history: new History(),
43 notes: new ModNotes(),
44 premium: new Premium(),
45 eventScheduler: new EventScheduler()
46});
pineafan6fb3e072022-05-20 19:27:23 +010047
Skyler Grey75ea9172022-08-06 10:22:23 +010048export default client;
PineaFan64486c42022-12-28 09:21:04 +000049export { NucleusClient };