Added new API comments (part 3)

This commit is contained in:
DJj123dj
2025-01-09 19:42:11 +01:00
parent ce0af7e1e9
commit 02e8b7d0a1
2 changed files with 88 additions and 3 deletions
+20 -2
View File
@@ -8,12 +8,21 @@ import { ODButtonResponderInstance } from "./responder"
import * as discord from "discord.js"
import { ODWorkerManager } from "./worker"
export type ODVerifyBarCallback = (responder:ODButtonResponderInstance,customData?:string) => void|Promise<void>
/**## ODVerifyBar `class`
* This is an open ticket verifybar.
*
* It is contains 2 sets of workers and a lot of utilities for the (✅ ❌) verifybars in the bot.
*
* It doesn't contain the code which activates or spawns the verifybars!
*/
export class ODVerifyBar extends ODManagerData {
/**All workers that will run when the verifybar is accepted. */
success: ODWorkerManager<ODButtonResponderInstance,"verifybar",{data:string|null,verifybarMessage:discord.Message<boolean>|null}>
/**All workers that will run when the verifybar is stopped. */
failure: ODWorkerManager<ODButtonResponderInstance,"verifybar",{data:string|null,verifybarMessage:discord.Message<boolean>|null}>
/**The message that will be built wen activating this verifybar. */
message: ODMessage<"verifybar",{guild:discord.Guild|null,channel:discord.TextBasedChannel,user:discord.User,verifybar:ODVerifyBar,originalMessage:discord.Message<boolean>}>
/**When disabled, it will skip the verifybar and instantly fire the `success` workers. */
enabled: boolean
constructor(id:ODValidId, message:ODMessage<"verifybar",{guild:discord.Guild|null,channel:discord.TextBasedChannel,user:discord.User,originalMessage:discord.Message<boolean>}>, enabled?:boolean){
@@ -24,6 +33,7 @@ export class ODVerifyBar extends ODManagerData {
this.enabled = enabled ?? true
}
/**Build the message and reply to a button with this verifybar. */
async activate(responder:ODButtonResponderInstance){
if (this.enabled){
//show verifybar
@@ -36,6 +46,14 @@ export class ODVerifyBar extends ODManagerData {
}
}
/**## ODVerifyBarManager `class`
* This is an open ticket verifybar manager.
*
* It contains all (✅ ❌) verifybars in the bot.
* The `ODVerifyBar` classes contain `ODWorkerManager`'s that will be fired when the continue/stop buttons are pressed.
*
* It doesn't contain the code which activates the verifybars! This should be implemented by your own.
*/
export class ODVerifyBarManager extends ODManager<ODVerifyBar> {
constructor(debug:ODDebugger){
super(debug,"verifybar")