diff --git a/src/handler/sern.ts b/src/handler/sern.ts index fa7dec9..a051975 100644 --- a/src/handler/sern.ts +++ b/src/handler/sern.ts @@ -54,7 +54,12 @@ export class Handler { await interaction.reply(res); }) } - + /** + * + * @param {Files.CommandVal | undefined} module command file information + * @param {CommandInteraction} interaction a Discord.js command interaction + * @returns {possibleOutput | undefined} takes return value and replies it, if possible input + */ private async interactionResult( module: Files.CommandVal | undefined, interaction: CommandInteraction): Promise { @@ -70,7 +75,13 @@ export class Handler { const fn = await module.mod.delegate(context, parsedArgs); return fn?.val; } - + /** + * + * @param {Files.CommandVal | undefined} module command file information + * @param {Message} message a message object + * @param {string} args anything after the command + * @returns takes return value and replies it, if possible input + */ private async commandResult(module: Files.CommandVal | undefined, message: Message, args: string): Promise { if (module?.mod === undefined) return "Unknown legacy command"; if (module.mod.type === CommandType.SLASH) return `This may be a slash command and not a legacy command` @@ -118,17 +129,15 @@ export class Handler { } + /** * An object to be passed into Sern.Handler constructor. - * ```ts - * new Sern.Handler({ - * client, // Discord.js client instance - * prefix : "!", // an example prefix - * commands: "", //commands directory - * init : () => console.log("Bot is ready") // function called on ready - * privateServerId : "" // a server id that can be used for private or test server - * }) - * ``` + * @typedef {object} Wrapper + * @property {readonly Client} client + * @property {readonly string} prefix + * @property {readonly string} commands + * @prop {(handler : Handler) => void)} init + * @property {readonly {test: boolean, id: string}[]} privateServers */ export interface Wrapper { readonly client: Client, diff --git a/src/handler/utils/ctxHandler.ts b/src/handler/utils/ctxHandler.ts index 16377d1..53bc617 100644 --- a/src/handler/utils/ctxHandler.ts +++ b/src/handler/utils/ctxHandler.ts @@ -1,7 +1,7 @@ import type { Message } from "discord.js"; export class CtxHandler { - + static isBot(message: Message) { return message.author.bot; }