Skip to content

Commit

Permalink
docs: Update structure and access modifiers
Browse files Browse the repository at this point in the history
Included some modules into a namespace and made some functions and enums private
  • Loading branch information
The Alpha committed Sep 25, 2023
1 parent 5268295 commit 3a8b86f
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 51 deletions.
5 changes: 1 addition & 4 deletions src/core/discordBot.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
/* eslint-disable jsdoc/require-example */
/**
* @file
* @ignore
*/

const { BotCommandDeployment } = require("../entities/command");
const {
Expand Down Expand Up @@ -102,6 +98,7 @@ class DiscordBot {
/**
* Subscribe to the core events.
* @returns {undefined}
* @private
*/
listenToEvents() {
this.client.on(Events.ClientReady, () => ready(this));
Expand Down
9 changes: 3 additions & 6 deletions src/core/logger.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
/**
* @file
* @ignore
*/

/**
* @module Logger
* @private
*/

const { table } = require("table");
Expand Down Expand Up @@ -79,14 +75,15 @@ function logRecords(records, state) {
* @property {Modules} type The module type.
* @property {BotCommandDeployment} deployment The servers deployed to.
* @interface
* @public
* @private
*/

/**
* @typedef {object} FailRecord
* @property {string} path The path of the file that failed to be registered.
* @property {string} message Information about the failure.
* @interface
* @private
*/

module.exports = {
Expand Down
8 changes: 3 additions & 5 deletions src/data/enums.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
/**
* @file
* @ignore
*/

/**
* @module Enums
* @private
*/

/**
Expand All @@ -13,6 +9,7 @@
* @property {"commands"} Commands
* @property {"events"} Events
* @property {"modals"} Modals
* @private
*/
const Modules = Object.freeze({
Commands: "commands",
Expand All @@ -25,6 +22,7 @@ const Modules = Object.freeze({
* @enum {number}
* @property {0} Success
* @property {1} Fail
* @private
*/
const RecordStates = Object.freeze({
Success: 0,
Expand Down
5 changes: 1 addition & 4 deletions src/entities/command.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
/* eslint-disable jsdoc/require-example */
/**
* @file
* @ignore
*/

/**
* @module Command
* @memberof Entities
*/

/**
Expand Down
11 changes: 5 additions & 6 deletions src/entities/event.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
/* eslint-disable jsdoc/require-example */
/**
* @file
* @ignore
*/

/**
* @module Event
* @memberof Entities
*/

const { Events } = require("discord.js");

/**
* @template {keyof ClientEvents} Key
* @template {Events} Key
* @typedef {object} BotEventData
* @property {Key} name The name of the event.
*/

/**
* @template {keyof ClientEvents} Key
* @template {Events} Key
* @callback BotEventFunction
* @param {DiscordBot} bot - The entire bot instance.
* @param {...any} args
Expand Down
6 changes: 1 addition & 5 deletions src/events/interactionCreate.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
/**
* @file
* @ignore
*/

const { applyStyle, asEmbed } = require("../func/style");

/**
* Handler of interactions called by the bot.
* @param {BotCommandInteraction} interaction - The interaction to handle.
* @returns {Promise<undefined>}
* @private
*/
async function interactionCreate(interaction) {
/**
Expand Down
6 changes: 1 addition & 5 deletions src/events/ready.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
/* eslint-disable jsdoc/require-example */
/**
* @file
* @ignore
*/

const { BotCommandDeployment } = require("../entities/command");

Expand All @@ -11,8 +7,8 @@ const { BotCommandDeployment } = require("../entities/command");
* @param {BotCommandData} data - The command data deciding where to register the command.
* @param {BotConfig} guildIds - The container of the server IDs.
* @returns {string} The server ID.
* @private
* @throws {Error} - if data.deployment wasn't of the enum values.
* @private
*/
function getGuildId(data, guildIds) {
const globalGuildId = "0";
Expand Down
6 changes: 1 addition & 5 deletions src/func/colour.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
/**
* @file
* @ignore
*/

/**
* @module Colour
* @memberof Func
*/

/**
Expand Down
7 changes: 1 addition & 6 deletions src/func/style.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
/**
* @file
* @ignore
*/

/**
* @module Style
* @memberof Func
*/

const { APIEmbed } = require("discord.js");
Expand All @@ -15,7 +11,6 @@ const { asNumber } = require("./colour");
* @param {string} text - The original text.
* @param {{name:string,colour:number,logoUrl:URL}} brand - The brand to style the embed with.
* @returns {APIEmbed} The resulting embed.
* @private
* @example
* const brand = {colour: 0xffffff};
* const result = asEmbed("halfbot", brand);
Expand Down
6 changes: 1 addition & 5 deletions src/func/url.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
/**
* @file
* @ignore
*/

/**
* @module Url
* @memberof Func
*/

/**
Expand Down

0 comments on commit 3a8b86f

Please sign in to comment.