Refactor to more consistent structure (e.g. "plugins")
This commit is contained in:
32
plugin.ts
Normal file
32
plugin.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import type { ChatInputCommandInteraction, Client, SlashCommandBuilder } from "discord.js";
|
||||
import type { Sequelize } from "sequelize";
|
||||
|
||||
export interface Settings {
|
||||
// Main Discord client object
|
||||
client: Client;
|
||||
// Database access object
|
||||
database: Sequelize;
|
||||
}
|
||||
|
||||
export interface Command {
|
||||
data: SlashCommandBuilder;
|
||||
execute: (iteraction: ChatInputCommandInteraction) => Promise<void>;
|
||||
}
|
||||
|
||||
export interface Plugin {
|
||||
start: () => Promise<void>;
|
||||
stop: () => Promise<void>;
|
||||
commands: Command[]
|
||||
}
|
||||
|
||||
export class BasePlugin implements Plugin {
|
||||
settings: Settings;
|
||||
commands: Command[]
|
||||
|
||||
constructor(settings: Settings) {
|
||||
this.settings = settings;
|
||||
}
|
||||
|
||||
async start() {}
|
||||
async stop() {}
|
||||
}
|
||||
Reference in New Issue
Block a user