PineaFan | 752af46 | 2022-12-31 21:59:38 +0000 | [diff] [blame] | 1 | import Discord, { Client, Interaction } from 'discord.js'; |
PineaFan | 64486c4 | 2022-12-28 09:21:04 +0000 | [diff] [blame] | 2 | import { Logger } from "../utils/log.js"; |
| 3 | import Memory from "../utils/memory.js"; |
| 4 | import type { VerifySchema } from "../reflex/verify.js"; |
| 5 | import { Guilds, History, ModNotes, Premium } from "../utils/database.js"; |
| 6 | import EventScheduler from "../utils/eventScheduler.js"; |
| 7 | import type { RoleMenuSchema } from "../actions/roleMenu.js"; |
PineaFan | 752af46 | 2022-12-31 21:59:38 +0000 | [diff] [blame] | 8 | import config from "../config/main.json" assert { type: "json" }; |
pineafan | 6fb3e07 | 2022-05-20 19:27:23 +0100 | [diff] [blame] | 9 | |
PineaFan | 64486c4 | 2022-12-28 09:21:04 +0000 | [diff] [blame] | 10 | |
| 11 | class NucleusClient extends Client { |
| 12 | logger = Logger; |
PineaFan | 752af46 | 2022-12-31 21:59:38 +0000 | [diff] [blame] | 13 | config: typeof config = config; |
PineaFan | 64486c4 | 2022-12-28 09:21:04 +0000 | [diff] [blame] | 14 | 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 | }; |
PineaFan | df4996f | 2023-01-01 14:20:06 +0000 | [diff] [blame^] | 25 | 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(); |
PineaFan | 64486c4 | 2022-12-28 09:21:04 +0000 | [diff] [blame] | 33 | |
| 34 | constructor(database: typeof NucleusClient.prototype.database) { |
| 35 | super({ intents: 32767 }); |
| 36 | this.database = database; |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | const client = new NucleusClient({ |
| 41 | guilds: new Guilds(), |
| 42 | history: new History(), |
| 43 | notes: new ModNotes(), |
| 44 | premium: new Premium(), |
| 45 | eventScheduler: new EventScheduler() |
| 46 | }); |
pineafan | 6fb3e07 | 2022-05-20 19:27:23 +0100 | [diff] [blame] | 47 | |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 48 | export default client; |
PineaFan | 64486c4 | 2022-12-28 09:21:04 +0000 | [diff] [blame] | 49 | export { NucleusClient }; |