@@ -24,7 +24,9 @@ import { SlashCommandBuilder } from "@discordjs/builders";
2424 *
2525 * @example
2626 * ```ts
27- * import { InteractionRouter } from 'discord.https/router';
27+ * // utility/ping.js
28+ *
29+ * import { InteractionRouter } from 'discord.https/router';
2830 * const router = new InteractionRouter();
2931 * export deafult router.command(
3032 * (builder) => builder.setName("Ping!").setDescription("Returns Pong!"),
@@ -88,7 +90,7 @@ class InteractionRouter {
8890 *
8991 * This does **not** affect other routers or collectors.
9092 *
91- * @param fns Async middleware functions.
93+ * @param fns Async middleware functions. See { @link GenericMiddleware} for callback parameters
9294 */
9395
9496 middleware ( ...fns : GeneralMiddleware [ ] ) {
@@ -108,7 +110,7 @@ class InteractionRouter {
108110 * ```
109111 *
110112 * @param commandbuilder - Function returning a {@link SlashCommandBuilder}.
111- * @param fns - Middleware functions for the command .
113+ * @param fns { @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function | Async } functions. See { @link GenericMiddleware } for callback parameters .
112114 * @returns An {@link AutoCompleteKeyBuilder} for autocomplete options.
113115 */
114116 command ( commandbuilder : CommandbuilderType , ...fns : CommandMiddleware [ ] ) {
@@ -126,6 +128,7 @@ class InteractionRouter {
126128 /**
127129 * Registers a button interaction with its associated middleware.
128130 *
131+ * @param fns {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function | Async } functions. See {@link GenericMiddleware } for callback parameters.
129132 * @example
130133 * ```ts
131134 * router.button("custom_button_id", buttonMiddleware);
@@ -139,6 +142,7 @@ class InteractionRouter {
139142 /**
140143 * Registers a modal interaction with its associated middleware.
141144 *
145+ * @param fns {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function | Async } functions. See {@link GenericMiddleware } for callback parameters.
142146 * @example
143147 * ```ts
144148 * router.modal("custom_modal_id", modalMiddleware);
@@ -152,6 +156,7 @@ class InteractionRouter {
152156 /**
153157 * Registers a role select interaction with its associated middleware.
154158 *
159+ * @param fns {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function | Async } functions. See {@link GenericMiddleware } for callback parameters.
155160 * @example
156161 * ```ts
157162 * router.roleSelect("roleSelectName", roleSelectMiddleware);
@@ -165,6 +170,7 @@ class InteractionRouter {
165170 /**
166171 * Registers a user select interaction with its associated middleware.
167172 *
173+ * @param fns {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function | Async } functions. See {@link GenericMiddleware } for callback parameters.
168174 * @example
169175 * ```ts
170176 * router.userSelect("userSelectName", userSelectMiddleware);
@@ -177,6 +183,7 @@ class InteractionRouter {
177183 /**
178184 * Registers a string select interaction with its associated middleware.
179185 *
186+ * @param fns {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function | Async } functions. See {@link GenericMiddleware } for callback parameters.
180187 * @example
181188 * ```ts
182189 * router.stringSelect("stringSelectName", stringSelectMiddleware);
@@ -190,6 +197,7 @@ class InteractionRouter {
190197 /**
191198 * Registers a channel select interaction with its associated middleware.
192199 *
200+ * @param fns {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function | Async } functions. See {@link GenericMiddleware } for callback parameters.
193201 * @example
194202 * ```ts
195203 * router.channelSelect("channelSelectName", channelSelectMiddleware);
@@ -203,6 +211,7 @@ class InteractionRouter {
203211 /**
204212 * Registers a mentionable select interaction with its associated middleware.
205213 *
214+ * @param fns {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function | Async } functions. See {@link GenericMiddleware } for callback parameters.
206215 * @example
207216 * ```ts
208217 * router.mentionableSelect("mentionableSelectName", mentionableSelectMiddleware);
@@ -216,18 +225,19 @@ class InteractionRouter {
216225 /**
217226 * Registers an autocomplete interaction with its associated middleware.
218227 *
228+ * @param fns {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function | Async } functions. See {@link GenericMiddleware } for callback parameters.
219229 * @example
220230 * ```ts
221231 * const githubQuery = router.command(
222232 * (builder) =>
223233 * builder
224- * .setName("weather") // The command name
225- * .setDescription("QuQuery weather information!") // The command description
234+ * .setName("weather")
235+ * .setDescription("Query weather information!")
226236 * .addStringOption(option =>
227237 * option
228- * .setName("city") // Option name
229- * .setDescription("City to get the weather for") // Option description
230- * .setAutocomplete(true) // Enable autocomplete for this option
238+ * .setName("city")
239+ * .setDescription("City to get the weather for")
240+ * .setAutocomplete(true)
231241 * ),
232242 * (interaction) => handler
233243 * );
@@ -249,6 +259,7 @@ class InteractionRouter {
249259 /**
250260 * Registers a user context menu interaction with its associated middleware.
251261 *
262+ * @param fns {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function | Async } functions. See {@link GenericMiddleware } for callback parameters.
252263 * @example
253264 * ```ts
254265 * router.userContextMenu("userContextMenuId", userContextMenuMiddleware);
@@ -262,6 +273,7 @@ class InteractionRouter {
262273 /**
263274 * Registers a message context menu interaction with its associated middleware.
264275 *
276+ * @param fns {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function | Async } functions. See {@link GenericMiddleware } for callback parameters.
265277 * @example
266278 * ```ts
267279 * router.messageContextMenu("messageContextMenu", messageContextMenuMiddleware);
@@ -296,19 +308,25 @@ class InteractionRouter {
296308/**
297309 * Collector for InteractionRouter.
298310 *
299- * @example
311+ *
312+ * @example
313+ *
314+ * Example: Organizing multiple interaction routes with a collector.
315+ *
300316 * ```ts
301- * import { InteractionRouter, InteractionRouterCollector } from ' discord.https/router' ;
317+ * import { InteractionRouterCollector } from " discord.https/router" ;
302318 *
303- * const router = new InteractionRouter()
304- * router.command(
305- * (builder) => builder.setName("Ping!").setDescription("Returns Pong!")
306- * (interaction) => interaction.reply({
307- * content: "pong!"
308- * })
309- * )
310- * // Register routes
311- * InteractionRouterCollector.register(router);
319+ * // Recommend using PascalCase and ending with the 'Route' suffix
320+ * // for variable naming convention
321+ *
322+ * import PingRoute from "./ping.js";
323+ * import GithubRoute from "./github.js";
324+ *
325+ *
326+ * export default new InteractionRouterCollector().register(
327+ * PingRoute,
328+ * GithubRoute
329+ * );
312330 * ```
313331 */
314332
0 commit comments