-
Notifications
You must be signed in to change notification settings - Fork 1
π€ Bot
Amgelo563 edited this page Apr 12, 2022
·
6 revisions
The main Bot class represents a fully workable bot, with its respective Discord Client, CommandManager, EventManager, ScheduleManager, Tracer logger and Prisma client. This is where all the action begins.
const myBot = new Bot(ClientOptions, LoggerConfig, BotOptions);
myBot.start().then((bot) => bot.logger.info("Bot started!"));
- ClientOptions - Options passed to Discord.js to create the Bot's Client.
- LoggerConfig - Options passed to Tracer to create the Bot's Logger.
- BotOptions - Custom options for this bot.
The bot instance is passed to every manager, so you can access it basically anywhere like commands, events and schedules.
export default class Bot {
/** The options passed to create this bot */
readonly options: BotOptions;
/** The Discord Client for this bot */
readonly client: Client<true>;
/** The CommandManager for this bot */
readonly commands: CommandManager;
/** The EventManager for this bot */
readonly events: EventManager;
/** The ScheduleManager for this bot */
readonly schedules: ScheduleManager;
/** The Logger for this bot */
readonly logger: Tracer.Logger;
/** The Prisma client for this bot */
readonly prisma: PrismaClient;
/** Start this bot */
public async start(): Promise<Bot>;
}
/** Options for creating a bot */
export interface BotOptions {
/** Spooky */
token: string,
/** The prefixes for this bot's message commands */
prefixes: string[],
/** Whether to force load the application commands to Discord */
loadApplication: boolean,
/** The url to this bot's database */
database: string,
/** The path to this bot's commands */
commandsPath: string,
/** The path to this bot's events */
eventsPath: string,
/** The path to this bot's schedules */
schedulesPath: string,
}