(v4.2) Open Discord Framework Update (Part 1)
This commit is contained in:
+10
-32
@@ -1,34 +1,7 @@
|
||||
//MAIN MODULE
|
||||
export * from "./main"
|
||||
//EXPORT FRAMEWORK
|
||||
export * from "@open-discord-bots/framework/api"
|
||||
|
||||
//BASE MODULES
|
||||
export * from "./modules/base"
|
||||
export * from "./modules/event"
|
||||
export * from "./modules/config"
|
||||
export * from "./modules/database"
|
||||
export * from "./modules/language"
|
||||
export * from "./modules/flag"
|
||||
export * from "./modules/console"
|
||||
export * from "./modules/defaults"
|
||||
export * from "./modules/plugin"
|
||||
export * from "./modules/checker"
|
||||
export * from "./modules/client"
|
||||
export * from "./modules/worker"
|
||||
export * from "./modules/builder"
|
||||
export * from "./modules/responder"
|
||||
export * from "./modules/action"
|
||||
export * from "./modules/permission"
|
||||
export * from "./modules/helpmenu"
|
||||
export * from "./modules/session"
|
||||
export * from "./modules/stat"
|
||||
export * from "./modules/code"
|
||||
export * from "./modules/cooldown"
|
||||
export * from "./modules/post"
|
||||
export * from "./modules/verifybar"
|
||||
export * from "./modules/progressbar"
|
||||
export * from "./modules/startscreen"
|
||||
|
||||
//OPENTICKET DEFAULT MODULES
|
||||
//EXPORT DEFAULT MODULES
|
||||
export * from "./defaults/base"
|
||||
export * from "./defaults/event"
|
||||
export * from "./defaults/config"
|
||||
@@ -52,8 +25,10 @@ export * from "./defaults/post"
|
||||
export * from "./defaults/progressbar"
|
||||
export * from "./defaults/startscreen"
|
||||
export * from "./defaults/console"
|
||||
export * from "./defaults/verifybar"
|
||||
export * from "./defaults/fuse"
|
||||
|
||||
//OPENTICKET MODULES
|
||||
//EXPORT OPENTICKET MODULES
|
||||
export * from "./openticket/question"
|
||||
export * from "./openticket/option"
|
||||
export * from "./openticket/panel"
|
||||
@@ -61,4 +36,7 @@ export * from "./openticket/ticket"
|
||||
export * from "./openticket/blacklist"
|
||||
export * from "./openticket/transcript"
|
||||
export * from "./openticket/role"
|
||||
export * from "./openticket/priority"
|
||||
export * from "./openticket/priority"
|
||||
|
||||
//EXPORT MAIN MODULE
|
||||
export { ODOpenTicketMain } from "./main"
|
||||
@@ -1,14 +1,12 @@
|
||||
///////////////////////////////////////
|
||||
//DEFAULT ACTION MODULE
|
||||
///////////////////////////////////////
|
||||
import { ODValidId } from "../modules/base"
|
||||
import { ODAction, ODActionManager } from "../modules/action"
|
||||
import * as api from "@open-discord-bots/framework/api"
|
||||
import { ODWorkerManager_Default } from "./worker"
|
||||
import * as discord from "discord.js"
|
||||
import { ODRoleOption, ODTicketOption } from "../openticket/option"
|
||||
import { ODTicket, ODTicketClearFilter } from "../openticket/ticket"
|
||||
import { ODTranscriptCompiler, ODTranscriptCompilerCompileResult } from "../openticket/transcript"
|
||||
import { ODMessageBuildSentResult } from "../modules/builder"
|
||||
import { ODRole, ODRoleUpdateMode, ODRoleUpdateResult } from "../openticket/role"
|
||||
import { ODPriorityLevel } from "../openticket/priority"
|
||||
|
||||
@@ -26,7 +24,7 @@ export interface ODActionManagerIds_Default {
|
||||
"opendiscord:create-transcript":{
|
||||
source:"slash"|"text"|"ticket-message"|"reopen-message"|"close-message"|"autoclose-message"|"autodelete"|"clear"|"other",
|
||||
params:{guild:discord.Guild,channel:discord.GuildTextBasedChannel,user:discord.User,ticket:ODTicket},
|
||||
result:{compiler:ODTranscriptCompiler<any,object|null>, success:boolean, result:ODTranscriptCompilerCompileResult<any>, errorReason:string|null, pendingMessage:ODMessageBuildSentResult<true>|null, initData:object|null, participants:{user:discord.User,role:"creator"|"participant"|"admin"}[]},
|
||||
result:{compiler:ODTranscriptCompiler<any,object|null>, success:boolean, result:ODTranscriptCompilerCompileResult<any>, errorReason:string|null, pendingMessage:api.ODMessageBuildSentResult<true>|null, initData:object|null, participants:{user:discord.User,role:"creator"|"participant"|"admin"}[]},
|
||||
workers:"opendiscord:select-compiler"|"opendiscord:init-transcript"|"opendiscord:compile-transcript"|"opendiscord:ready-transcript"|"opendiscord:logs"
|
||||
},
|
||||
"opendiscord:create-ticket":{
|
||||
@@ -139,25 +137,25 @@ export interface ODActionManagerIds_Default {
|
||||
*
|
||||
* This default class is made for the global variable `opendiscord.actions`!
|
||||
*/
|
||||
export class ODActionManager_Default extends ODActionManager {
|
||||
export class ODActionManager_Default extends api.ODActionManager {
|
||||
get<ActionId extends keyof ODActionManagerIds_Default>(id:ActionId): ODAction_Default<ODActionManagerIds_Default[ActionId]["source"],ODActionManagerIds_Default[ActionId]["params"],ODActionManagerIds_Default[ActionId]["result"],ODActionManagerIds_Default[ActionId]["workers"]>
|
||||
get(id:ODValidId): ODAction<string,any,any>|null
|
||||
get(id:api.ODValidId): api.ODAction<string,any,any>|null
|
||||
|
||||
get(id:ODValidId): ODAction<string,any,any>|null {
|
||||
get(id:api.ODValidId): api.ODAction<string,any,any>|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<ActionId extends keyof ODActionManagerIds_Default>(id:ActionId): ODAction_Default<ODActionManagerIds_Default[ActionId]["source"],ODActionManagerIds_Default[ActionId]["params"],ODActionManagerIds_Default[ActionId]["result"],ODActionManagerIds_Default[ActionId]["workers"]>
|
||||
remove(id:ODValidId): ODAction<string,any,any>|null
|
||||
remove(id:api.ODValidId): api.ODAction<string,any,any>|null
|
||||
|
||||
remove(id:ODValidId): ODAction<string,any,any>|null {
|
||||
remove(id:api.ODValidId): api.ODAction<string,any,any>|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODActionManagerIds_Default): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
}
|
||||
@@ -168,6 +166,6 @@ export class ODActionManager_Default extends ODActionManager {
|
||||
*
|
||||
* This default class is made for the default `ODAction`'s!
|
||||
*/
|
||||
export class ODAction_Default<Source extends string, Params extends object, Result extends object, WorkerIds extends string> extends ODAction<Source,Params,Result> {
|
||||
export class ODAction_Default<Source extends string, Params extends object, Result extends object, WorkerIds extends string> extends api.ODAction<Source,Params,Result> {
|
||||
declare workers: ODWorkerManager_Default<Result,Source,Params,WorkerIds>
|
||||
}
|
||||
@@ -1,18 +1,18 @@
|
||||
///////////////////////////////////////
|
||||
//BASE MODULE
|
||||
///////////////////////////////////////
|
||||
import { ODVersion, ODVersionManager, ODValidId } from "../modules/base"
|
||||
import * as api from "@open-discord-bots/framework/api"
|
||||
|
||||
/**## ODVersionManagerIds_Default `interface`
|
||||
* This interface is a list of ids available in the `ODVersionManager` class.
|
||||
* It's used to generate typescript declarations for this class.
|
||||
*/
|
||||
export interface ODVersionManagerIds_Default {
|
||||
"opendiscord:version":ODVersion,
|
||||
"opendiscord:last-version":ODVersion,
|
||||
"opendiscord:api":ODVersion,
|
||||
"opendiscord:transcripts":ODVersion,
|
||||
"opendiscord:livestatus":ODVersion
|
||||
"opendiscord:version":api.ODVersion,
|
||||
"opendiscord:last-version":api.ODVersion,
|
||||
"opendiscord:api":api.ODVersion,
|
||||
"opendiscord:transcripts":api.ODVersion,
|
||||
"opendiscord:livestatus":api.ODVersion
|
||||
}
|
||||
|
||||
/**## ODFlagManager_Default `default_class`
|
||||
@@ -21,25 +21,25 @@ export interface ODVersionManagerIds_Default {
|
||||
*
|
||||
* This default class is made for the global variable `opendiscord.flags`!
|
||||
*/
|
||||
export class ODVersionManager_Default extends ODVersionManager {
|
||||
export class ODVersionManager_Default extends api.ODVersionManager {
|
||||
get<VersionId extends keyof ODVersionManagerIds_Default>(id:VersionId): ODVersionManagerIds_Default[VersionId]
|
||||
get(id:ODValidId): ODVersion|null
|
||||
get(id:api.ODValidId): api.ODVersion|null
|
||||
|
||||
get(id:ODValidId): ODVersion|null {
|
||||
get(id:api.ODValidId): api.ODVersion|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<VersionId extends keyof ODVersionManagerIds_Default>(id:VersionId): ODVersionManagerIds_Default[VersionId]
|
||||
remove(id:ODValidId): ODVersion|null
|
||||
remove(id:api.ODValidId): api.ODVersion|null
|
||||
|
||||
remove(id:ODValidId): ODVersion|null {
|
||||
remove(id:api.ODValidId): api.ODVersion|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODVersionManagerIds_Default): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
}
|
||||
@@ -1,19 +1,16 @@
|
||||
///////////////////////////////////////
|
||||
//DEFAULT BUILDER MODULE
|
||||
///////////////////////////////////////
|
||||
import { ODValidButtonColor, ODValidId } from "../modules/base"
|
||||
import { ODBuilderManager, ODButton, ODButtonInstance, ODButtonManager, ODDropdown, ODDropdownInstance, ODDropdownManager, ODEmbed, ODEmbedInstance, ODEmbedManager, ODFile, ODFileInstance, ODFileManager, ODMessage, ODMessageInstance, ODMessageManager, ODModal, ODModalInstance, ODModalManager } from "../modules/builder"
|
||||
import * as api from "@open-discord-bots/framework/api"
|
||||
import { ODWorkerManager_Default } from "./worker"
|
||||
import { ODTicket, ODTicketClearFilter } from "../openticket/ticket"
|
||||
import { ODPermissionEmbedType } from "../defaults/permission"
|
||||
import { ODTextCommandErrorInvalidOption, ODTextCommandErrorMissingOption, ODTextCommandErrorUnknownCommand } from "../modules/client"
|
||||
import { ODPanel } from "../openticket/panel"
|
||||
import { ODRoleOption, ODTicketOption, ODWebsiteOption } from "../openticket/option"
|
||||
import { ODVerifyBar } from "../modules/verifybar"
|
||||
import * as discord from "discord.js"
|
||||
import { ODPermissionEmbedType } from "./permission"
|
||||
import { ODTranscriptCompiler, ODTranscriptCompilerCompileResult } from "../openticket/transcript"
|
||||
import { ODRoleOption, ODTicketOption, ODWebsiteOption } from "../openticket/option"
|
||||
import { ODTicket, ODTicketClearFilter } from "../openticket/ticket"
|
||||
import { ODRole, ODRoleUpdateResult } from "../openticket/role"
|
||||
import { ODPriorityLevel } from "../openticket/priority"
|
||||
import { ODPanel } from "../openticket/panel"
|
||||
import * as discord from "discord.js"
|
||||
|
||||
/**## ODBuilderManager_Default `default_class`
|
||||
* This is a special class that adds type definitions & typescript to the ODBuilderManager class.
|
||||
@@ -21,7 +18,7 @@ import { ODPriorityLevel } from "../openticket/priority"
|
||||
*
|
||||
* This default class is made for the global variable `opendiscord.builders`!
|
||||
*/
|
||||
export class ODBuilderManager_Default extends ODBuilderManager {
|
||||
export class ODBuilderManager_Default extends api.ODBuilderManager {
|
||||
declare buttons: ODButtonManager_Default
|
||||
declare dropdowns: ODDropdownManager_Default
|
||||
declare files: ODFileManager_Default
|
||||
@@ -35,8 +32,8 @@ export class ODBuilderManager_Default extends ODBuilderManager {
|
||||
* It's used to generate typescript declarations for this class.
|
||||
*/
|
||||
export interface ODButtonManagerIds_Default {
|
||||
"opendiscord:verifybar-success":{source:"verifybar"|"other",params:{guild:discord.Guild|null,channel:discord.TextBasedChannel,user:discord.User,verifybar:ODVerifyBar,customData?:string,customColor?:ODValidButtonColor,customLabel?:string,customEmoji?:string},workers:"opendiscord:verifybar-success"},
|
||||
"opendiscord:verifybar-failure":{source:"verifybar"|"other",params:{guild:discord.Guild|null,channel:discord.TextBasedChannel,user:discord.User,verifybar:ODVerifyBar,customData?:string,customColor?:ODValidButtonColor,customLabel?:string,customEmoji?:string},workers:"opendiscord:verifybar-failure"},
|
||||
"opendiscord:verifybar-success":{source:"verifybar"|"other",params:{guild:discord.Guild|null,channel:discord.TextBasedChannel,user:discord.User,verifybar:api.ODVerifyBar,customData?:string,customColor?:api.ODValidButtonColor,customLabel?:string,customEmoji?:string},workers:"opendiscord:verifybar-success"},
|
||||
"opendiscord:verifybar-failure":{source:"verifybar"|"other",params:{guild:discord.Guild|null,channel:discord.TextBasedChannel,user:discord.User,verifybar:api.ODVerifyBar,customData?:string,customColor?:api.ODValidButtonColor,customLabel?:string,customEmoji?:string},workers:"opendiscord:verifybar-failure"},
|
||||
|
||||
"opendiscord:error-ticket-deprecated-transcript":{source:"slash"|"text"|"button"|"dropdown"|"modal"|"other",params:{},workers:"opendiscord:error-ticket-deprecated-transcript"},
|
||||
|
||||
@@ -72,32 +69,32 @@ export interface ODButtonManagerIds_Default {
|
||||
*
|
||||
* This default class is made for the global variable `opendiscord.builders.buttons`!
|
||||
*/
|
||||
export class ODButtonManager_Default extends ODButtonManager {
|
||||
export class ODButtonManager_Default extends api.ODButtonManager {
|
||||
get<ButtonId extends keyof ODButtonManagerIds_Default>(id:ButtonId): ODButton_Default<ODButtonManagerIds_Default[ButtonId]["source"],ODButtonManagerIds_Default[ButtonId]["params"],ODButtonManagerIds_Default[ButtonId]["workers"]>
|
||||
get(id:ODValidId): ODButton<string,any>|null
|
||||
get(id:api.ODValidId): api.ODButton<string,any>|null
|
||||
|
||||
get(id:ODValidId): ODButton<string,any>|null {
|
||||
get(id:api.ODValidId): api.ODButton<string,any>|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<ButtonId extends keyof ODButtonManagerIds_Default>(id:ButtonId): ODButton_Default<ODButtonManagerIds_Default[ButtonId]["source"],ODButtonManagerIds_Default[ButtonId]["params"],ODButtonManagerIds_Default[ButtonId]["workers"]>
|
||||
remove(id:ODValidId): ODButton<string,any>|null
|
||||
remove(id:api.ODValidId): api.ODButton<string,any>|null
|
||||
|
||||
remove(id:ODValidId): ODButton<string,any>|null {
|
||||
remove(id:api.ODValidId): api.ODButton<string,any>|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODButtonManagerIds_Default): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
|
||||
getSafe<ButtonId extends keyof ODButtonManagerIds_Default>(id:ButtonId): ODButton_Default<ODButtonManagerIds_Default[ButtonId]["source"],ODButtonManagerIds_Default[ButtonId]["params"],ODButtonManagerIds_Default[ButtonId]["workers"]>
|
||||
getSafe(id:ODValidId): ODButton<string,any>
|
||||
getSafe(id:api.ODValidId): api.ODButton<string,any>
|
||||
|
||||
getSafe(id:ODValidId): ODButton<string,any> {
|
||||
getSafe(id:api.ODValidId): api.ODButton<string,any> {
|
||||
return super.getSafe(id)
|
||||
}
|
||||
}
|
||||
@@ -108,8 +105,8 @@ export class ODButtonManager_Default extends ODButtonManager {
|
||||
*
|
||||
* This default class is made for the default `ODButton`'s!
|
||||
*/
|
||||
export class ODButton_Default<Source extends string, Params, WorkerIds extends string> extends ODButton<Source,Params> {
|
||||
declare workers: ODWorkerManager_Default<ODButtonInstance,Source,Params,WorkerIds>
|
||||
export class ODButton_Default<Source extends string, Params, WorkerIds extends string> extends api.ODButton<Source,Params> {
|
||||
declare workers: ODWorkerManager_Default<api.ODButtonInstance,Source,Params,WorkerIds>
|
||||
}
|
||||
|
||||
/**## ODDropdownManagerIds_Default `interface`
|
||||
@@ -126,32 +123,32 @@ export interface ODDropdownManagerIds_Default {
|
||||
*
|
||||
* This default class is made for the global variable `opendiscord.builders.dropdowns`!
|
||||
*/
|
||||
export class ODDropdownManager_Default extends ODDropdownManager {
|
||||
export class ODDropdownManager_Default extends api.ODDropdownManager {
|
||||
get<DropdownId extends keyof ODDropdownManagerIds_Default>(id:DropdownId): ODDropdown_Default<ODDropdownManagerIds_Default[DropdownId]["source"],ODDropdownManagerIds_Default[DropdownId]["params"],ODDropdownManagerIds_Default[DropdownId]["workers"]>
|
||||
get(id:ODValidId): ODDropdown<string,any>|null
|
||||
get(id:api.ODValidId): api.ODDropdown<string,any>|null
|
||||
|
||||
get(id:ODValidId): ODDropdown<string,any>|null {
|
||||
get(id:api.ODValidId): api.ODDropdown<string,any>|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<DropdownId extends keyof ODDropdownManagerIds_Default>(id:DropdownId): ODDropdown_Default<ODDropdownManagerIds_Default[DropdownId]["source"],ODDropdownManagerIds_Default[DropdownId]["params"],ODDropdownManagerIds_Default[DropdownId]["workers"]>
|
||||
remove(id:ODValidId): ODDropdown<string,any>|null
|
||||
remove(id:api.ODValidId): api.ODDropdown<string,any>|null
|
||||
|
||||
remove(id:ODValidId): ODDropdown<string,any>|null {
|
||||
remove(id:api.ODValidId): api.ODDropdown<string,any>|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODDropdownManagerIds_Default): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
|
||||
getSafe<DropdownId extends keyof ODDropdownManagerIds_Default>(id:DropdownId): ODDropdown_Default<ODDropdownManagerIds_Default[DropdownId]["source"],ODDropdownManagerIds_Default[DropdownId]["params"],ODDropdownManagerIds_Default[DropdownId]["workers"]>
|
||||
getSafe(id:ODValidId): ODDropdown<string,any>
|
||||
getSafe(id:api.ODValidId): api.ODDropdown<string,any>
|
||||
|
||||
getSafe(id:ODValidId): ODDropdown<string,any> {
|
||||
getSafe(id:api.ODValidId): api.ODDropdown<string,any> {
|
||||
return super.getSafe(id)
|
||||
}
|
||||
}
|
||||
@@ -162,8 +159,8 @@ export class ODDropdownManager_Default extends ODDropdownManager {
|
||||
*
|
||||
* This default class is made for the default `ODDropdown`'s!
|
||||
*/
|
||||
export class ODDropdown_Default<Source extends string, Params, WorkerIds extends string> extends ODDropdown<Source,Params> {
|
||||
declare workers: ODWorkerManager_Default<ODDropdownInstance,Source,Params,WorkerIds>
|
||||
export class ODDropdown_Default<Source extends string, Params, WorkerIds extends string> extends api.ODDropdown<Source,Params> {
|
||||
declare workers: ODWorkerManager_Default<api.ODDropdownInstance,Source,Params,WorkerIds>
|
||||
}
|
||||
|
||||
/**## ODFileManagerIds_Default `interface`
|
||||
@@ -180,32 +177,32 @@ export interface ODFileManagerIds_Default {
|
||||
*
|
||||
* This default class is made for the global variable `opendiscord.builders.files`!
|
||||
*/
|
||||
export class ODFileManager_Default extends ODFileManager {
|
||||
export class ODFileManager_Default extends api.ODFileManager {
|
||||
get<FileId extends keyof ODFileManagerIds_Default>(id:FileId): ODFile_Default<ODFileManagerIds_Default[FileId]["source"],ODFileManagerIds_Default[FileId]["params"],ODFileManagerIds_Default[FileId]["workers"]>
|
||||
get(id:ODValidId): ODFile<string,any>|null
|
||||
get(id:api.ODValidId): api.ODFile<string,any>|null
|
||||
|
||||
get(id:ODValidId): ODFile<string,any>|null {
|
||||
get(id:api.ODValidId): api.ODFile<string,any>|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<FileId extends keyof ODFileManagerIds_Default>(id:FileId): ODFile_Default<ODFileManagerIds_Default[FileId]["source"],ODFileManagerIds_Default[FileId]["params"],ODFileManagerIds_Default[FileId]["workers"]>
|
||||
remove(id:ODValidId): ODFile<string,any>|null
|
||||
remove(id:api.ODValidId): api.ODFile<string,any>|null
|
||||
|
||||
remove(id:ODValidId): ODFile<string,any>|null {
|
||||
remove(id:api.ODValidId): api.ODFile<string,any>|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODFileManagerIds_Default): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
|
||||
getSafe<FileId extends keyof ODFileManagerIds_Default>(id:FileId): ODFile_Default<ODFileManagerIds_Default[FileId]["source"],ODFileManagerIds_Default[FileId]["params"],ODFileManagerIds_Default[FileId]["workers"]>
|
||||
getSafe(id:ODValidId): ODFile<string,any>
|
||||
getSafe(id:api.ODValidId): api.ODFile<string,any>
|
||||
|
||||
getSafe(id:ODValidId): ODFile<string,any> {
|
||||
getSafe(id:api.ODValidId): api.ODFile<string,any> {
|
||||
return super.getSafe(id)
|
||||
}
|
||||
}
|
||||
@@ -216,8 +213,8 @@ export class ODFileManager_Default extends ODFileManager {
|
||||
*
|
||||
* This default class is made for the default `ODFile`'s!
|
||||
*/
|
||||
export class ODFile_Default<Source extends string, Params, WorkerIds extends string> extends ODFile<Source,Params> {
|
||||
declare workers: ODWorkerManager_Default<ODFileInstance,Source,Params,WorkerIds>
|
||||
export class ODFile_Default<Source extends string, Params, WorkerIds extends string> extends api.ODFile<Source,Params> {
|
||||
declare workers: ODWorkerManager_Default<api.ODFileInstance,Source,Params,WorkerIds>
|
||||
}
|
||||
|
||||
/**## ODEmbedManagerIds_Default `interface`
|
||||
@@ -226,9 +223,9 @@ export class ODFile_Default<Source extends string, Params, WorkerIds extends str
|
||||
*/
|
||||
export interface ODEmbedManagerIds_Default {
|
||||
"opendiscord:error":{source:"slash"|"text"|"button"|"dropdown"|"modal"|"other",params:{guild:discord.Guild|null,channel:discord.TextBasedChannel,user:discord.User,error:string,layout:"simple"|"advanced",customTitle?:string},workers:"opendiscord:error"},
|
||||
"opendiscord:error-option-missing":{source:"slash"|"text"|"other",params:{guild:discord.Guild|null,channel:discord.TextBasedChannel,user:discord.User,error:ODTextCommandErrorMissingOption},workers:"opendiscord:error-option-missing"},
|
||||
"opendiscord:error-option-invalid":{source:"slash"|"text"|"other",params:{guild:discord.Guild|null,channel:discord.TextBasedChannel,user:discord.User,error:ODTextCommandErrorInvalidOption},workers:"opendiscord:error-option-invalid"},
|
||||
"opendiscord:error-unknown-command":{source:"slash"|"text"|"other",params:{guild:discord.Guild|null,channel:discord.TextBasedChannel,user:discord.User,error:ODTextCommandErrorUnknownCommand},workers:"opendiscord:error-unknown-command"},
|
||||
"opendiscord:error-option-missing":{source:"slash"|"text"|"other",params:{guild:discord.Guild|null,channel:discord.TextBasedChannel,user:discord.User,error:api.ODTextCommandErrorMissingOption},workers:"opendiscord:error-option-missing"},
|
||||
"opendiscord:error-option-invalid":{source:"slash"|"text"|"other",params:{guild:discord.Guild|null,channel:discord.TextBasedChannel,user:discord.User,error:api.ODTextCommandErrorInvalidOption},workers:"opendiscord:error-option-invalid"},
|
||||
"opendiscord:error-unknown-command":{source:"slash"|"text"|"other",params:{guild:discord.Guild|null,channel:discord.TextBasedChannel,user:discord.User,error:api.ODTextCommandErrorUnknownCommand},workers:"opendiscord:error-unknown-command"},
|
||||
"opendiscord:error-no-permissions":{source:"slash"|"text"|"button"|"dropdown"|"modal"|"other",params:{guild:discord.Guild|null,channel:discord.TextBasedChannel,user:discord.User,permissions:ODPermissionEmbedType[]},workers:"opendiscord:error-no-permissions"},
|
||||
"opendiscord:error-no-permissions-cooldown":{source:"slash"|"text"|"button"|"dropdown"|"modal"|"other",params:{guild:discord.Guild|null,channel:discord.TextBasedChannel,user:discord.User,until?:Date},workers:"opendiscord:error-no-permissions-cooldown"},
|
||||
"opendiscord:error-no-permissions-blacklisted":{source:"slash"|"text"|"button"|"dropdown"|"modal"|"other",params:{guild:discord.Guild|null,channel:discord.TextBasedChannel,user:discord.User},workers:"opendiscord:error-no-permissions-blacklisted"},
|
||||
@@ -308,32 +305,32 @@ export interface ODEmbedManagerIds_Default {
|
||||
*
|
||||
* This default class is made for the global variable `opendiscord.builders.embeds`!
|
||||
*/
|
||||
export class ODEmbedManager_Default extends ODEmbedManager {
|
||||
export class ODEmbedManager_Default extends api.ODEmbedManager {
|
||||
get<EmbedId extends keyof ODEmbedManagerIds_Default>(id:EmbedId): ODEmbed_Default<ODEmbedManagerIds_Default[EmbedId]["source"],ODEmbedManagerIds_Default[EmbedId]["params"],ODEmbedManagerIds_Default[EmbedId]["workers"]>
|
||||
get(id:ODValidId): ODEmbed<string,any>|null
|
||||
get(id:api.ODValidId): api.ODEmbed<string,any>|null
|
||||
|
||||
get(id:ODValidId): ODEmbed<string,any>|null {
|
||||
get(id:api.ODValidId): api.ODEmbed<string,any>|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<EmbedId extends keyof ODEmbedManagerIds_Default>(id:EmbedId): ODEmbed_Default<ODEmbedManagerIds_Default[EmbedId]["source"],ODEmbedManagerIds_Default[EmbedId]["params"],ODEmbedManagerIds_Default[EmbedId]["workers"]>
|
||||
remove(id:ODValidId): ODEmbed<string,any>|null
|
||||
remove(id:api.ODValidId): api.ODEmbed<string,any>|null
|
||||
|
||||
remove(id:ODValidId): ODEmbed<string,any>|null {
|
||||
remove(id:api.ODValidId): api.ODEmbed<string,any>|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODEmbedManagerIds_Default): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
|
||||
getSafe<EmbedId extends keyof ODEmbedManagerIds_Default>(id:EmbedId): ODEmbed_Default<ODEmbedManagerIds_Default[EmbedId]["source"],ODEmbedManagerIds_Default[EmbedId]["params"],ODEmbedManagerIds_Default[EmbedId]["workers"]>
|
||||
getSafe(id:ODValidId): ODEmbed<string,any>
|
||||
getSafe(id:api.ODValidId): api.ODEmbed<string,any>
|
||||
|
||||
getSafe(id:ODValidId): ODEmbed<string,any> {
|
||||
getSafe(id:api.ODValidId): api.ODEmbed<string,any> {
|
||||
return super.getSafe(id)
|
||||
}
|
||||
}
|
||||
@@ -344,8 +341,8 @@ export class ODEmbedManager_Default extends ODEmbedManager {
|
||||
*
|
||||
* This default class is made for the default `ODEmbed`'s!
|
||||
*/
|
||||
export class ODEmbed_Default<Source extends string, Params, WorkerIds extends string> extends ODEmbed<Source,Params> {
|
||||
declare workers: ODWorkerManager_Default<ODEmbedInstance,Source,Params,WorkerIds>
|
||||
export class ODEmbed_Default<Source extends string, Params, WorkerIds extends string> extends api.ODEmbed<Source,Params> {
|
||||
declare workers: ODWorkerManager_Default<api.ODEmbedInstance,Source,Params,WorkerIds>
|
||||
}
|
||||
|
||||
/**## ODMessageManagerIds_Default `interface`
|
||||
@@ -353,19 +350,19 @@ export class ODEmbed_Default<Source extends string, Params, WorkerIds extends st
|
||||
* It's used to generate typescript declarations for this class.
|
||||
*/
|
||||
export interface ODMessageManagerIds_Default {
|
||||
"opendiscord:verifybar-ticket-message":{source:"verifybar",params:{guild:discord.Guild|null,channel:discord.TextBasedChannel,user:discord.User,verifybar:ODVerifyBar,originalMessage:discord.Message<boolean>},workers:"opendiscord:verifybar-ticket-message"},
|
||||
"opendiscord:verifybar-close-message":{source:"verifybar",params:{guild:discord.Guild|null,channel:discord.TextBasedChannel,user:discord.User,verifybar:ODVerifyBar,originalMessage:discord.Message<boolean>},workers:"opendiscord:verifybar-close-message"},
|
||||
"opendiscord:verifybar-reopen-message":{source:"verifybar",params:{guild:discord.Guild|null,channel:discord.TextBasedChannel,user:discord.User,verifybar:ODVerifyBar,originalMessage:discord.Message<boolean>},workers:"opendiscord:verifybar-reopen-message"},
|
||||
"opendiscord:verifybar-claim-message":{source:"verifybar",params:{guild:discord.Guild|null,channel:discord.TextBasedChannel,user:discord.User,verifybar:ODVerifyBar,originalMessage:discord.Message<boolean>},workers:"opendiscord:verifybar-claim-message"},
|
||||
"opendiscord:verifybar-unclaim-message":{source:"verifybar",params:{guild:discord.Guild|null,channel:discord.TextBasedChannel,user:discord.User,verifybar:ODVerifyBar,originalMessage:discord.Message<boolean>},workers:"opendiscord:verifybar-unclaim-message"},
|
||||
"opendiscord:verifybar-pin-message":{source:"verifybar",params:{guild:discord.Guild|null,channel:discord.TextBasedChannel,user:discord.User,verifybar:ODVerifyBar,originalMessage:discord.Message<boolean>},workers:"opendiscord:verifybar-pin-message"},
|
||||
"opendiscord:verifybar-unpin-message":{source:"verifybar",params:{guild:discord.Guild|null,channel:discord.TextBasedChannel,user:discord.User,verifybar:ODVerifyBar,originalMessage:discord.Message<boolean>},workers:"opendiscord:verifybar-unpin-message"}
|
||||
"opendiscord:verifybar-autoclose-message":{source:"verifybar",params:{guild:discord.Guild|null,channel:discord.TextBasedChannel,user:discord.User,verifybar:ODVerifyBar,originalMessage:discord.Message<boolean>},workers:"opendiscord:verifybar-autoclose-message"}
|
||||
"opendiscord:verifybar-ticket-message":{source:"verifybar",params:{guild:discord.Guild|null,channel:discord.TextBasedChannel,user:discord.User,verifybar:api.ODVerifyBar,originalMessage:discord.Message<boolean>},workers:"opendiscord:verifybar-ticket-message"},
|
||||
"opendiscord:verifybar-close-message":{source:"verifybar",params:{guild:discord.Guild|null,channel:discord.TextBasedChannel,user:discord.User,verifybar:api.ODVerifyBar,originalMessage:discord.Message<boolean>},workers:"opendiscord:verifybar-close-message"},
|
||||
"opendiscord:verifybar-reopen-message":{source:"verifybar",params:{guild:discord.Guild|null,channel:discord.TextBasedChannel,user:discord.User,verifybar:api.ODVerifyBar,originalMessage:discord.Message<boolean>},workers:"opendiscord:verifybar-reopen-message"},
|
||||
"opendiscord:verifybar-claim-message":{source:"verifybar",params:{guild:discord.Guild|null,channel:discord.TextBasedChannel,user:discord.User,verifybar:api.ODVerifyBar,originalMessage:discord.Message<boolean>},workers:"opendiscord:verifybar-claim-message"},
|
||||
"opendiscord:verifybar-unclaim-message":{source:"verifybar",params:{guild:discord.Guild|null,channel:discord.TextBasedChannel,user:discord.User,verifybar:api.ODVerifyBar,originalMessage:discord.Message<boolean>},workers:"opendiscord:verifybar-unclaim-message"},
|
||||
"opendiscord:verifybar-pin-message":{source:"verifybar",params:{guild:discord.Guild|null,channel:discord.TextBasedChannel,user:discord.User,verifybar:api.ODVerifyBar,originalMessage:discord.Message<boolean>},workers:"opendiscord:verifybar-pin-message"},
|
||||
"opendiscord:verifybar-unpin-message":{source:"verifybar",params:{guild:discord.Guild|null,channel:discord.TextBasedChannel,user:discord.User,verifybar:api.ODVerifyBar,originalMessage:discord.Message<boolean>},workers:"opendiscord:verifybar-unpin-message"}
|
||||
"opendiscord:verifybar-autoclose-message":{source:"verifybar",params:{guild:discord.Guild|null,channel:discord.TextBasedChannel,user:discord.User,verifybar:api.ODVerifyBar,originalMessage:discord.Message<boolean>},workers:"opendiscord:verifybar-autoclose-message"}
|
||||
|
||||
"opendiscord:error":{source:"slash"|"text"|"button"|"dropdown"|"modal"|"other",params:{guild:discord.Guild|null,channel:discord.TextBasedChannel,user:discord.User,error:string,layout:"simple"|"advanced",customTitle?:string},workers:"opendiscord:error"},
|
||||
"opendiscord:error-option-missing":{source:"slash"|"text"|"other",params:{guild:discord.Guild|null,channel:discord.TextBasedChannel,user:discord.User,error:ODTextCommandErrorMissingOption},workers:"opendiscord:error-option-missing"},
|
||||
"opendiscord:error-option-invalid":{source:"slash"|"text"|"other",params:{guild:discord.Guild|null,channel:discord.TextBasedChannel,user:discord.User,error:ODTextCommandErrorInvalidOption},workers:"opendiscord:error-option-invalid"},
|
||||
"opendiscord:error-unknown-command":{source:"slash"|"text"|"other",params:{guild:discord.Guild|null,channel:discord.TextBasedChannel,user:discord.User,error:ODTextCommandErrorUnknownCommand},workers:"opendiscord:error-unknown-command"},
|
||||
"opendiscord:error-option-missing":{source:"slash"|"text"|"other",params:{guild:discord.Guild|null,channel:discord.TextBasedChannel,user:discord.User,error:api.ODTextCommandErrorMissingOption},workers:"opendiscord:error-option-missing"},
|
||||
"opendiscord:error-option-invalid":{source:"slash"|"text"|"other",params:{guild:discord.Guild|null,channel:discord.TextBasedChannel,user:discord.User,error:api.ODTextCommandErrorInvalidOption},workers:"opendiscord:error-option-invalid"},
|
||||
"opendiscord:error-unknown-command":{source:"slash"|"text"|"other",params:{guild:discord.Guild|null,channel:discord.TextBasedChannel,user:discord.User,error:api.ODTextCommandErrorUnknownCommand},workers:"opendiscord:error-unknown-command"},
|
||||
"opendiscord:error-no-permissions":{source:"slash"|"text"|"button"|"dropdown"|"modal"|"other",params:{guild:discord.Guild|null,channel:discord.TextBasedChannel,user:discord.User,permissions:ODPermissionEmbedType[]},workers:"opendiscord:error-no-permissions"},
|
||||
"opendiscord:error-no-permissions-cooldown":{source:"slash"|"text"|"button"|"dropdown"|"modal"|"other",params:{guild:discord.Guild|null,channel:discord.TextBasedChannel,user:discord.User,until?:Date},workers:"opendiscord:error-no-permissions-cooldown"},
|
||||
"opendiscord:error-no-permissions-blacklisted":{source:"slash"|"text"|"button"|"dropdown"|"modal"|"other",params:{guild:discord.Guild|null,channel:discord.TextBasedChannel,user:discord.User},workers:"opendiscord:error-no-permissions-blacklisted"},
|
||||
@@ -447,32 +444,32 @@ export interface ODMessageManagerIds_Default {
|
||||
*
|
||||
* This default class is made for the global variable `opendiscord.builders.messages`!
|
||||
*/
|
||||
export class ODMessageManager_Default extends ODMessageManager {
|
||||
export class ODMessageManager_Default extends api.ODMessageManager {
|
||||
get<MessageId extends keyof ODMessageManagerIds_Default>(id:MessageId): ODMessage_Default<ODMessageManagerIds_Default[MessageId]["source"],ODMessageManagerIds_Default[MessageId]["params"],ODMessageManagerIds_Default[MessageId]["workers"]>
|
||||
get(id:ODValidId): ODMessage<string,any>|null
|
||||
get(id:api.ODValidId): api.ODMessage<string,any>|null
|
||||
|
||||
get(id:ODValidId): ODMessage<string,any>|null {
|
||||
get(id:api.ODValidId): api.ODMessage<string,any>|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<MessageId extends keyof ODMessageManagerIds_Default>(id:MessageId): ODMessage_Default<ODMessageManagerIds_Default[MessageId]["source"],ODMessageManagerIds_Default[MessageId]["params"],ODMessageManagerIds_Default[MessageId]["workers"]>
|
||||
remove(id:ODValidId): ODMessage<string,any>|null
|
||||
remove(id:api.ODValidId): api.ODMessage<string,any>|null
|
||||
|
||||
remove(id:ODValidId): ODMessage<string,any>|null {
|
||||
remove(id:api.ODValidId): api.ODMessage<string,any>|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODMessageManagerIds_Default): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
|
||||
getSafe<MessageId extends keyof ODMessageManagerIds_Default>(id:MessageId): ODMessage_Default<ODMessageManagerIds_Default[MessageId]["source"],ODMessageManagerIds_Default[MessageId]["params"],ODMessageManagerIds_Default[MessageId]["workers"]>
|
||||
getSafe(id:ODValidId): ODMessage<string,any>
|
||||
getSafe(id:api.ODValidId): api.ODMessage<string,any>
|
||||
|
||||
getSafe(id:ODValidId): ODMessage<string,any> {
|
||||
getSafe(id:api.ODValidId): api.ODMessage<string,any> {
|
||||
return super.getSafe(id)
|
||||
}
|
||||
}
|
||||
@@ -483,8 +480,8 @@ export class ODMessageManager_Default extends ODMessageManager {
|
||||
*
|
||||
* This default class is made for the default `ODMessage`'s!
|
||||
*/
|
||||
export class ODMessage_Default<Source extends string, Params, WorkerIds extends string> extends ODMessage<Source,Params> {
|
||||
declare workers: ODWorkerManager_Default<ODMessageInstance,Source,Params,WorkerIds>
|
||||
export class ODMessage_Default<Source extends string, Params, WorkerIds extends string> extends api.ODMessage<Source,Params> {
|
||||
declare workers: ODWorkerManager_Default<api.ODMessageInstance,Source,Params,WorkerIds>
|
||||
}
|
||||
|
||||
/**## ODModalManagerIds_Default `interface`
|
||||
@@ -508,32 +505,32 @@ export interface ODModalManagerIds_Default {
|
||||
*
|
||||
* This default class is made for the global variable `opendiscord.builders.modals`!
|
||||
*/
|
||||
export class ODModalManager_Default extends ODModalManager {
|
||||
export class ODModalManager_Default extends api.ODModalManager {
|
||||
get<ModalId extends keyof ODModalManagerIds_Default>(id:ModalId): ODModal_Default<ODModalManagerIds_Default[ModalId]["source"],ODModalManagerIds_Default[ModalId]["params"],ODModalManagerIds_Default[ModalId]["workers"]>
|
||||
get(id:ODValidId): ODModal<string,any>|null
|
||||
get(id:api.ODValidId): api.ODModal<string,any>|null
|
||||
|
||||
get(id:ODValidId): ODModal<string,any>|null {
|
||||
get(id:api.ODValidId): api.ODModal<string,any>|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<ModalId extends keyof ODModalManagerIds_Default>(id:ModalId): ODModal_Default<ODModalManagerIds_Default[ModalId]["source"],ODModalManagerIds_Default[ModalId]["params"],ODModalManagerIds_Default[ModalId]["workers"]>
|
||||
remove(id:ODValidId): ODModal<string,any>|null
|
||||
remove(id:api.ODValidId): api.ODModal<string,any>|null
|
||||
|
||||
remove(id:ODValidId): ODModal<string,any>|null {
|
||||
remove(id:api.ODValidId): api.ODModal<string,any>|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODModalManagerIds_Default): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
|
||||
getSafe<ModalId extends keyof ODModalManagerIds_Default>(id:ModalId): ODModal_Default<ODModalManagerIds_Default[ModalId]["source"],ODModalManagerIds_Default[ModalId]["params"],ODModalManagerIds_Default[ModalId]["workers"]>
|
||||
getSafe(id:ODValidId): ODModal<string,any>
|
||||
getSafe(id:api.ODValidId): api.ODModal<string,any>
|
||||
|
||||
getSafe(id:ODValidId): ODModal<string,any> {
|
||||
getSafe(id:api.ODValidId): api.ODModal<string,any> {
|
||||
return super.getSafe(id)
|
||||
}
|
||||
}
|
||||
@@ -544,6 +541,6 @@ export class ODModalManager_Default extends ODModalManager {
|
||||
*
|
||||
* This default class is made for the default `ODModal`'s!
|
||||
*/
|
||||
export class ODModal_Default<Source extends string, Params, WorkerIds extends string> extends ODModal<Source,Params> {
|
||||
declare workers: ODWorkerManager_Default<ODModalInstance,Source,Params,WorkerIds>
|
||||
export class ODModal_Default<Source extends string, Params, WorkerIds extends string> extends api.ODModal<Source,Params> {
|
||||
declare workers: ODWorkerManager_Default<api.ODModalInstance,Source,Params,WorkerIds>
|
||||
}
|
||||
@@ -1,9 +1,8 @@
|
||||
///////////////////////////////////////
|
||||
//DEFAULT CONFIG CHECKER MODULE
|
||||
///////////////////////////////////////
|
||||
import { ODLanguageManager_Default } from "../api"
|
||||
import { ODValidId } from "../modules/base"
|
||||
import { ODCheckerManager, ODChecker, ODCheckerTranslationRegister, ODCheckerRenderer, ODCheckerFunctionManager, ODCheckerResult, ODCheckerFunction } from "../modules/checker"
|
||||
import * as api from "@open-discord-bots/framework/api"
|
||||
import { ODLanguageManager_Default } from "./language"
|
||||
import ansis from "ansis"
|
||||
|
||||
/**## ODCheckerManagerIds_Default `interface`
|
||||
@@ -11,11 +10,11 @@ import ansis from "ansis"
|
||||
* It's used to generate typescript declarations for this class.
|
||||
*/
|
||||
export interface ODCheckerManagerIds_Default {
|
||||
"opendiscord:general":ODChecker,
|
||||
"opendiscord:questions":ODChecker,
|
||||
"opendiscord:options":ODChecker,
|
||||
"opendiscord:panels":ODChecker,
|
||||
"opendiscord:transcripts":ODChecker
|
||||
"opendiscord:general":api.ODChecker,
|
||||
"opendiscord:questions":api.ODChecker,
|
||||
"opendiscord:options":api.ODChecker,
|
||||
"opendiscord:panels":api.ODChecker,
|
||||
"opendiscord:transcripts":api.ODChecker
|
||||
}
|
||||
|
||||
/**## ODCheckerManager_Default `default_class`
|
||||
@@ -24,29 +23,29 @@ export interface ODCheckerManagerIds_Default {
|
||||
*
|
||||
* This default class is made for the global variable `opendiscord.checkers`!
|
||||
*/
|
||||
export class ODCheckerManager_Default extends ODCheckerManager {
|
||||
export class ODCheckerManager_Default extends api.ODCheckerManager {
|
||||
declare translation: ODCheckerTranslationRegister_Default
|
||||
declare renderer: ODCheckerRenderer_Default
|
||||
declare functions: ODCheckerFunctionManager_Default
|
||||
|
||||
get<CheckerId extends keyof ODCheckerManagerIds_Default>(id:CheckerId): ODCheckerManagerIds_Default[CheckerId]
|
||||
get(id:ODValidId): ODChecker|null
|
||||
get(id:api.ODValidId): api.ODChecker|null
|
||||
|
||||
get(id:ODValidId): ODChecker|null {
|
||||
get(id:api.ODValidId): api.ODChecker|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<CheckerId extends keyof ODCheckerManagerIds_Default>(id:CheckerId): ODCheckerManagerIds_Default[CheckerId]
|
||||
remove(id:ODValidId): ODChecker|null
|
||||
remove(id:api.ODValidId): api.ODChecker|null
|
||||
|
||||
remove(id:ODValidId): ODChecker|null {
|
||||
remove(id:api.ODValidId): api.ODChecker|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODCheckerManagerIds_Default): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
}
|
||||
@@ -57,7 +56,7 @@ export class ODCheckerManager_Default extends ODCheckerManager {
|
||||
*
|
||||
* This default class is made for the global variable `opendiscord.checkers.renderer`!
|
||||
*/
|
||||
export class ODCheckerRenderer_Default extends ODCheckerRenderer {
|
||||
export class ODCheckerRenderer_Default extends api.ODCheckerRenderer {
|
||||
extraHeaderText: string[] = []
|
||||
extraFooterText: string[] = []
|
||||
extraTopText: string[] = []
|
||||
@@ -72,7 +71,7 @@ export class ODCheckerRenderer_Default extends ODCheckerRenderer {
|
||||
disableHeader: boolean = false
|
||||
disableFooter: boolean = false
|
||||
|
||||
getComponents(compact:boolean, renderEmpty:boolean, translation:ODCheckerTranslationRegister_Default, data:ODCheckerResult): string[] {
|
||||
getComponents(compact:boolean, renderEmpty:boolean, translation:ODCheckerTranslationRegister_Default, data:api.ODCheckerResult): string[] {
|
||||
const tm = translation
|
||||
const t = {
|
||||
headerOpenticket:tm.get("other","opendiscord:header-openticket") ?? "OPEN TICKET",
|
||||
@@ -312,7 +311,7 @@ export type ODCheckerTranslationRegisterMessageIds_Default = (
|
||||
*
|
||||
* This default class is made for the global variable `opendiscord.checkers.translation`!
|
||||
*/
|
||||
export class ODCheckerTranslationRegister_Default extends ODCheckerTranslationRegister {
|
||||
export class ODCheckerTranslationRegister_Default extends api.ODCheckerTranslationRegister {
|
||||
get(type:"other", id:ODCheckerTranslationRegisterOtherIds_Default): string
|
||||
get(type:"message", id:ODCheckerTranslationRegisterMessageIds_Default): string
|
||||
get(type:"message"|"other", id:string): string|null
|
||||
@@ -350,9 +349,9 @@ export class ODCheckerTranslationRegister_Default extends ODCheckerTranslationRe
|
||||
* It's used to generate typescript declarations for this class.
|
||||
*/
|
||||
export interface ODCheckerFunctionManagerIds_Default {
|
||||
"opendiscord:unused-options":ODCheckerFunction,
|
||||
"opendiscord:unused-questions":ODCheckerFunction,
|
||||
"opendiscord:dropdown-options":ODCheckerFunction
|
||||
"opendiscord:unused-options":api.ODCheckerFunction,
|
||||
"opendiscord:unused-questions":api.ODCheckerFunction,
|
||||
"opendiscord:dropdown-options":api.ODCheckerFunction
|
||||
}
|
||||
|
||||
/**## ODCheckerFunctionManager_Default `default_class`
|
||||
@@ -361,25 +360,25 @@ export interface ODCheckerFunctionManagerIds_Default {
|
||||
*
|
||||
* This default class is made for the global variable `opendiscord.checkers.functions`!
|
||||
*/
|
||||
export class ODCheckerFunctionManager_Default extends ODCheckerFunctionManager {
|
||||
export class ODCheckerFunctionManager_Default extends api.ODCheckerFunctionManager {
|
||||
get<CheckerFunctionId extends keyof ODCheckerFunctionManagerIds_Default>(id:CheckerFunctionId): ODCheckerFunctionManagerIds_Default[CheckerFunctionId]
|
||||
get(id:ODValidId): ODCheckerFunction|null
|
||||
get(id:api.ODValidId): api.ODCheckerFunction|null
|
||||
|
||||
get(id:ODValidId): ODCheckerFunction|null {
|
||||
get(id:api.ODValidId): api.ODCheckerFunction|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<CheckerFunctionId extends keyof ODCheckerFunctionManagerIds_Default>(id:CheckerFunctionId): ODCheckerFunctionManagerIds_Default[CheckerFunctionId]
|
||||
remove(id:ODValidId): ODCheckerFunction|null
|
||||
remove(id:api.ODValidId): api.ODCheckerFunction|null
|
||||
|
||||
remove(id:ODValidId): ODCheckerFunction|null {
|
||||
remove(id:api.ODValidId): api.ODCheckerFunction|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODCheckerFunctionManagerIds_Default): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,7 @@
|
||||
///////////////////////////////////////
|
||||
//DEFAULT CLIENT MODULE
|
||||
///////////////////////////////////////
|
||||
import { ODValidId } from "../modules/base"
|
||||
import { ODClientManager, ODSlashCommand, ODTextCommand, ODSlashCommandManager, ODTextCommandManager, ODSlashCommandInteractionCallback, ODTextCommandInteractionCallback, ODContextMenu, ODContextMenuManager, ODContextMenuInteractionCallback } from "../modules/client"
|
||||
import * as api from "@open-discord-bots/framework/api"
|
||||
|
||||
/** (CONTRIBUTOR GUIDE) HOW TO ADD NEW COMMANDS?
|
||||
* - Register the command in loadAllSlashCommands() & loadAllTextCommands() in (./src/data/framework/commandLoader.ts)
|
||||
@@ -20,7 +19,7 @@ import { ODClientManager, ODSlashCommand, ODTextCommand, ODSlashCommandManager,
|
||||
*
|
||||
* This default class is made for the global variable `opendiscord.client`!
|
||||
*/
|
||||
export class ODClientManager_Default extends ODClientManager {
|
||||
export class ODClientManager_Default extends api.ODClientManager {
|
||||
declare slashCommands: ODSlashCommandManager_Default
|
||||
declare textCommands: ODTextCommandManager_Default
|
||||
declare contextMenus: ODContextMenuManager_Default
|
||||
@@ -31,28 +30,28 @@ export class ODClientManager_Default extends ODClientManager {
|
||||
* It's used to generate typescript declarations for this class.
|
||||
*/
|
||||
export interface ODSlashCommandManagerIds_Default {
|
||||
"opendiscord:help":ODSlashCommand,
|
||||
"opendiscord:panel":ODSlashCommand,
|
||||
"opendiscord:ticket":ODSlashCommand,
|
||||
"opendiscord:close":ODSlashCommand,
|
||||
"opendiscord:delete":ODSlashCommand,
|
||||
"opendiscord:reopen":ODSlashCommand,
|
||||
"opendiscord:claim":ODSlashCommand,
|
||||
"opendiscord:unclaim":ODSlashCommand,
|
||||
"opendiscord:pin":ODSlashCommand,
|
||||
"opendiscord:unpin":ODSlashCommand,
|
||||
"opendiscord:move":ODSlashCommand,
|
||||
"opendiscord:rename":ODSlashCommand,
|
||||
"opendiscord:add":ODSlashCommand,
|
||||
"opendiscord:remove":ODSlashCommand,
|
||||
"opendiscord:blacklist":ODSlashCommand,
|
||||
"opendiscord:stats":ODSlashCommand,
|
||||
"opendiscord:clear":ODSlashCommand,
|
||||
"opendiscord:autoclose":ODSlashCommand,
|
||||
"opendiscord:autodelete":ODSlashCommand,
|
||||
"opendiscord:topic":ODSlashCommand,
|
||||
"opendiscord:priority":ODSlashCommand,
|
||||
"opendiscord:transfer":ODSlashCommand,
|
||||
"opendiscord:help":api.ODSlashCommand,
|
||||
"opendiscord:panel":api.ODSlashCommand,
|
||||
"opendiscord:ticket":api.ODSlashCommand,
|
||||
"opendiscord:close":api.ODSlashCommand,
|
||||
"opendiscord:delete":api.ODSlashCommand,
|
||||
"opendiscord:reopen":api.ODSlashCommand,
|
||||
"opendiscord:claim":api.ODSlashCommand,
|
||||
"opendiscord:unclaim":api.ODSlashCommand,
|
||||
"opendiscord:pin":api.ODSlashCommand,
|
||||
"opendiscord:unpin":api.ODSlashCommand,
|
||||
"opendiscord:move":api.ODSlashCommand,
|
||||
"opendiscord:rename":api.ODSlashCommand,
|
||||
"opendiscord:add":api.ODSlashCommand,
|
||||
"opendiscord:remove":api.ODSlashCommand,
|
||||
"opendiscord:blacklist":api.ODSlashCommand,
|
||||
"opendiscord:stats":api.ODSlashCommand,
|
||||
"opendiscord:clear":api.ODSlashCommand,
|
||||
"opendiscord:autoclose":api.ODSlashCommand,
|
||||
"opendiscord:autodelete":api.ODSlashCommand,
|
||||
"opendiscord:topic":api.ODSlashCommand,
|
||||
"opendiscord:priority":api.ODSlashCommand,
|
||||
"opendiscord:transfer":api.ODSlashCommand,
|
||||
}
|
||||
|
||||
/**## ODSlashCommandManager_Default `default_class`
|
||||
@@ -61,32 +60,32 @@ export interface ODSlashCommandManagerIds_Default {
|
||||
*
|
||||
* This default class is made for the global variable `opendiscord.client.slashCommands`!
|
||||
*/
|
||||
export class ODSlashCommandManager_Default extends ODSlashCommandManager {
|
||||
export class ODSlashCommandManager_Default extends api.ODSlashCommandManager {
|
||||
get<SlashCommandId extends keyof ODSlashCommandManagerIds_Default>(id:SlashCommandId): ODSlashCommandManagerIds_Default[SlashCommandId]
|
||||
get(id:ODValidId): ODSlashCommand|null
|
||||
get(id:api.ODValidId): api.ODSlashCommand|null
|
||||
|
||||
get(id:ODValidId): ODSlashCommand|null {
|
||||
get(id:api.ODValidId): api.ODSlashCommand|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<SlashCommandId extends keyof ODSlashCommandManagerIds_Default>(id:SlashCommandId): ODSlashCommandManagerIds_Default[SlashCommandId]
|
||||
remove(id:ODValidId): ODSlashCommand|null
|
||||
remove(id:api.ODValidId): api.ODSlashCommand|null
|
||||
|
||||
remove(id:ODValidId): ODSlashCommand|null {
|
||||
remove(id:api.ODValidId): api.ODSlashCommand|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODSlashCommandManagerIds_Default): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
|
||||
onInteraction(commandName:keyof ODSlashCommandManagerIds_Default, callback:ODSlashCommandInteractionCallback): void
|
||||
onInteraction(commandName:string|RegExp, callback:ODSlashCommandInteractionCallback): void
|
||||
onInteraction(commandName:keyof ODSlashCommandManagerIds_Default, callback:api.ODSlashCommandInteractionCallback): void
|
||||
onInteraction(commandName:string|RegExp, callback:api.ODSlashCommandInteractionCallback): void
|
||||
|
||||
onInteraction(commandName:string|RegExp, callback:ODSlashCommandInteractionCallback): void {
|
||||
onInteraction(commandName:string|RegExp, callback:api.ODSlashCommandInteractionCallback): void {
|
||||
return super.onInteraction(commandName,callback)
|
||||
}
|
||||
}
|
||||
@@ -96,37 +95,37 @@ export class ODSlashCommandManager_Default extends ODSlashCommandManager {
|
||||
* It's used to generate typescript declarations for this class.
|
||||
*/
|
||||
export interface ODTextCommandManagerIds_Default {
|
||||
"opendiscord:dump":ODTextCommand,
|
||||
"opendiscord:help":ODTextCommand,
|
||||
"opendiscord:panel":ODTextCommand,
|
||||
"opendiscord:close":ODTextCommand,
|
||||
"opendiscord:delete":ODTextCommand,
|
||||
"opendiscord:reopen":ODTextCommand,
|
||||
"opendiscord:claim":ODTextCommand,
|
||||
"opendiscord:unclaim":ODTextCommand,
|
||||
"opendiscord:pin":ODTextCommand,
|
||||
"opendiscord:unpin":ODTextCommand,
|
||||
"opendiscord:move":ODTextCommand,
|
||||
"opendiscord:rename":ODTextCommand,
|
||||
"opendiscord:add":ODTextCommand,
|
||||
"opendiscord:remove":ODTextCommand,
|
||||
"opendiscord:blacklist-view":ODTextCommand,
|
||||
"opendiscord:blacklist-add":ODTextCommand,
|
||||
"opendiscord:blacklist-remove":ODTextCommand,
|
||||
"opendiscord:blacklist-get":ODTextCommand,
|
||||
"opendiscord:stats-global":ODTextCommand,
|
||||
"opendiscord:stats-reset":ODTextCommand,
|
||||
"opendiscord:stats-ticket":ODTextCommand,
|
||||
"opendiscord:stats-user":ODTextCommand,
|
||||
"opendiscord:clear":ODTextCommand,
|
||||
"opendiscord:autoclose-disable":ODTextCommand,
|
||||
"opendiscord:autoclose-enable":ODTextCommand,
|
||||
"opendiscord:autodelete-disable":ODTextCommand,
|
||||
"opendiscord:autodelete-enable":ODTextCommand,
|
||||
"opendiscord:topic-set":ODTextCommand,
|
||||
"opendiscord:priority-set":ODTextCommand,
|
||||
"opendiscord:priority-get":ODTextCommand,
|
||||
"opendiscord:transfer":ODTextCommand,
|
||||
"opendiscord:dump":api.ODTextCommand,
|
||||
"opendiscord:help":api.ODTextCommand,
|
||||
"opendiscord:panel":api.ODTextCommand,
|
||||
"opendiscord:close":api.ODTextCommand,
|
||||
"opendiscord:delete":api.ODTextCommand,
|
||||
"opendiscord:reopen":api.ODTextCommand,
|
||||
"opendiscord:claim":api.ODTextCommand,
|
||||
"opendiscord:unclaim":api.ODTextCommand,
|
||||
"opendiscord:pin":api.ODTextCommand,
|
||||
"opendiscord:unpin":api.ODTextCommand,
|
||||
"opendiscord:move":api.ODTextCommand,
|
||||
"opendiscord:rename":api.ODTextCommand,
|
||||
"opendiscord:add":api.ODTextCommand,
|
||||
"opendiscord:remove":api.ODTextCommand,
|
||||
"opendiscord:blacklist-view":api.ODTextCommand,
|
||||
"opendiscord:blacklist-add":api.ODTextCommand,
|
||||
"opendiscord:blacklist-remove":api.ODTextCommand,
|
||||
"opendiscord:blacklist-get":api.ODTextCommand,
|
||||
"opendiscord:stats-global":api.ODTextCommand,
|
||||
"opendiscord:stats-reset":api.ODTextCommand,
|
||||
"opendiscord:stats-ticket":api.ODTextCommand,
|
||||
"opendiscord:stats-user":api.ODTextCommand,
|
||||
"opendiscord:clear":api.ODTextCommand,
|
||||
"opendiscord:autoclose-disable":api.ODTextCommand,
|
||||
"opendiscord:autoclose-enable":api.ODTextCommand,
|
||||
"opendiscord:autodelete-disable":api.ODTextCommand,
|
||||
"opendiscord:autodelete-enable":api.ODTextCommand,
|
||||
"opendiscord:topic-set":api.ODTextCommand,
|
||||
"opendiscord:priority-set":api.ODTextCommand,
|
||||
"opendiscord:priority-get":api.ODTextCommand,
|
||||
"opendiscord:transfer":api.ODTextCommand,
|
||||
}
|
||||
|
||||
/**## ODTextCommandManager_Default `default_class`
|
||||
@@ -135,29 +134,29 @@ export interface ODTextCommandManagerIds_Default {
|
||||
*
|
||||
* This default class is made for the global variable `opendiscord.client.textCommands`!
|
||||
*/
|
||||
export class ODTextCommandManager_Default extends ODTextCommandManager {
|
||||
export class ODTextCommandManager_Default extends api.ODTextCommandManager {
|
||||
get<TextCommandId extends keyof ODTextCommandManagerIds_Default>(id:TextCommandId): ODTextCommandManagerIds_Default[TextCommandId]
|
||||
get(id:ODValidId): ODTextCommand|null
|
||||
get(id:api.ODValidId): api.ODTextCommand|null
|
||||
|
||||
get(id:ODValidId): ODTextCommand|null {
|
||||
get(id:api.ODValidId): api.ODTextCommand|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<TextCommandId extends keyof ODTextCommandManagerIds_Default>(id:TextCommandId): ODTextCommandManagerIds_Default[TextCommandId]
|
||||
remove(id:ODValidId): ODTextCommand|null
|
||||
remove(id:api.ODValidId): api.ODTextCommand|null
|
||||
|
||||
remove(id:ODValidId): ODTextCommand|null {
|
||||
remove(id:api.ODValidId): api.ODTextCommand|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODTextCommandManagerIds_Default): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
|
||||
onInteraction(commandPrefix:string, commandName:string|RegExp, callback:ODTextCommandInteractionCallback): void {
|
||||
onInteraction(commandPrefix:string, commandName:string|RegExp, callback:api.ODTextCommandInteractionCallback): void {
|
||||
return super.onInteraction(commandPrefix,commandName,callback)
|
||||
}
|
||||
}
|
||||
@@ -176,32 +175,32 @@ export interface ODContextMenuManagerIds_Default {
|
||||
*
|
||||
* This default class is made for the global variable `opendiscord.client.contextMenus`!
|
||||
*/
|
||||
export class ODContextMenuManager_Default extends ODContextMenuManager {
|
||||
export class ODContextMenuManager_Default extends api.ODContextMenuManager {
|
||||
get<ContextMenuId extends keyof ODContextMenuManagerIds_Default>(id:ContextMenuId): ODContextMenuManagerIds_Default[ContextMenuId]
|
||||
get(id:ODValidId): ODContextMenu|null
|
||||
get(id:api.ODValidId): api.ODContextMenu|null
|
||||
|
||||
get(id:ODValidId): ODContextMenu|null {
|
||||
get(id:api.ODValidId): api.ODContextMenu|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<ContextMenuId extends keyof ODContextMenuManagerIds_Default>(id:ContextMenuId): ODContextMenuManagerIds_Default[ContextMenuId]
|
||||
remove(id:ODValidId): ODContextMenu|null
|
||||
remove(id:api.ODValidId): api.ODContextMenu|null
|
||||
|
||||
remove(id:ODValidId): ODContextMenu|null {
|
||||
remove(id:api.ODValidId): api.ODContextMenu|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODContextMenuManagerIds_Default): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
|
||||
onInteraction(menuName:keyof ODContextMenuManagerIds_Default, callback:ODContextMenuInteractionCallback): void
|
||||
onInteraction(menuName:string|RegExp, callback:ODContextMenuInteractionCallback): void
|
||||
onInteraction(menuName:keyof ODContextMenuManagerIds_Default, callback:api.ODContextMenuInteractionCallback): void
|
||||
onInteraction(menuName:string|RegExp, callback:api.ODContextMenuInteractionCallback): void
|
||||
|
||||
onInteraction(menuName:string|RegExp, callback:ODContextMenuInteractionCallback): void {
|
||||
onInteraction(menuName:string|RegExp, callback:api.ODContextMenuInteractionCallback): void {
|
||||
return super.onInteraction(menuName,callback)
|
||||
}
|
||||
}
|
||||
@@ -1,30 +1,29 @@
|
||||
///////////////////////////////////////
|
||||
//DEFAULT CODE MODULE
|
||||
///////////////////////////////////////
|
||||
import { ODValidId } from "../modules/base"
|
||||
import { ODCode, ODCodeManager } from "../modules/code"
|
||||
import * as api from "@open-discord-bots/framework/api"
|
||||
|
||||
/**## ODCodeManagerIds_Default `interface`
|
||||
* This interface is a list of ids available in the `ODCodeManager_Default` class.
|
||||
* It's used to generate typescript declarations for this class.
|
||||
*/
|
||||
export interface ODCodeManagerIds_Default {
|
||||
"opendiscord:command-error-handling":ODCode,
|
||||
"opendiscord:start-listening-interactions":ODCode,
|
||||
"opendiscord:panel-database-cleaner":ODCode,
|
||||
"opendiscord:suffix-database-cleaner":ODCode,
|
||||
"opendiscord:option-database-cleaner":ODCode,
|
||||
"opendiscord:user-database-cleaner":ODCode,
|
||||
"opendiscord:ticket-database-cleaner":ODCode,
|
||||
"opendiscord:panel-auto-update":ODCode,
|
||||
"opendiscord:ticket-saver":ODCode,
|
||||
"opendiscord:blacklist-saver":ODCode,
|
||||
"opendiscord:auto-role-on-join":ODCode,
|
||||
"opendiscord:autoclose-timeout":ODCode,
|
||||
"opendiscord:autoclose-leave":ODCode,
|
||||
"opendiscord:autodelete-timeout":ODCode,
|
||||
"opendiscord:autodelete-leave":ODCode,
|
||||
"opendiscord:ticket-anti-busy":ODCode,
|
||||
"opendiscord:command-error-handling":api.ODCode,
|
||||
"opendiscord:start-listening-interactions":api.ODCode,
|
||||
"opendiscord:panel-database-cleaner":api.ODCode,
|
||||
"opendiscord:suffix-database-cleaner":api.ODCode,
|
||||
"opendiscord:option-database-cleaner":api.ODCode,
|
||||
"opendiscord:user-database-cleaner":api.ODCode,
|
||||
"opendiscord:ticket-database-cleaner":api.ODCode,
|
||||
"opendiscord:panel-auto-update":api.ODCode,
|
||||
"opendiscord:ticket-saver":api.ODCode,
|
||||
"opendiscord:blacklist-saver":api.ODCode,
|
||||
"opendiscord:auto-role-on-join":api.ODCode,
|
||||
"opendiscord:autoclose-timeout":api.ODCode,
|
||||
"opendiscord:autoclose-leave":api.ODCode,
|
||||
"opendiscord:autodelete-timeout":api.ODCode,
|
||||
"opendiscord:autodelete-leave":api.ODCode,
|
||||
"opendiscord:ticket-anti-busy":api.ODCode,
|
||||
}
|
||||
|
||||
/**## ODCodeManager_Default `default_class`
|
||||
@@ -33,25 +32,25 @@ export interface ODCodeManagerIds_Default {
|
||||
*
|
||||
* This default class is made for the global variable `opendiscord.code`!
|
||||
*/
|
||||
export class ODCodeManager_Default extends ODCodeManager {
|
||||
export class ODCodeManager_Default extends api.ODCodeManager {
|
||||
get<CodeId extends keyof ODCodeManagerIds_Default>(id:CodeId): ODCodeManagerIds_Default[CodeId]
|
||||
get(id:ODValidId): ODCode|null
|
||||
get(id:api.ODValidId): api.ODCode|null
|
||||
|
||||
get(id:ODValidId): ODCode|null {
|
||||
get(id:api.ODValidId): api.ODCode|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<CodeId extends keyof ODCodeManagerIds_Default>(id:CodeId): ODCodeManagerIds_Default[CodeId]
|
||||
remove(id:ODValidId): ODCode|null
|
||||
remove(id:api.ODValidId): api.ODCode|null
|
||||
|
||||
remove(id:ODValidId): ODCode|null {
|
||||
remove(id:api.ODValidId): api.ODCode|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODCodeManagerIds_Default): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,8 @@
|
||||
///////////////////////////////////////
|
||||
//DEFAULT CONFIG MODULE
|
||||
///////////////////////////////////////
|
||||
import { ODValidButtonColor, ODValidId } from "../modules/base"
|
||||
import * as api from "@open-discord-bots/framework/api"
|
||||
import * as discord from "discord.js"
|
||||
import { ODConfigManager, ODConfig, ODJsonConfig } from "../modules/config"
|
||||
import { ODClientActivityMode, ODClientActivityType } from "../modules/client"
|
||||
import { ODRoleUpdateMode } from "../openticket/role"
|
||||
|
||||
/** (CONTRIBUTOR GUIDE) HOW TO ADD NEW CONFIG VARIABLES?
|
||||
@@ -45,25 +43,25 @@ export interface ODConfigManagerIds_Default {
|
||||
*
|
||||
* This default class is made for the global variable `opendiscord.configs`!
|
||||
*/
|
||||
export class ODConfigManager_Default extends ODConfigManager {
|
||||
export class ODConfigManager_Default extends api.ODConfigManager {
|
||||
get<ConfigId extends keyof ODConfigManagerIds_Default>(id:ConfigId): ODConfigManagerIds_Default[ConfigId]
|
||||
get(id:ODValidId): ODConfig|null
|
||||
get(id:api.ODValidId): api.ODConfig|null
|
||||
|
||||
get(id:ODValidId): ODConfig|null {
|
||||
get(id:api.ODValidId): api.ODConfig|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<ConfigId extends keyof ODConfigManagerIds_Default>(id:ConfigId): ODConfigManagerIds_Default[ConfigId]
|
||||
remove(id:ODValidId): ODConfig|null
|
||||
remove(id:api.ODValidId): api.ODConfig|null
|
||||
|
||||
remove(id:ODValidId): ODConfig|null {
|
||||
remove(id:api.ODValidId): api.ODConfig|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODConfigManagerIds_Default): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
}
|
||||
@@ -75,9 +73,9 @@ export interface ODJsonConfig_DefaultStatusType {
|
||||
/**Is the status enabled? */
|
||||
enabled:boolean,
|
||||
/**The type of status (e.g. playing, listening, custom, ...) */
|
||||
type:Exclude<ODClientActivityType,false>,
|
||||
type:Exclude<api.ODClientActivityType,false>,
|
||||
/**The mode/status of the bot (e.g. online, invisible, idle, do not disturb) */
|
||||
mode:ODClientActivityMode
|
||||
mode:api.ODClientActivityMode
|
||||
/**The text for the status. */
|
||||
text:string,
|
||||
/**Additional text for the status. (visible below 'text') */
|
||||
@@ -324,7 +322,7 @@ export interface ODJsonConfig_DefaultGeneralData {
|
||||
*
|
||||
* This default class is made for the `general.json` config!
|
||||
*/
|
||||
export class ODJsonConfig_DefaultGeneral extends ODJsonConfig {
|
||||
export class ODJsonConfig_DefaultGeneral extends api.ODJsonConfig {
|
||||
declare data: ODJsonConfig_DefaultGeneralData
|
||||
}
|
||||
|
||||
@@ -358,7 +356,7 @@ export interface ODJsonConfig_DefaultOptionButtonSettingsType {
|
||||
/**The label of the button (can also be empty) */
|
||||
label:string,
|
||||
/**The color of the button (not available in options with the 'website' type!) */
|
||||
color:ODValidButtonColor
|
||||
color:api.ODValidButtonColor
|
||||
}
|
||||
|
||||
/**## ODJsonConfig_DefaultOptionEmbedSettingsType `interface`
|
||||
@@ -546,7 +544,7 @@ export type ODJsonConfig_DefaultOptionsData = (ODJsonConfig_DefaultOptionTicketT
|
||||
*
|
||||
* This default class is made for the `options.json` config!
|
||||
*/
|
||||
export class ODJsonConfig_DefaultOptions extends ODJsonConfig {
|
||||
export class ODJsonConfig_DefaultOptions extends api.ODJsonConfig {
|
||||
declare data: ODJsonConfig_DefaultOptionsData
|
||||
}
|
||||
|
||||
@@ -641,7 +639,7 @@ export type ODJsonConfig_DefaultPanelsData = ODJsonConfig_DefaultPanelType[]
|
||||
*
|
||||
* This default class is made for the `panels.json` config!
|
||||
*/
|
||||
export class ODJsonConfig_DefaultPanels extends ODJsonConfig {
|
||||
export class ODJsonConfig_DefaultPanels extends api.ODJsonConfig {
|
||||
declare data: ODJsonConfig_DefaultPanelsData
|
||||
}
|
||||
|
||||
@@ -706,7 +704,7 @@ export type ODJsonConfig_DefaultQuestionsData = (ODJsonConfig_DefaultShortQuesti
|
||||
*
|
||||
* This default class is made for the `questions.json` config!
|
||||
*/
|
||||
export class ODJsonConfig_DefaultQuestions extends ODJsonConfig {
|
||||
export class ODJsonConfig_DefaultQuestions extends api.ODJsonConfig {
|
||||
declare data: ODJsonConfig_DefaultQuestionsData
|
||||
}
|
||||
|
||||
@@ -828,6 +826,6 @@ export interface ODJsonConfig_DefaultTranscriptsData {
|
||||
*
|
||||
* This default class is made for the `transcripts.json` config!
|
||||
*/
|
||||
export class ODJsonConfig_DefaultTranscripts extends ODJsonConfig {
|
||||
export class ODJsonConfig_DefaultTranscripts extends api.ODJsonConfig {
|
||||
declare data: ODJsonConfig_DefaultTranscriptsData
|
||||
}
|
||||
@@ -1,15 +1,14 @@
|
||||
///////////////////////////////////////
|
||||
//DEFAULT CONSOLE MODULE
|
||||
///////////////////////////////////////
|
||||
import { ODValidId } from "../modules/base"
|
||||
import { ODLiveStatusUrlSource, ODLiveStatusManager, ODLiveStatusSource } from "../modules/console"
|
||||
import * as api from "@open-discord-bots/framework/api"
|
||||
|
||||
/**## ODLiveStatusManagerIds_Default `interface`
|
||||
* This interface is a list of ids available in the `ODLiveStatusManager_Default` class.
|
||||
* It's used to generate typescript declarations for this class.
|
||||
*/
|
||||
export interface ODLiveStatusManagerIds_Default {
|
||||
"opendiscord:default-djdj-dev":ODLiveStatusUrlSource
|
||||
"opendiscord:default-djdj-dev":api.ODLiveStatusUrlSource
|
||||
}
|
||||
|
||||
/**## ODLiveStatusManager_Default `default_class`
|
||||
@@ -18,25 +17,25 @@ export interface ODLiveStatusManagerIds_Default {
|
||||
*
|
||||
* This default class is made for the global variable `opendiscord.livestatus`!
|
||||
*/
|
||||
export class ODLiveStatusManager_Default extends ODLiveStatusManager {
|
||||
export class ODLiveStatusManager_Default extends api.ODLiveStatusManager {
|
||||
get<LiveStatusId extends keyof ODLiveStatusManagerIds_Default>(id:LiveStatusId): ODLiveStatusManagerIds_Default[LiveStatusId]
|
||||
get(id:ODValidId): ODLiveStatusSource|null
|
||||
get(id:api.ODValidId): api.ODLiveStatusSource|null
|
||||
|
||||
get(id:ODValidId): ODLiveStatusSource|null {
|
||||
get(id:api.ODValidId): api.ODLiveStatusSource|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<LiveStatusId extends keyof ODLiveStatusManagerIds_Default>(id:LiveStatusId): ODLiveStatusManagerIds_Default[LiveStatusId]
|
||||
remove(id:ODValidId): ODLiveStatusSource|null
|
||||
remove(id:api.ODValidId): api.ODLiveStatusSource|null
|
||||
|
||||
remove(id:ODValidId): ODLiveStatusSource|null {
|
||||
remove(id:api.ODValidId): api.ODLiveStatusSource|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODLiveStatusManagerIds_Default): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,7 @@
|
||||
///////////////////////////////////////
|
||||
//DEFAULT COOLDOWN MODULE
|
||||
///////////////////////////////////////
|
||||
import { ODValidId } from "../modules/base"
|
||||
import { ODCooldown, ODCooldownManager } from "../modules/cooldown"
|
||||
import * as api from "@open-discord-bots/framework/api"
|
||||
|
||||
/**## ODCooldownManagerIds_Default `interface`
|
||||
* This interface is a list of ids available in the `ODCooldownManager_Default` class.
|
||||
@@ -18,25 +17,25 @@ export interface ODCooldownManagerIds_Default {
|
||||
*
|
||||
* This default class is made for the global variable `opendiscord.cooldowns`!
|
||||
*/
|
||||
export class ODCooldownManager_Default extends ODCooldownManager {
|
||||
export class ODCooldownManager_Default extends api.ODCooldownManager {
|
||||
get<CooldownId extends keyof ODCooldownManagerIds_Default>(id:CooldownId): ODCooldownManagerIds_Default[CooldownId]
|
||||
get(id:ODValidId): ODCooldown<object>|null
|
||||
get(id:api.ODValidId): api.ODCooldown<object>|null
|
||||
|
||||
get(id:ODValidId): ODCooldown<object>|null {
|
||||
get(id:api.ODValidId): api.ODCooldown<object>|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<CooldownId extends keyof ODCooldownManagerIds_Default>(id:CooldownId): ODCooldownManagerIds_Default[CooldownId]
|
||||
remove(id:ODValidId): ODCooldown<object>|null
|
||||
remove(id:api.ODValidId): api.ODCooldown<object>|null
|
||||
|
||||
remove(id:ODValidId): ODCooldown<object>|null {
|
||||
remove(id:api.ODValidId): api.ODCooldown<object>|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODCooldownManagerIds_Default): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,7 @@
|
||||
///////////////////////////////////////
|
||||
//DEFAULT DATABASE MODULE
|
||||
///////////////////////////////////////
|
||||
import { ODOptionalPromise, ODValidId, ODValidJsonType } from "../modules/base"
|
||||
import { ODDatabaseManager, ODDatabase, ODFormattedJsonDatabase } from "../modules/database"
|
||||
import * as api from "@open-discord-bots/framework/api"
|
||||
import { ODTicketJson } from "../openticket/ticket"
|
||||
import { ODOptionJson } from "../openticket/option"
|
||||
|
||||
@@ -12,7 +11,7 @@ import { ODOptionJson } from "../openticket/option"
|
||||
*/
|
||||
export interface ODDatabaseManagerIds_Default {
|
||||
"opendiscord:global":ODFormattedJsonDatabase_DefaultGlobal,
|
||||
"opendiscord:stats":ODFormattedJsonDatabase,
|
||||
"opendiscord:stats":api.ODFormattedJsonDatabase,
|
||||
"opendiscord:tickets":ODFormattedJsonDatabase_DefaultTickets,
|
||||
"opendiscord:users":ODFormattedJsonDatabase_DefaultUsers,
|
||||
"opendiscord:options":ODFormattedJsonDatabase_DefaultOptions,
|
||||
@@ -24,25 +23,25 @@ export interface ODDatabaseManagerIds_Default {
|
||||
*
|
||||
* This default class is made for the global variable `opendiscord.databases`!
|
||||
*/
|
||||
export class ODDatabaseManager_Default extends ODDatabaseManager {
|
||||
export class ODDatabaseManager_Default extends api.ODDatabaseManager {
|
||||
get<DatabaseId extends keyof ODDatabaseManagerIds_Default>(id:DatabaseId): ODDatabaseManagerIds_Default[DatabaseId]
|
||||
get(id:ODValidId): ODDatabase|null
|
||||
get(id:api.ODValidId): api.ODDatabase|null
|
||||
|
||||
get(id:ODValidId): ODDatabase|null {
|
||||
get(id:api.ODValidId): api.ODDatabase|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<DatabaseId extends keyof ODDatabaseManagerIds_Default>(id:DatabaseId): ODDatabaseManagerIds_Default[DatabaseId]
|
||||
remove(id:ODValidId): ODDatabase|null
|
||||
remove(id:api.ODValidId): api.ODDatabase|null
|
||||
|
||||
remove(id:ODValidId): ODDatabase|null {
|
||||
remove(id:api.ODValidId): api.ODDatabase|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODDatabaseManagerIds_Default): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
}
|
||||
@@ -65,39 +64,39 @@ export interface ODFormattedJsonDatabaseIds_DefaultGlobal {
|
||||
*
|
||||
* This default class is made for the `global.json` database!
|
||||
*/
|
||||
export class ODFormattedJsonDatabase_DefaultGlobal extends ODFormattedJsonDatabase {
|
||||
set<CategoryId extends keyof ODFormattedJsonDatabaseIds_DefaultGlobal>(category:CategoryId, key:string, value:ODFormattedJsonDatabaseIds_DefaultGlobal[CategoryId]): ODOptionalPromise<boolean>
|
||||
set(category:string, key:string, value:ODValidJsonType): ODOptionalPromise<boolean>
|
||||
export class ODFormattedJsonDatabase_DefaultGlobal extends api.ODFormattedJsonDatabase {
|
||||
set<CategoryId extends keyof ODFormattedJsonDatabaseIds_DefaultGlobal>(category:CategoryId, key:string, value:ODFormattedJsonDatabaseIds_DefaultGlobal[CategoryId]): api.ODOptionalPromise<boolean>
|
||||
set(category:string, key:string, value:api.ODValidJsonType): api.ODOptionalPromise<boolean>
|
||||
|
||||
set(category:string, key:string, value:ODValidJsonType): ODOptionalPromise<boolean> {
|
||||
set(category:string, key:string, value:api.ODValidJsonType): api.ODOptionalPromise<boolean> {
|
||||
return super.set(category,key,value)
|
||||
}
|
||||
|
||||
get<CategoryId extends keyof ODFormattedJsonDatabaseIds_DefaultGlobal>(category:CategoryId, key:string): ODOptionalPromise<ODFormattedJsonDatabaseIds_DefaultGlobal[CategoryId]|undefined>
|
||||
get(category:string, key:string): ODOptionalPromise<ODValidJsonType|undefined>
|
||||
get<CategoryId extends keyof ODFormattedJsonDatabaseIds_DefaultGlobal>(category:CategoryId, key:string): api.ODOptionalPromise<ODFormattedJsonDatabaseIds_DefaultGlobal[CategoryId]|undefined>
|
||||
get(category:string, key:string): api.ODOptionalPromise<api.ODValidJsonType|undefined>
|
||||
|
||||
get(category:string, key:string): ODOptionalPromise<ODValidJsonType|undefined> {
|
||||
get(category:string, key:string): api.ODOptionalPromise<api.ODValidJsonType|undefined> {
|
||||
return super.get(category,key)
|
||||
}
|
||||
|
||||
delete<CategoryId extends keyof ODFormattedJsonDatabaseIds_DefaultGlobal>(category:CategoryId, key:string): ODOptionalPromise<boolean>
|
||||
delete(category:string, key:string): ODOptionalPromise<boolean>
|
||||
delete<CategoryId extends keyof ODFormattedJsonDatabaseIds_DefaultGlobal>(category:CategoryId, key:string): api.ODOptionalPromise<boolean>
|
||||
delete(category:string, key:string): api.ODOptionalPromise<boolean>
|
||||
|
||||
delete(category:string, key:string): ODOptionalPromise<boolean> {
|
||||
delete(category:string, key:string): api.ODOptionalPromise<boolean> {
|
||||
return super.delete(category,key)
|
||||
}
|
||||
|
||||
exists(category:keyof ODFormattedJsonDatabaseIds_DefaultGlobal, key:string): ODOptionalPromise<boolean>
|
||||
exists(category:string, key:string): ODOptionalPromise<boolean>
|
||||
exists(category:keyof ODFormattedJsonDatabaseIds_DefaultGlobal, key:string): api.ODOptionalPromise<boolean>
|
||||
exists(category:string, key:string): api.ODOptionalPromise<boolean>
|
||||
|
||||
exists(category:string, key:string): ODOptionalPromise<boolean> {
|
||||
exists(category:string, key:string): api.ODOptionalPromise<boolean> {
|
||||
return super.exists(category,key)
|
||||
}
|
||||
|
||||
getCategory<CategoryId extends keyof ODFormattedJsonDatabaseIds_DefaultGlobal>(category:CategoryId): ODOptionalPromise<{key:string, value:ODFormattedJsonDatabaseIds_DefaultGlobal[CategoryId]}[]|undefined>
|
||||
getCategory(category:string): ODOptionalPromise<{key:string, value:ODValidJsonType}[]|undefined>
|
||||
getCategory<CategoryId extends keyof ODFormattedJsonDatabaseIds_DefaultGlobal>(category:CategoryId): api.ODOptionalPromise<{key:string, value:ODFormattedJsonDatabaseIds_DefaultGlobal[CategoryId]}[]|undefined>
|
||||
getCategory(category:string): api.ODOptionalPromise<{key:string, value:api.ODValidJsonType}[]|undefined>
|
||||
|
||||
getCategory(category:string): ODOptionalPromise<{key:string, value:ODValidJsonType}[]|undefined> {
|
||||
getCategory(category:string): api.ODOptionalPromise<{key:string, value:api.ODValidJsonType}[]|undefined> {
|
||||
return super.getCategory(category)
|
||||
}
|
||||
}
|
||||
@@ -116,39 +115,39 @@ export interface ODFormattedJsonDatabaseIds_DefaultTickets {
|
||||
*
|
||||
* This default class is made for the `tickets.json` database!
|
||||
*/
|
||||
export class ODFormattedJsonDatabase_DefaultTickets extends ODFormattedJsonDatabase {
|
||||
set<CategoryId extends keyof ODFormattedJsonDatabaseIds_DefaultTickets>(category:CategoryId, key:string, value:ODFormattedJsonDatabaseIds_DefaultTickets[CategoryId]): ODOptionalPromise<boolean>
|
||||
set(category:string, key:string, value:ODValidJsonType): ODOptionalPromise<boolean>
|
||||
export class ODFormattedJsonDatabase_DefaultTickets extends api.ODFormattedJsonDatabase {
|
||||
set<CategoryId extends keyof ODFormattedJsonDatabaseIds_DefaultTickets>(category:CategoryId, key:string, value:ODFormattedJsonDatabaseIds_DefaultTickets[CategoryId]): api.ODOptionalPromise<boolean>
|
||||
set(category:string, key:string, value:api.ODValidJsonType): api.ODOptionalPromise<boolean>
|
||||
|
||||
set(category:string, key:string, value:ODValidJsonType): ODOptionalPromise<boolean> {
|
||||
set(category:string, key:string, value:api.ODValidJsonType): api.ODOptionalPromise<boolean> {
|
||||
return super.set(category,key,value)
|
||||
}
|
||||
|
||||
get<CategoryId extends keyof ODFormattedJsonDatabaseIds_DefaultTickets>(category:CategoryId, key:string): ODOptionalPromise<ODFormattedJsonDatabaseIds_DefaultTickets[CategoryId]|undefined>
|
||||
get(category:string, key:string): ODOptionalPromise<ODValidJsonType|undefined>
|
||||
get<CategoryId extends keyof ODFormattedJsonDatabaseIds_DefaultTickets>(category:CategoryId, key:string): api.ODOptionalPromise<ODFormattedJsonDatabaseIds_DefaultTickets[CategoryId]|undefined>
|
||||
get(category:string, key:string): api.ODOptionalPromise<api.ODValidJsonType|undefined>
|
||||
|
||||
get(category:string, key:string): ODOptionalPromise<ODValidJsonType|undefined> {
|
||||
get(category:string, key:string): api.ODOptionalPromise<api.ODValidJsonType|undefined> {
|
||||
return super.get(category,key)
|
||||
}
|
||||
|
||||
delete<CategoryId extends keyof ODFormattedJsonDatabaseIds_DefaultTickets>(category:CategoryId, key:string): ODOptionalPromise<boolean>
|
||||
delete(category:string, key:string): ODOptionalPromise<boolean>
|
||||
delete<CategoryId extends keyof ODFormattedJsonDatabaseIds_DefaultTickets>(category:CategoryId, key:string): api.ODOptionalPromise<boolean>
|
||||
delete(category:string, key:string): api.ODOptionalPromise<boolean>
|
||||
|
||||
delete(category:string, key:string): ODOptionalPromise<boolean> {
|
||||
delete(category:string, key:string): api.ODOptionalPromise<boolean> {
|
||||
return super.delete(category,key)
|
||||
}
|
||||
|
||||
exists(category:keyof ODFormattedJsonDatabaseIds_DefaultTickets, key:string): ODOptionalPromise<boolean>
|
||||
exists(category:string, key:string): ODOptionalPromise<boolean>
|
||||
exists(category:keyof ODFormattedJsonDatabaseIds_DefaultTickets, key:string): api.ODOptionalPromise<boolean>
|
||||
exists(category:string, key:string): api.ODOptionalPromise<boolean>
|
||||
|
||||
exists(category:string, key:string): ODOptionalPromise<boolean> {
|
||||
exists(category:string, key:string): api.ODOptionalPromise<boolean> {
|
||||
return super.exists(category,key)
|
||||
}
|
||||
|
||||
getCategory<CategoryId extends keyof ODFormattedJsonDatabaseIds_DefaultTickets>(category:CategoryId): ODOptionalPromise<{key:string, value:ODFormattedJsonDatabaseIds_DefaultTickets[CategoryId]}[]|undefined>
|
||||
getCategory(category:string): ODOptionalPromise<{key:string, value:ODValidJsonType}[]|undefined>
|
||||
getCategory<CategoryId extends keyof ODFormattedJsonDatabaseIds_DefaultTickets>(category:CategoryId): api.ODOptionalPromise<{key:string, value:ODFormattedJsonDatabaseIds_DefaultTickets[CategoryId]}[]|undefined>
|
||||
getCategory(category:string): api.ODOptionalPromise<{key:string, value:api.ODValidJsonType}[]|undefined>
|
||||
|
||||
getCategory(category:string): ODOptionalPromise<{key:string, value:ODValidJsonType}[]|undefined> {
|
||||
getCategory(category:string): api.ODOptionalPromise<{key:string, value:api.ODValidJsonType}[]|undefined> {
|
||||
return super.getCategory(category)
|
||||
}
|
||||
}
|
||||
@@ -167,39 +166,39 @@ export interface ODFormattedJsonDatabaseIds_DefaultUsers {
|
||||
*
|
||||
* This default class is made for the `users.json` database!
|
||||
*/
|
||||
export class ODFormattedJsonDatabase_DefaultUsers extends ODFormattedJsonDatabase {
|
||||
set<CategoryId extends keyof ODFormattedJsonDatabaseIds_DefaultUsers>(category:CategoryId, key:string, value:ODFormattedJsonDatabaseIds_DefaultUsers[CategoryId]): ODOptionalPromise<boolean>
|
||||
set(category:string, key:string, value:ODValidJsonType): ODOptionalPromise<boolean>
|
||||
export class ODFormattedJsonDatabase_DefaultUsers extends api.ODFormattedJsonDatabase {
|
||||
set<CategoryId extends keyof ODFormattedJsonDatabaseIds_DefaultUsers>(category:CategoryId, key:string, value:ODFormattedJsonDatabaseIds_DefaultUsers[CategoryId]): api.ODOptionalPromise<boolean>
|
||||
set(category:string, key:string, value:api.ODValidJsonType): api.ODOptionalPromise<boolean>
|
||||
|
||||
set(category:string, key:string, value:ODValidJsonType): ODOptionalPromise<boolean> {
|
||||
set(category:string, key:string, value:api.ODValidJsonType): api.ODOptionalPromise<boolean> {
|
||||
return super.set(category,key,value)
|
||||
}
|
||||
|
||||
get<CategoryId extends keyof ODFormattedJsonDatabaseIds_DefaultUsers>(category:CategoryId, key:string): ODOptionalPromise<ODFormattedJsonDatabaseIds_DefaultUsers[CategoryId]|undefined>
|
||||
get(category:string, key:string): ODOptionalPromise<ODValidJsonType|undefined>
|
||||
get<CategoryId extends keyof ODFormattedJsonDatabaseIds_DefaultUsers>(category:CategoryId, key:string): api.ODOptionalPromise<ODFormattedJsonDatabaseIds_DefaultUsers[CategoryId]|undefined>
|
||||
get(category:string, key:string): api.ODOptionalPromise<api.ODValidJsonType|undefined>
|
||||
|
||||
get(category:string, key:string): ODOptionalPromise<ODValidJsonType|undefined> {
|
||||
get(category:string, key:string): api.ODOptionalPromise<api.ODValidJsonType|undefined> {
|
||||
return super.get(category,key)
|
||||
}
|
||||
|
||||
delete<CategoryId extends keyof ODFormattedJsonDatabaseIds_DefaultUsers>(category:CategoryId, key:string): ODOptionalPromise<boolean>
|
||||
delete(category:string, key:string): ODOptionalPromise<boolean>
|
||||
delete<CategoryId extends keyof ODFormattedJsonDatabaseIds_DefaultUsers>(category:CategoryId, key:string): api.ODOptionalPromise<boolean>
|
||||
delete(category:string, key:string): api.ODOptionalPromise<boolean>
|
||||
|
||||
delete(category:string, key:string): ODOptionalPromise<boolean> {
|
||||
delete(category:string, key:string): api.ODOptionalPromise<boolean> {
|
||||
return super.delete(category,key)
|
||||
}
|
||||
|
||||
exists(category:keyof ODFormattedJsonDatabaseIds_DefaultUsers, key:string): ODOptionalPromise<boolean>
|
||||
exists(category:string, key:string): ODOptionalPromise<boolean>
|
||||
exists(category:keyof ODFormattedJsonDatabaseIds_DefaultUsers, key:string): api.ODOptionalPromise<boolean>
|
||||
exists(category:string, key:string): api.ODOptionalPromise<boolean>
|
||||
|
||||
exists(category:string, key:string): ODOptionalPromise<boolean> {
|
||||
exists(category:string, key:string): api.ODOptionalPromise<boolean> {
|
||||
return super.exists(category,key)
|
||||
}
|
||||
|
||||
getCategory<CategoryId extends keyof ODFormattedJsonDatabaseIds_DefaultUsers>(category:CategoryId): ODOptionalPromise<{key:string, value:ODFormattedJsonDatabaseIds_DefaultUsers[CategoryId]}[]|undefined>
|
||||
getCategory(category:string): ODOptionalPromise<{key:string, value:ODValidJsonType}[]|undefined>
|
||||
getCategory<CategoryId extends keyof ODFormattedJsonDatabaseIds_DefaultUsers>(category:CategoryId): api.ODOptionalPromise<{key:string, value:ODFormattedJsonDatabaseIds_DefaultUsers[CategoryId]}[]|undefined>
|
||||
getCategory(category:string): api.ODOptionalPromise<{key:string, value:api.ODValidJsonType}[]|undefined>
|
||||
|
||||
getCategory(category:string): ODOptionalPromise<{key:string, value:ODValidJsonType}[]|undefined> {
|
||||
getCategory(category:string): api.ODOptionalPromise<{key:string, value:api.ODValidJsonType}[]|undefined> {
|
||||
return super.getCategory(category)
|
||||
}
|
||||
}
|
||||
@@ -219,39 +218,39 @@ export interface ODFormattedJsonDatabaseIds_DefaultOptions {
|
||||
*
|
||||
* This default class is made for the `options.json` database!
|
||||
*/
|
||||
export class ODFormattedJsonDatabase_DefaultOptions extends ODFormattedJsonDatabase {
|
||||
set<CategoryId extends keyof ODFormattedJsonDatabaseIds_DefaultOptions>(category:CategoryId, key:string, value:ODFormattedJsonDatabaseIds_DefaultOptions[CategoryId]): ODOptionalPromise<boolean>
|
||||
set(category:string, key:string, value:ODValidJsonType): ODOptionalPromise<boolean>
|
||||
export class ODFormattedJsonDatabase_DefaultOptions extends api.ODFormattedJsonDatabase {
|
||||
set<CategoryId extends keyof ODFormattedJsonDatabaseIds_DefaultOptions>(category:CategoryId, key:string, value:ODFormattedJsonDatabaseIds_DefaultOptions[CategoryId]): api.ODOptionalPromise<boolean>
|
||||
set(category:string, key:string, value:api.ODValidJsonType): api.ODOptionalPromise<boolean>
|
||||
|
||||
set(category:string, key:string, value:ODValidJsonType): ODOptionalPromise<boolean> {
|
||||
set(category:string, key:string, value:api.ODValidJsonType): api.ODOptionalPromise<boolean> {
|
||||
return super.set(category,key,value)
|
||||
}
|
||||
|
||||
get<CategoryId extends keyof ODFormattedJsonDatabaseIds_DefaultOptions>(category:CategoryId, key:string): ODOptionalPromise<ODFormattedJsonDatabaseIds_DefaultOptions[CategoryId]|undefined>
|
||||
get(category:string, key:string): ODOptionalPromise<ODValidJsonType|undefined>
|
||||
get<CategoryId extends keyof ODFormattedJsonDatabaseIds_DefaultOptions>(category:CategoryId, key:string): api.ODOptionalPromise<ODFormattedJsonDatabaseIds_DefaultOptions[CategoryId]|undefined>
|
||||
get(category:string, key:string): api.ODOptionalPromise<api.ODValidJsonType|undefined>
|
||||
|
||||
get(category:string, key:string): ODOptionalPromise<ODValidJsonType|undefined> {
|
||||
get(category:string, key:string): api.ODOptionalPromise<api.ODValidJsonType|undefined> {
|
||||
return super.get(category,key)
|
||||
}
|
||||
|
||||
delete<CategoryId extends keyof ODFormattedJsonDatabaseIds_DefaultOptions>(category:CategoryId, key:string): ODOptionalPromise<boolean>
|
||||
delete(category:string, key:string): ODOptionalPromise<boolean>
|
||||
delete<CategoryId extends keyof ODFormattedJsonDatabaseIds_DefaultOptions>(category:CategoryId, key:string): api.ODOptionalPromise<boolean>
|
||||
delete(category:string, key:string): api.ODOptionalPromise<boolean>
|
||||
|
||||
delete(category:string, key:string): ODOptionalPromise<boolean> {
|
||||
delete(category:string, key:string): api.ODOptionalPromise<boolean> {
|
||||
return super.delete(category,key)
|
||||
}
|
||||
|
||||
exists(category:keyof ODFormattedJsonDatabaseIds_DefaultOptions, key:string): ODOptionalPromise<boolean>
|
||||
exists(category:string, key:string): ODOptionalPromise<boolean>
|
||||
exists(category:keyof ODFormattedJsonDatabaseIds_DefaultOptions, key:string): api.ODOptionalPromise<boolean>
|
||||
exists(category:string, key:string): api.ODOptionalPromise<boolean>
|
||||
|
||||
exists(category:string, key:string): ODOptionalPromise<boolean> {
|
||||
exists(category:string, key:string): api.ODOptionalPromise<boolean> {
|
||||
return super.exists(category,key)
|
||||
}
|
||||
|
||||
getCategory<CategoryId extends keyof ODFormattedJsonDatabaseIds_DefaultOptions>(category:CategoryId): ODOptionalPromise<{key:string, value:ODFormattedJsonDatabaseIds_DefaultOptions[CategoryId]}[]|undefined>
|
||||
getCategory(category:string): ODOptionalPromise<{key:string, value:ODValidJsonType}[]|undefined>
|
||||
getCategory<CategoryId extends keyof ODFormattedJsonDatabaseIds_DefaultOptions>(category:CategoryId): api.ODOptionalPromise<{key:string, value:ODFormattedJsonDatabaseIds_DefaultOptions[CategoryId]}[]|undefined>
|
||||
getCategory(category:string): api.ODOptionalPromise<{key:string, value:api.ODValidJsonType}[]|undefined>
|
||||
|
||||
getCategory(category:string): ODOptionalPromise<{key:string, value:ODValidJsonType}[]|undefined> {
|
||||
getCategory(category:string): api.ODOptionalPromise<{key:string, value:api.ODValidJsonType}[]|undefined> {
|
||||
return super.getCategory(category)
|
||||
}
|
||||
}
|
||||
+211
-217
@@ -2,13 +2,7 @@
|
||||
//DEFAULT EVENT MODULE
|
||||
///////////////////////////////////////
|
||||
//BASE MODULES
|
||||
import { ODPromiseVoid, ODValidId } from "../modules/base"
|
||||
import { ODConsoleManager, ODError } from "../modules/console"
|
||||
import { ODCheckerResult, ODCheckerStorage } from "../modules/checker"
|
||||
import { ODDefaultsManager } from "../modules/defaults"
|
||||
import { ODLanguage } from "../modules/language"
|
||||
import { ODClientActivityManager } from "../modules/client"
|
||||
import { ODEvent, ODEventManager } from "../modules/event"
|
||||
import * as api from "@open-discord-bots/framework/api"
|
||||
import * as discord from "discord.js"
|
||||
|
||||
//DEFAULT MODULES
|
||||
@@ -50,292 +44,292 @@ import { ODPriorityLevel, ODPriorityManager_Default } from "../openticket/priori
|
||||
*/
|
||||
export interface ODEventIds_Default {
|
||||
//error handling
|
||||
"onErrorHandling": ODEvent_Default<(error:Error, origin:NodeJS.UncaughtExceptionOrigin) => ODPromiseVoid>
|
||||
"afterErrorHandling": ODEvent_Default<(error:Error, origin:NodeJS.UncaughtExceptionOrigin, message:ODError) => ODPromiseVoid>
|
||||
"onErrorHandling": ODEvent_Default<(error:Error, origin:NodeJS.UncaughtExceptionOrigin) => api.ODPromiseVoid>
|
||||
"afterErrorHandling": ODEvent_Default<(error:Error, origin:NodeJS.UncaughtExceptionOrigin, message:api.ODError) => api.ODPromiseVoid>
|
||||
|
||||
//plugins
|
||||
"afterPluginsLoaded": ODEvent_Default<(plugins:ODPluginManager_Default) => ODPromiseVoid>
|
||||
"onPluginClassLoad": ODEvent_Default<(classes:ODPluginClassManager_Default, plugins:ODPluginManager_Default) => ODPromiseVoid>
|
||||
"afterPluginClassesLoaded": ODEvent_Default<(classes:ODPluginClassManager_Default, plugins:ODPluginManager_Default) => ODPromiseVoid>
|
||||
"afterPluginsLoaded": ODEvent_Default<(plugins:ODPluginManager_Default) => api.ODPromiseVoid>
|
||||
"onPluginClassLoad": ODEvent_Default<(classes:ODPluginClassManager_Default, plugins:ODPluginManager_Default) => api.ODPromiseVoid>
|
||||
"afterPluginClassesLoaded": ODEvent_Default<(classes:ODPluginClassManager_Default, plugins:ODPluginManager_Default) => api.ODPromiseVoid>
|
||||
|
||||
//flags
|
||||
"onFlagLoad": ODEvent_Default<(flags:ODFlagManager_Default) => ODPromiseVoid>
|
||||
"afterFlagsLoaded": ODEvent_Default<(flags:ODFlagManager_Default) => ODPromiseVoid>
|
||||
"onFlagInit": ODEvent_Default<(flags:ODFlagManager_Default) => ODPromiseVoid>
|
||||
"afterFlagsInitiated": ODEvent_Default<(flags:ODFlagManager_Default) => ODPromiseVoid>
|
||||
"onFlagLoad": ODEvent_Default<(flags:ODFlagManager_Default) => api.ODPromiseVoid>
|
||||
"afterFlagsLoaded": ODEvent_Default<(flags:ODFlagManager_Default) => api.ODPromiseVoid>
|
||||
"onFlagInit": ODEvent_Default<(flags:ODFlagManager_Default) => api.ODPromiseVoid>
|
||||
"afterFlagsInitiated": ODEvent_Default<(flags:ODFlagManager_Default) => api.ODPromiseVoid>
|
||||
|
||||
//progress bars
|
||||
"onProgressBarRendererLoad": ODEvent_Default<(renderers:ODProgressBarRendererManager_Default) => ODPromiseVoid>
|
||||
"afterProgressBarRenderersLoaded": ODEvent_Default<(renderers:ODProgressBarRendererManager_Default) => ODPromiseVoid>
|
||||
"onProgressBarLoad": ODEvent_Default<(progressbars:ODProgressBarManager_Default) => ODPromiseVoid>
|
||||
"afterProgressBarsLoaded": ODEvent_Default<(progressbars:ODProgressBarManager_Default) => ODPromiseVoid>
|
||||
"onProgressBarRendererLoad": ODEvent_Default<(renderers:ODProgressBarRendererManager_Default) => api.ODPromiseVoid>
|
||||
"afterProgressBarRenderersLoaded": ODEvent_Default<(renderers:ODProgressBarRendererManager_Default) => api.ODPromiseVoid>
|
||||
"onProgressBarLoad": ODEvent_Default<(progressbars:ODProgressBarManager_Default) => api.ODPromiseVoid>
|
||||
"afterProgressBarsLoaded": ODEvent_Default<(progressbars:ODProgressBarManager_Default) => api.ODPromiseVoid>
|
||||
|
||||
//configs
|
||||
"onConfigLoad": ODEvent_Default<(configs:ODConfigManager_Default) => ODPromiseVoid>
|
||||
"afterConfigsLoaded": ODEvent_Default<(configs:ODConfigManager_Default) => ODPromiseVoid>
|
||||
"onConfigInit": ODEvent_Default<(configs:ODConfigManager_Default) => ODPromiseVoid>
|
||||
"afterConfigsInitiated": ODEvent_Default<(configs:ODConfigManager_Default) => ODPromiseVoid>
|
||||
"onConfigLoad": ODEvent_Default<(configs:ODConfigManager_Default) => api.ODPromiseVoid>
|
||||
"afterConfigsLoaded": ODEvent_Default<(configs:ODConfigManager_Default) => api.ODPromiseVoid>
|
||||
"onConfigInit": ODEvent_Default<(configs:ODConfigManager_Default) => api.ODPromiseVoid>
|
||||
"afterConfigsInitiated": ODEvent_Default<(configs:ODConfigManager_Default) => api.ODPromiseVoid>
|
||||
|
||||
//databases
|
||||
"onDatabaseLoad": ODEvent_Default<(databases:ODDatabaseManager_Default) => ODPromiseVoid>
|
||||
"afterDatabasesLoaded": ODEvent_Default<(databases:ODDatabaseManager_Default) => ODPromiseVoid>
|
||||
"onDatabaseInit": ODEvent_Default<(databases:ODDatabaseManager_Default) => ODPromiseVoid>
|
||||
"afterDatabasesInitiated": ODEvent_Default<(databases:ODDatabaseManager_Default) => ODPromiseVoid>
|
||||
"onDatabaseLoad": ODEvent_Default<(databases:ODDatabaseManager_Default) => api.ODPromiseVoid>
|
||||
"afterDatabasesLoaded": ODEvent_Default<(databases:ODDatabaseManager_Default) => api.ODPromiseVoid>
|
||||
"onDatabaseInit": ODEvent_Default<(databases:ODDatabaseManager_Default) => api.ODPromiseVoid>
|
||||
"afterDatabasesInitiated": ODEvent_Default<(databases:ODDatabaseManager_Default) => api.ODPromiseVoid>
|
||||
|
||||
//languages
|
||||
"onLanguageLoad": ODEvent_Default<(languages:ODLanguageManager_Default) => ODPromiseVoid>
|
||||
"afterLanguagesLoaded": ODEvent_Default<(languages:ODLanguageManager_Default) => ODPromiseVoid>
|
||||
"onLanguageInit": ODEvent_Default<(languages:ODLanguageManager_Default) => ODPromiseVoid>
|
||||
"afterLanguagesInitiated": ODEvent_Default<(languages:ODLanguageManager_Default) => ODPromiseVoid>
|
||||
"onLanguageSelect": ODEvent_Default<(languages:ODLanguageManager_Default) => ODPromiseVoid>
|
||||
"afterLanguagesSelected": ODEvent_Default<(main:ODLanguage|null, backup:ODLanguage|null, languages:ODLanguageManager_Default) => ODPromiseVoid>
|
||||
"onLanguageLoad": ODEvent_Default<(languages:ODLanguageManager_Default) => api.ODPromiseVoid>
|
||||
"afterLanguagesLoaded": ODEvent_Default<(languages:ODLanguageManager_Default) => api.ODPromiseVoid>
|
||||
"onLanguageInit": ODEvent_Default<(languages:ODLanguageManager_Default) => api.ODPromiseVoid>
|
||||
"afterLanguagesInitiated": ODEvent_Default<(languages:ODLanguageManager_Default) => api.ODPromiseVoid>
|
||||
"onLanguageSelect": ODEvent_Default<(languages:ODLanguageManager_Default) => api.ODPromiseVoid>
|
||||
"afterLanguagesSelected": ODEvent_Default<(main:api.ODLanguage|null, backup:api.ODLanguage|null, languages:ODLanguageManager_Default) => api.ODPromiseVoid>
|
||||
|
||||
//sessions
|
||||
"onSessionLoad": ODEvent_Default<(languages:ODSessionManager_Default) => ODPromiseVoid>
|
||||
"afterSessionsLoaded": ODEvent_Default<(languages:ODSessionManager_Default) => ODPromiseVoid>
|
||||
"onSessionLoad": ODEvent_Default<(languages:ODSessionManager_Default) => api.ODPromiseVoid>
|
||||
"afterSessionsLoaded": ODEvent_Default<(languages:ODSessionManager_Default) => api.ODPromiseVoid>
|
||||
|
||||
//config checkers
|
||||
"onCheckerLoad": ODEvent_Default<(checkers:ODCheckerManager_Default) => ODPromiseVoid>
|
||||
"afterCheckersLoaded": ODEvent_Default<(checkers:ODCheckerManager_Default) => ODPromiseVoid>
|
||||
"onCheckerFunctionLoad": ODEvent_Default<(functions:ODCheckerFunctionManager_Default, checkers:ODCheckerManager_Default) => ODPromiseVoid>
|
||||
"afterCheckerFunctionsLoaded": ODEvent_Default<(functions:ODCheckerFunctionManager_Default, checkers:ODCheckerManager_Default) => ODPromiseVoid>
|
||||
"onCheckerExecute": ODEvent_Default<(checkers:ODCheckerManager_Default) => ODPromiseVoid>
|
||||
"afterCheckersExecuted": ODEvent_Default<(result:ODCheckerResult, checkers:ODCheckerManager_Default) => ODPromiseVoid>
|
||||
"onCheckerTranslationLoad": ODEvent_Default<(translations:ODCheckerTranslationRegister_Default, enabled:boolean, checkers:ODCheckerManager_Default) => ODPromiseVoid>
|
||||
"afterCheckerTranslationsLoaded": ODEvent_Default<(translations:ODCheckerTranslationRegister_Default, checkers:ODCheckerManager_Default) => ODPromiseVoid>
|
||||
"onCheckerRender": ODEvent_Default<(renderer:ODCheckerRenderer_Default, checkers:ODCheckerManager_Default) => ODPromiseVoid>
|
||||
"afterCheckersRendered": ODEvent_Default<(renderer:ODCheckerRenderer_Default, checkers:ODCheckerManager_Default) => ODPromiseVoid>
|
||||
"onCheckerQuit": ODEvent_Default<(checkers:ODCheckerManager_Default) => ODPromiseVoid>
|
||||
"onCheckerLoad": ODEvent_Default<(checkers:ODCheckerManager_Default) => api.ODPromiseVoid>
|
||||
"afterCheckersLoaded": ODEvent_Default<(checkers:ODCheckerManager_Default) => api.ODPromiseVoid>
|
||||
"onCheckerFunctionLoad": ODEvent_Default<(functions:ODCheckerFunctionManager_Default, checkers:ODCheckerManager_Default) => api.ODPromiseVoid>
|
||||
"afterCheckerFunctionsLoaded": ODEvent_Default<(functions:ODCheckerFunctionManager_Default, checkers:ODCheckerManager_Default) => api.ODPromiseVoid>
|
||||
"onCheckerExecute": ODEvent_Default<(checkers:ODCheckerManager_Default) => api.ODPromiseVoid>
|
||||
"afterCheckersExecuted": ODEvent_Default<(result:api.ODCheckerResult, checkers:ODCheckerManager_Default) => api.ODPromiseVoid>
|
||||
"onCheckerTranslationLoad": ODEvent_Default<(translations:ODCheckerTranslationRegister_Default, enabled:boolean, checkers:ODCheckerManager_Default) => api.ODPromiseVoid>
|
||||
"afterCheckerTranslationsLoaded": ODEvent_Default<(translations:ODCheckerTranslationRegister_Default, checkers:ODCheckerManager_Default) => api.ODPromiseVoid>
|
||||
"onCheckerRender": ODEvent_Default<(renderer:ODCheckerRenderer_Default, checkers:ODCheckerManager_Default) => api.ODPromiseVoid>
|
||||
"afterCheckersRendered": ODEvent_Default<(renderer:ODCheckerRenderer_Default, checkers:ODCheckerManager_Default) => api.ODPromiseVoid>
|
||||
"onCheckerQuit": ODEvent_Default<(checkers:ODCheckerManager_Default) => api.ODPromiseVoid>
|
||||
|
||||
//plugin loading before client
|
||||
"onPluginBeforeClientLoad": ODEvent_Default<() => ODPromiseVoid>,
|
||||
"afterPluginBeforeClientLoaded": ODEvent_Default<() => ODPromiseVoid>,
|
||||
"onPluginBeforeClientLoad": ODEvent_Default<() => api.ODPromiseVoid>,
|
||||
"afterPluginBeforeClientLoaded": ODEvent_Default<() => api.ODPromiseVoid>,
|
||||
|
||||
//client configuration
|
||||
"onClientLoad": ODEvent_Default<(client:ODClientManager_Default) => ODPromiseVoid>
|
||||
"afterClientLoaded": ODEvent_Default<(client:ODClientManager_Default) => ODPromiseVoid>
|
||||
"onClientInit": ODEvent_Default<(client:ODClientManager_Default) => ODPromiseVoid>
|
||||
"afterClientInitiated": ODEvent_Default<(client:ODClientManager_Default) => ODPromiseVoid>
|
||||
"onClientReady": ODEvent_Default<(client:ODClientManager_Default) => ODPromiseVoid>
|
||||
"afterClientReady": ODEvent_Default<(client:ODClientManager_Default) => ODPromiseVoid>
|
||||
"onClientActivityLoad": ODEvent_Default<(activity:ODClientActivityManager, client:ODClientManager_Default) => ODPromiseVoid>
|
||||
"afterClientActivityLoaded": ODEvent_Default<(activity:ODClientActivityManager, client:ODClientManager_Default) => ODPromiseVoid>
|
||||
"onClientActivityInit": ODEvent_Default<(activity:ODClientActivityManager, client:ODClientManager_Default) => ODPromiseVoid>
|
||||
"afterClientActivityInitiated": ODEvent_Default<(activity:ODClientActivityManager, client:ODClientManager_Default) => ODPromiseVoid>
|
||||
"onClientLoad": ODEvent_Default<(client:ODClientManager_Default) => api.ODPromiseVoid>
|
||||
"afterClientLoaded": ODEvent_Default<(client:ODClientManager_Default) => api.ODPromiseVoid>
|
||||
"onClientInit": ODEvent_Default<(client:ODClientManager_Default) => api.ODPromiseVoid>
|
||||
"afterClientInitiated": ODEvent_Default<(client:ODClientManager_Default) => api.ODPromiseVoid>
|
||||
"onClientReady": ODEvent_Default<(client:ODClientManager_Default) => api.ODPromiseVoid>
|
||||
"afterClientReady": ODEvent_Default<(client:ODClientManager_Default) => api.ODPromiseVoid>
|
||||
"onClientActivityLoad": ODEvent_Default<(activity:api.ODClientActivityManager, client:ODClientManager_Default) => api.ODPromiseVoid>
|
||||
"afterClientActivityLoaded": ODEvent_Default<(activity:api.ODClientActivityManager, client:ODClientManager_Default) => api.ODPromiseVoid>
|
||||
"onClientActivityInit": ODEvent_Default<(activity:api.ODClientActivityManager, client:ODClientManager_Default) => api.ODPromiseVoid>
|
||||
"afterClientActivityInitiated": ODEvent_Default<(activity:api.ODClientActivityManager, client:ODClientManager_Default) => api.ODPromiseVoid>
|
||||
|
||||
//priority levels
|
||||
"onPriorityLoad": ODEvent_Default<(priorities:ODPriorityManager_Default) => ODPromiseVoid>
|
||||
"afterPrioritiesLoaded": ODEvent_Default<(priorities:ODPriorityManager_Default) => ODPromiseVoid>
|
||||
"onPriorityLoad": ODEvent_Default<(priorities:ODPriorityManager_Default) => api.ODPromiseVoid>
|
||||
"afterPrioritiesLoaded": ODEvent_Default<(priorities:ODPriorityManager_Default) => api.ODPromiseVoid>
|
||||
|
||||
//client slash commands
|
||||
"onSlashCommandLoad": ODEvent_Default<(slash:ODSlashCommandManager_Default, client:ODClientManager_Default) => ODPromiseVoid>
|
||||
"afterSlashCommandsLoaded": ODEvent_Default<(slash:ODSlashCommandManager_Default, client:ODClientManager_Default) => ODPromiseVoid>
|
||||
"onSlashCommandRegister": ODEvent_Default<(slash:ODSlashCommandManager_Default, client:ODClientManager_Default) => ODPromiseVoid>
|
||||
"afterSlashCommandsRegistered": ODEvent_Default<(slash:ODSlashCommandManager_Default, client:ODClientManager_Default) => ODPromiseVoid>
|
||||
"onSlashCommandLoad": ODEvent_Default<(slash:ODSlashCommandManager_Default, client:ODClientManager_Default) => api.ODPromiseVoid>
|
||||
"afterSlashCommandsLoaded": ODEvent_Default<(slash:ODSlashCommandManager_Default, client:ODClientManager_Default) => api.ODPromiseVoid>
|
||||
"onSlashCommandRegister": ODEvent_Default<(slash:ODSlashCommandManager_Default, client:ODClientManager_Default) => api.ODPromiseVoid>
|
||||
"afterSlashCommandsRegistered": ODEvent_Default<(slash:ODSlashCommandManager_Default, client:ODClientManager_Default) => api.ODPromiseVoid>
|
||||
|
||||
//client context menus
|
||||
"onContextMenuLoad": ODEvent_Default<(menu:ODContextMenuManager_Default, client:ODClientManager_Default) => ODPromiseVoid>
|
||||
"afterContextMenusLoaded": ODEvent_Default<(menu:ODContextMenuManager_Default, client:ODClientManager_Default) => ODPromiseVoid>
|
||||
"onContextMenuRegister": ODEvent_Default<(menu:ODContextMenuManager_Default, client:ODClientManager_Default) => ODPromiseVoid>
|
||||
"afterContextMenusRegistered": ODEvent_Default<(menu:ODContextMenuManager_Default, client:ODClientManager_Default) => ODPromiseVoid>
|
||||
"onContextMenuLoad": ODEvent_Default<(menu:ODContextMenuManager_Default, client:ODClientManager_Default) => api.ODPromiseVoid>
|
||||
"afterContextMenusLoaded": ODEvent_Default<(menu:ODContextMenuManager_Default, client:ODClientManager_Default) => api.ODPromiseVoid>
|
||||
"onContextMenuRegister": ODEvent_Default<(menu:ODContextMenuManager_Default, client:ODClientManager_Default) => api.ODPromiseVoid>
|
||||
"afterContextMenusRegistered": ODEvent_Default<(menu:ODContextMenuManager_Default, client:ODClientManager_Default) => api.ODPromiseVoid>
|
||||
|
||||
//client text commands
|
||||
"onTextCommandLoad": ODEvent_Default<(text:ODTextCommandManager_Default, client:ODClientManager_Default,) => ODPromiseVoid>
|
||||
"afterTextCommandsLoaded": ODEvent_Default<(text:ODTextCommandManager_Default, client:ODClientManager_Default) => ODPromiseVoid>
|
||||
"onTextCommandLoad": ODEvent_Default<(text:ODTextCommandManager_Default, client:ODClientManager_Default,) => api.ODPromiseVoid>
|
||||
"afterTextCommandsLoaded": ODEvent_Default<(text:ODTextCommandManager_Default, client:ODClientManager_Default) => api.ODPromiseVoid>
|
||||
|
||||
//plugin loading before managers
|
||||
"onPluginBeforeManagerLoad": ODEvent_Default<() => ODPromiseVoid>,
|
||||
"afterPluginBeforeManagerLoaded": ODEvent_Default<() => ODPromiseVoid>,
|
||||
"onPluginBeforeManagerLoad": ODEvent_Default<() => api.ODPromiseVoid>,
|
||||
"afterPluginBeforeManagerLoaded": ODEvent_Default<() => api.ODPromiseVoid>,
|
||||
|
||||
//questions
|
||||
"onQuestionLoad": ODEvent_Default<(questions:ODQuestionManager) => ODPromiseVoid>
|
||||
"afterQuestionsLoaded": ODEvent_Default<(questions:ODQuestionManager) => ODPromiseVoid>
|
||||
"onQuestionLoad": ODEvent_Default<(questions:ODQuestionManager) => api.ODPromiseVoid>
|
||||
"afterQuestionsLoaded": ODEvent_Default<(questions:ODQuestionManager) => api.ODPromiseVoid>
|
||||
|
||||
//options
|
||||
"onOptionLoad": ODEvent_Default<(options:ODOptionManager) => ODPromiseVoid>
|
||||
"afterOptionsLoaded": ODEvent_Default<(options:ODOptionManager) => ODPromiseVoid>
|
||||
"onOptionLoad": ODEvent_Default<(options:ODOptionManager) => api.ODPromiseVoid>
|
||||
"afterOptionsLoaded": ODEvent_Default<(options:ODOptionManager) => api.ODPromiseVoid>
|
||||
|
||||
//panels
|
||||
"onPanelLoad": ODEvent_Default<(panels:ODPanelManager) => ODPromiseVoid>
|
||||
"afterPanelsLoaded": ODEvent_Default<(panels:ODPanelManager) => ODPromiseVoid>
|
||||
"onPanelSpawn": ODEvent_Default<(panel:ODPanel) => ODPromiseVoid>
|
||||
"afterPanelSpawned": ODEvent_Default<(panel:ODPanel) => ODPromiseVoid>
|
||||
"onPanelLoad": ODEvent_Default<(panels:ODPanelManager) => api.ODPromiseVoid>
|
||||
"afterPanelsLoaded": ODEvent_Default<(panels:ODPanelManager) => api.ODPromiseVoid>
|
||||
"onPanelSpawn": ODEvent_Default<(panel:ODPanel) => api.ODPromiseVoid>
|
||||
"afterPanelSpawned": ODEvent_Default<(panel:ODPanel) => api.ODPromiseVoid>
|
||||
|
||||
//tickets
|
||||
"onTicketLoad": ODEvent_Default<(tickets:ODTicketManager) => ODPromiseVoid>
|
||||
"afterTicketsLoaded": ODEvent_Default<(tickets:ODTicketManager) => ODPromiseVoid>
|
||||
"onTicketLoad": ODEvent_Default<(tickets:ODTicketManager) => api.ODPromiseVoid>
|
||||
"afterTicketsLoaded": ODEvent_Default<(tickets:ODTicketManager) => api.ODPromiseVoid>
|
||||
|
||||
//ticket creation
|
||||
"onTicketChannelCreation": ODEvent_Default<(option:ODTicketOption, user:discord.User) => ODPromiseVoid>
|
||||
"afterTicketChannelCreated": ODEvent_Default<(option:ODTicketOption, channel:discord.GuildTextBasedChannel, user:discord.User) => ODPromiseVoid>
|
||||
"onTicketChannelDeletion": ODEvent_Default<(ticket:ODTicket, channel:discord.GuildTextBasedChannel, user:discord.User) => ODPromiseVoid>
|
||||
"afterTicketChannelDeleted": ODEvent_Default<(ticket:ODTicket, user:discord.User) => ODPromiseVoid>
|
||||
"onTicketPermissionsCreated": ODEvent_Default<(option:ODTicketOption, permissions:ODPermissionManager_Default, channel:discord.GuildTextBasedChannel, user:discord.User) => ODPromiseVoid>
|
||||
"afterTicketPermissionsCreated": ODEvent_Default<(option:ODTicketOption, permissions:ODPermissionManager_Default, channel:discord.GuildTextBasedChannel, user:discord.User) => ODPromiseVoid>
|
||||
"onTicketMainMessageCreated": ODEvent_Default<(ticket:ODTicket, channel:discord.GuildTextBasedChannel, user:discord.User) => ODPromiseVoid>
|
||||
"afterTicketMainMessageCreated": ODEvent_Default<(ticket:ODTicket, message:discord.Message, channel:discord.GuildTextBasedChannel, user:discord.User) => ODPromiseVoid>
|
||||
"onTicketChannelCreation": ODEvent_Default<(option:ODTicketOption, user:discord.User) => api.ODPromiseVoid>
|
||||
"afterTicketChannelCreated": ODEvent_Default<(option:ODTicketOption, channel:discord.GuildTextBasedChannel, user:discord.User) => api.ODPromiseVoid>
|
||||
"onTicketChannelDeletion": ODEvent_Default<(ticket:ODTicket, channel:discord.GuildTextBasedChannel, user:discord.User) => api.ODPromiseVoid>
|
||||
"afterTicketChannelDeleted": ODEvent_Default<(ticket:ODTicket, user:discord.User) => api.ODPromiseVoid>
|
||||
"onTicketPermissionsCreated": ODEvent_Default<(option:ODTicketOption, permissions:ODPermissionManager_Default, channel:discord.GuildTextBasedChannel, user:discord.User) => api.ODPromiseVoid>
|
||||
"afterTicketPermissionsCreated": ODEvent_Default<(option:ODTicketOption, permissions:ODPermissionManager_Default, channel:discord.GuildTextBasedChannel, user:discord.User) => api.ODPromiseVoid>
|
||||
"onTicketMainMessageCreated": ODEvent_Default<(ticket:ODTicket, channel:discord.GuildTextBasedChannel, user:discord.User) => api.ODPromiseVoid>
|
||||
"afterTicketMainMessageCreated": ODEvent_Default<(ticket:ODTicket, message:discord.Message, channel:discord.GuildTextBasedChannel, user:discord.User) => api.ODPromiseVoid>
|
||||
|
||||
//ticket actions
|
||||
"onTicketCreate": ODEvent_Default<(creator:discord.User) => ODPromiseVoid>
|
||||
"afterTicketCreated": ODEvent_Default<(ticket:ODTicket, creator:discord.User, channel:discord.GuildTextBasedChannel) => ODPromiseVoid>
|
||||
"onTicketClose": ODEvent_Default<(ticket:ODTicket, closer:discord.User, channel:discord.GuildTextBasedChannel, reason:string|null) => ODPromiseVoid>
|
||||
"afterTicketClosed": ODEvent_Default<(ticket:ODTicket, closer:discord.User, channel:discord.GuildTextBasedChannel, reason:string|null) => ODPromiseVoid>
|
||||
"onTicketReopen": ODEvent_Default<(ticket:ODTicket, reopener:discord.User, channel:discord.GuildTextBasedChannel, reason:string|null) => ODPromiseVoid>
|
||||
"afterTicketReopened": ODEvent_Default<(ticket:ODTicket, reopener:discord.User, channel:discord.GuildTextBasedChannel, reason:string|null) => ODPromiseVoid>
|
||||
"onTicketDelete": ODEvent_Default<(ticket:ODTicket, deleter:discord.User, channel:discord.GuildTextBasedChannel, reason:string|null) => ODPromiseVoid>
|
||||
"afterTicketDeleted": ODEvent_Default<(ticket:ODTicket, deleter:discord.User, reason:string|null) => ODPromiseVoid>
|
||||
"onTicketMove": ODEvent_Default<(ticket:ODTicket, mover:discord.User, channel:discord.GuildTextBasedChannel, reason:string|null) => ODPromiseVoid>
|
||||
"afterTicketMoved": ODEvent_Default<(ticket:ODTicket, mover:discord.User, channel:discord.GuildTextBasedChannel, reason:string|null) => ODPromiseVoid>
|
||||
"onTicketClaim": ODEvent_Default<(ticket:ODTicket, claimer:discord.User, channel:discord.GuildTextBasedChannel, reason:string|null) => ODPromiseVoid>
|
||||
"afterTicketClaimed": ODEvent_Default<(ticket:ODTicket, claimer:discord.User, channel:discord.GuildTextBasedChannel, reason:string|null) => ODPromiseVoid>
|
||||
"onTicketUnclaim": ODEvent_Default<(ticket:ODTicket, unclaimer:discord.User, channel:discord.GuildTextBasedChannel, reason:string|null) => ODPromiseVoid>
|
||||
"afterTicketUnclaimed": ODEvent_Default<(ticket:ODTicket, unclaimer:discord.User, channel:discord.GuildTextBasedChannel, reason:string|null) => ODPromiseVoid>
|
||||
"onTicketPin": ODEvent_Default<(ticket:ODTicket, pinner:discord.User, channel:discord.GuildTextBasedChannel, reason:string|null) => ODPromiseVoid>
|
||||
"afterTicketPinned": ODEvent_Default<(ticket:ODTicket, pinner:discord.User, channel:discord.GuildTextBasedChannel, reason:string|null) => ODPromiseVoid>
|
||||
"onTicketUnpin": ODEvent_Default<(ticket:ODTicket, unpinner:discord.User, channel:discord.GuildTextBasedChannel, reason:string|null) => ODPromiseVoid>
|
||||
"afterTicketUnpinned": ODEvent_Default<(ticket:ODTicket, unpinner:discord.User, channel:discord.GuildTextBasedChannel, reason:string|null) => ODPromiseVoid>
|
||||
"onTicketUserAdd": ODEvent_Default<(ticket:ODTicket, adder:discord.User, user:discord.User, channel:discord.GuildTextBasedChannel, reason:string|null) => ODPromiseVoid>
|
||||
"afterTicketUserAdded": ODEvent_Default<(ticket:ODTicket, adder:discord.User, user:discord.User, channel:discord.GuildTextBasedChannel, reason:string|null) => ODPromiseVoid>
|
||||
"onTicketUserRemove": ODEvent_Default<(ticket:ODTicket, remover:discord.User, user:discord.User, channel:discord.GuildTextBasedChannel, reason:string|null) => ODPromiseVoid>
|
||||
"afterTicketUserRemoved": ODEvent_Default<(ticket:ODTicket, remover:discord.User, user:discord.User, channel:discord.GuildTextBasedChannel, reason:string|null) => ODPromiseVoid>
|
||||
"onTicketRename": ODEvent_Default<(ticket:ODTicket, renamer:discord.User, channel:discord.GuildTextBasedChannel, reason:string|null) => ODPromiseVoid>
|
||||
"afterTicketRenamed": ODEvent_Default<(ticket:ODTicket, renamer:discord.User, channel:discord.GuildTextBasedChannel, reason:string|null) => ODPromiseVoid>
|
||||
"onTicketsClear": ODEvent_Default<(tickets:ODTicket[], clearer:discord.User, channel:discord.GuildTextBasedChannel, filter:ODTicketClearFilter) => ODPromiseVoid>
|
||||
"afterTicketsCleared": ODEvent_Default<(tickets:ODTicket[], clearer:discord.User, channel:discord.GuildTextBasedChannel, filter:ODTicketClearFilter) => ODPromiseVoid>
|
||||
"onTicketTopicChange": ODEvent_Default<(ticket:ODTicket, changer:discord.User, channel:discord.GuildTextBasedChannel, oldTopic:string, newTopic:string) => ODPromiseVoid>
|
||||
"afterTicketTopicChanged": ODEvent_Default<(ticket:ODTicket, changer:discord.User, channel:discord.GuildTextBasedChannel, oldTopic:string, newTopic:string) => ODPromiseVoid>
|
||||
"onTicketPriorityChange": ODEvent_Default<(ticket:ODTicket, changer:discord.User, channel:discord.GuildTextBasedChannel, oldPriority:ODPriorityLevel, newPriority:ODPriorityLevel, reason:string|null) => ODPromiseVoid>
|
||||
"afterTicketPriorityChanged": ODEvent_Default<(ticket:ODTicket, changer:discord.User, channel:discord.GuildTextBasedChannel, oldPriority:ODPriorityLevel, newPriority:ODPriorityLevel, reason:string|null) => ODPromiseVoid>
|
||||
"onTicketTransfer": ODEvent_Default<(ticket:ODTicket, changer:discord.User, channel:discord.GuildTextBasedChannel, oldCreator:discord.User, newCreator:discord.User, reason:string|null) => ODPromiseVoid>
|
||||
"afterTicketTransferred": ODEvent_Default<(ticket:ODTicket, changer:discord.User, channel:discord.GuildTextBasedChannel, oldCreator:discord.User, newCreator:discord.User, reason:string|null) => ODPromiseVoid>
|
||||
"onTicketCreate": ODEvent_Default<(creator:discord.User) => api.ODPromiseVoid>
|
||||
"afterTicketCreated": ODEvent_Default<(ticket:ODTicket, creator:discord.User, channel:discord.GuildTextBasedChannel) => api.ODPromiseVoid>
|
||||
"onTicketClose": ODEvent_Default<(ticket:ODTicket, closer:discord.User, channel:discord.GuildTextBasedChannel, reason:string|null) => api.ODPromiseVoid>
|
||||
"afterTicketClosed": ODEvent_Default<(ticket:ODTicket, closer:discord.User, channel:discord.GuildTextBasedChannel, reason:string|null) => api.ODPromiseVoid>
|
||||
"onTicketReopen": ODEvent_Default<(ticket:ODTicket, reopener:discord.User, channel:discord.GuildTextBasedChannel, reason:string|null) => api.ODPromiseVoid>
|
||||
"afterTicketReopened": ODEvent_Default<(ticket:ODTicket, reopener:discord.User, channel:discord.GuildTextBasedChannel, reason:string|null) => api.ODPromiseVoid>
|
||||
"onTicketDelete": ODEvent_Default<(ticket:ODTicket, deleter:discord.User, channel:discord.GuildTextBasedChannel, reason:string|null) => api.ODPromiseVoid>
|
||||
"afterTicketDeleted": ODEvent_Default<(ticket:ODTicket, deleter:discord.User, reason:string|null) => api.ODPromiseVoid>
|
||||
"onTicketMove": ODEvent_Default<(ticket:ODTicket, mover:discord.User, channel:discord.GuildTextBasedChannel, reason:string|null) => api.ODPromiseVoid>
|
||||
"afterTicketMoved": ODEvent_Default<(ticket:ODTicket, mover:discord.User, channel:discord.GuildTextBasedChannel, reason:string|null) => api.ODPromiseVoid>
|
||||
"onTicketClaim": ODEvent_Default<(ticket:ODTicket, claimer:discord.User, channel:discord.GuildTextBasedChannel, reason:string|null) => api.ODPromiseVoid>
|
||||
"afterTicketClaimed": ODEvent_Default<(ticket:ODTicket, claimer:discord.User, channel:discord.GuildTextBasedChannel, reason:string|null) => api.ODPromiseVoid>
|
||||
"onTicketUnclaim": ODEvent_Default<(ticket:ODTicket, unclaimer:discord.User, channel:discord.GuildTextBasedChannel, reason:string|null) => api.ODPromiseVoid>
|
||||
"afterTicketUnclaimed": ODEvent_Default<(ticket:ODTicket, unclaimer:discord.User, channel:discord.GuildTextBasedChannel, reason:string|null) => api.ODPromiseVoid>
|
||||
"onTicketPin": ODEvent_Default<(ticket:ODTicket, pinner:discord.User, channel:discord.GuildTextBasedChannel, reason:string|null) => api.ODPromiseVoid>
|
||||
"afterTicketPinned": ODEvent_Default<(ticket:ODTicket, pinner:discord.User, channel:discord.GuildTextBasedChannel, reason:string|null) => api.ODPromiseVoid>
|
||||
"onTicketUnpin": ODEvent_Default<(ticket:ODTicket, unpinner:discord.User, channel:discord.GuildTextBasedChannel, reason:string|null) => api.ODPromiseVoid>
|
||||
"afterTicketUnpinned": ODEvent_Default<(ticket:ODTicket, unpinner:discord.User, channel:discord.GuildTextBasedChannel, reason:string|null) => api.ODPromiseVoid>
|
||||
"onTicketUserAdd": ODEvent_Default<(ticket:ODTicket, adder:discord.User, user:discord.User, channel:discord.GuildTextBasedChannel, reason:string|null) => api.ODPromiseVoid>
|
||||
"afterTicketUserAdded": ODEvent_Default<(ticket:ODTicket, adder:discord.User, user:discord.User, channel:discord.GuildTextBasedChannel, reason:string|null) => api.ODPromiseVoid>
|
||||
"onTicketUserRemove": ODEvent_Default<(ticket:ODTicket, remover:discord.User, user:discord.User, channel:discord.GuildTextBasedChannel, reason:string|null) => api.ODPromiseVoid>
|
||||
"afterTicketUserRemoved": ODEvent_Default<(ticket:ODTicket, remover:discord.User, user:discord.User, channel:discord.GuildTextBasedChannel, reason:string|null) => api.ODPromiseVoid>
|
||||
"onTicketRename": ODEvent_Default<(ticket:ODTicket, renamer:discord.User, channel:discord.GuildTextBasedChannel, reason:string|null) => api.ODPromiseVoid>
|
||||
"afterTicketRenamed": ODEvent_Default<(ticket:ODTicket, renamer:discord.User, channel:discord.GuildTextBasedChannel, reason:string|null) => api.ODPromiseVoid>
|
||||
"onTicketsClear": ODEvent_Default<(tickets:ODTicket[], clearer:discord.User, channel:discord.GuildTextBasedChannel, filter:ODTicketClearFilter) => api.ODPromiseVoid>
|
||||
"afterTicketsCleared": ODEvent_Default<(tickets:ODTicket[], clearer:discord.User, channel:discord.GuildTextBasedChannel, filter:ODTicketClearFilter) => api.ODPromiseVoid>
|
||||
"onTicketTopicChange": ODEvent_Default<(ticket:ODTicket, changer:discord.User, channel:discord.GuildTextBasedChannel, oldTopic:string, newTopic:string) => api.ODPromiseVoid>
|
||||
"afterTicketTopicChanged": ODEvent_Default<(ticket:ODTicket, changer:discord.User, channel:discord.GuildTextBasedChannel, oldTopic:string, newTopic:string) => api.ODPromiseVoid>
|
||||
"onTicketPriorityChange": ODEvent_Default<(ticket:ODTicket, changer:discord.User, channel:discord.GuildTextBasedChannel, oldPriority:ODPriorityLevel, newPriority:ODPriorityLevel, reason:string|null) => api.ODPromiseVoid>
|
||||
"afterTicketPriorityChanged": ODEvent_Default<(ticket:ODTicket, changer:discord.User, channel:discord.GuildTextBasedChannel, oldPriority:ODPriorityLevel, newPriority:ODPriorityLevel, reason:string|null) => api.ODPromiseVoid>
|
||||
"onTicketTransfer": ODEvent_Default<(ticket:ODTicket, changer:discord.User, channel:discord.GuildTextBasedChannel, oldCreator:discord.User, newCreator:discord.User, reason:string|null) => api.ODPromiseVoid>
|
||||
"afterTicketTransferred": ODEvent_Default<(ticket:ODTicket, changer:discord.User, channel:discord.GuildTextBasedChannel, oldCreator:discord.User, newCreator:discord.User, reason:string|null) => api.ODPromiseVoid>
|
||||
|
||||
//roles
|
||||
"onRoleLoad": ODEvent_Default<(roles:ODRoleManager) => ODPromiseVoid>
|
||||
"afterRolesLoaded": ODEvent_Default<(roles:ODRoleManager) => ODPromiseVoid>
|
||||
"onRoleUpdate": ODEvent_Default<(user:discord.User,role:ODRole) => ODPromiseVoid>
|
||||
"afterRolesUpdated": ODEvent_Default<(user:discord.User,role:ODRole) => ODPromiseVoid>
|
||||
"onRoleLoad": ODEvent_Default<(roles:ODRoleManager) => api.ODPromiseVoid>
|
||||
"afterRolesLoaded": ODEvent_Default<(roles:ODRoleManager) => api.ODPromiseVoid>
|
||||
"onRoleUpdate": ODEvent_Default<(user:discord.User,role:ODRole) => api.ODPromiseVoid>
|
||||
"afterRolesUpdated": ODEvent_Default<(user:discord.User,role:ODRole) => api.ODPromiseVoid>
|
||||
|
||||
//blacklist
|
||||
"onBlacklistLoad": ODEvent_Default<(blacklist:ODBlacklistManager) => ODPromiseVoid>
|
||||
"afterBlacklistLoaded": ODEvent_Default<(blacklist:ODBlacklistManager) => ODPromiseVoid>
|
||||
"onBlacklistLoad": ODEvent_Default<(blacklist:ODBlacklistManager) => api.ODPromiseVoid>
|
||||
"afterBlacklistLoaded": ODEvent_Default<(blacklist:ODBlacklistManager) => api.ODPromiseVoid>
|
||||
|
||||
//transcripts
|
||||
"onTranscriptCompilerLoad": ODEvent_Default<(transcripts:ODTranscriptManager_Default) => ODPromiseVoid>
|
||||
"afterTranscriptCompilersLoaded": ODEvent_Default<(transcripts:ODTranscriptManager_Default) => ODPromiseVoid>
|
||||
"onTranscriptHistoryLoad": ODEvent_Default<(transcripts:ODTranscriptManager_Default) => ODPromiseVoid>
|
||||
"afterTranscriptHistoryLoaded": ODEvent_Default<(transcripts:ODTranscriptManager_Default) => ODPromiseVoid>
|
||||
"onTranscriptCompilerLoad": ODEvent_Default<(transcripts:ODTranscriptManager_Default) => api.ODPromiseVoid>
|
||||
"afterTranscriptCompilersLoaded": ODEvent_Default<(transcripts:ODTranscriptManager_Default) => api.ODPromiseVoid>
|
||||
"onTranscriptHistoryLoad": ODEvent_Default<(transcripts:ODTranscriptManager_Default) => api.ODPromiseVoid>
|
||||
"afterTranscriptHistoryLoaded": ODEvent_Default<(transcripts:ODTranscriptManager_Default) => api.ODPromiseVoid>
|
||||
|
||||
//transcript creation
|
||||
"onTranscriptCreate": ODEvent_Default<(transcripts:ODTranscriptManager_Default,ticket:ODTicket,channel:discord.TextChannel,user:discord.User) => ODPromiseVoid>
|
||||
"afterTranscriptCreated": ODEvent_Default<(transcripts:ODTranscriptManager_Default,ticket:ODTicket,channel:discord.TextChannel,user:discord.User) => ODPromiseVoid>
|
||||
"onTranscriptInit": ODEvent_Default<(transcripts:ODTranscriptManager_Default,ticket:ODTicket,channel:discord.TextChannel,user:discord.User) => ODPromiseVoid>
|
||||
"afterTranscriptInitiated": ODEvent_Default<(transcripts:ODTranscriptManager_Default,ticket:ODTicket,channel:discord.TextChannel,user:discord.User) => ODPromiseVoid>
|
||||
"onTranscriptCompile": ODEvent_Default<(transcripts:ODTranscriptManager_Default,ticket:ODTicket,channel:discord.TextChannel,user:discord.User) => ODPromiseVoid>
|
||||
"afterTranscriptCompiled": ODEvent_Default<(transcripts:ODTranscriptManager_Default,ticket:ODTicket,channel:discord.TextChannel,user:discord.User) => ODPromiseVoid>
|
||||
"onTranscriptReady": ODEvent_Default<(transcripts:ODTranscriptManager_Default,ticket:ODTicket,channel:discord.TextChannel,user:discord.User) => ODPromiseVoid>
|
||||
"afterTranscriptReady": ODEvent_Default<(transcripts:ODTranscriptManager_Default,ticket:ODTicket,channel:discord.TextChannel,user:discord.User) => ODPromiseVoid>
|
||||
"onTranscriptCreate": ODEvent_Default<(transcripts:ODTranscriptManager_Default,ticket:ODTicket,channel:discord.TextChannel,user:discord.User) => api.ODPromiseVoid>
|
||||
"afterTranscriptCreated": ODEvent_Default<(transcripts:ODTranscriptManager_Default,ticket:ODTicket,channel:discord.TextChannel,user:discord.User) => api.ODPromiseVoid>
|
||||
"onTranscriptInit": ODEvent_Default<(transcripts:ODTranscriptManager_Default,ticket:ODTicket,channel:discord.TextChannel,user:discord.User) => api.ODPromiseVoid>
|
||||
"afterTranscriptInitiated": ODEvent_Default<(transcripts:ODTranscriptManager_Default,ticket:ODTicket,channel:discord.TextChannel,user:discord.User) => api.ODPromiseVoid>
|
||||
"onTranscriptCompile": ODEvent_Default<(transcripts:ODTranscriptManager_Default,ticket:ODTicket,channel:discord.TextChannel,user:discord.User) => api.ODPromiseVoid>
|
||||
"afterTranscriptCompiled": ODEvent_Default<(transcripts:ODTranscriptManager_Default,ticket:ODTicket,channel:discord.TextChannel,user:discord.User) => api.ODPromiseVoid>
|
||||
"onTranscriptReady": ODEvent_Default<(transcripts:ODTranscriptManager_Default,ticket:ODTicket,channel:discord.TextChannel,user:discord.User) => api.ODPromiseVoid>
|
||||
"afterTranscriptReady": ODEvent_Default<(transcripts:ODTranscriptManager_Default,ticket:ODTicket,channel:discord.TextChannel,user:discord.User) => api.ODPromiseVoid>
|
||||
|
||||
//plugin loading before builders
|
||||
"onPluginBeforeBuilderLoad": ODEvent_Default<() => ODPromiseVoid>,
|
||||
"afterPluginBeforeBuilderLoaded": ODEvent_Default<() => ODPromiseVoid>,
|
||||
"onPluginBeforeBuilderLoad": ODEvent_Default<() => api.ODPromiseVoid>,
|
||||
"afterPluginBeforeBuilderLoaded": ODEvent_Default<() => api.ODPromiseVoid>,
|
||||
|
||||
//builders
|
||||
"onButtonBuilderLoad": ODEvent_Default<(buttons:ODButtonManager_Default, builders:ODBuilderManager_Default, actions:ODActionManager_Default) => ODPromiseVoid>
|
||||
"afterButtonBuildersLoaded": ODEvent_Default<(buttons:ODButtonManager_Default, builders:ODBuilderManager_Default, actions:ODActionManager_Default) => ODPromiseVoid>
|
||||
"onDropdownBuilderLoad": ODEvent_Default<(dropdowns:ODDropdownManager_Default, builders:ODBuilderManager_Default, actions:ODActionManager_Default) => ODPromiseVoid>
|
||||
"afterDropdownBuildersLoaded": ODEvent_Default<(dropdowns:ODDropdownManager_Default, builders:ODBuilderManager_Default, actions:ODActionManager_Default) => ODPromiseVoid>
|
||||
"onFileBuilderLoad": ODEvent_Default<(files:ODFileManager_Default, builders:ODBuilderManager_Default, actions:ODActionManager_Default) => ODPromiseVoid>
|
||||
"afterFileBuildersLoaded": ODEvent_Default<(files:ODFileManager_Default, builders:ODBuilderManager_Default, actions:ODActionManager_Default) => ODPromiseVoid>
|
||||
"onEmbedBuilderLoad": ODEvent_Default<(embeds:ODEmbedManager_Default, builders:ODBuilderManager_Default, actions:ODActionManager_Default) => ODPromiseVoid>
|
||||
"afterEmbedBuildersLoaded": ODEvent_Default<(embeds:ODEmbedManager_Default, builders:ODBuilderManager_Default, actions:ODActionManager_Default) => ODPromiseVoid>
|
||||
"onMessageBuilderLoad": ODEvent_Default<(messages:ODMessageManager_Default, builders:ODBuilderManager_Default, actions:ODActionManager_Default) => ODPromiseVoid>
|
||||
"afterMessageBuildersLoaded": ODEvent_Default<(messages:ODMessageManager_Default, builders:ODBuilderManager_Default, actions:ODActionManager_Default) => ODPromiseVoid>
|
||||
"onModalBuilderLoad": ODEvent_Default<(modals:ODModalManager_Default, builders:ODBuilderManager_Default, actions:ODActionManager_Default) => ODPromiseVoid>
|
||||
"afterModalBuildersLoaded": ODEvent_Default<(modals:ODModalManager_Default, builders:ODBuilderManager_Default, actions:ODActionManager_Default) => ODPromiseVoid>
|
||||
"onButtonBuilderLoad": ODEvent_Default<(buttons:ODButtonManager_Default, builders:ODBuilderManager_Default, actions:ODActionManager_Default) => api.ODPromiseVoid>
|
||||
"afterButtonBuildersLoaded": ODEvent_Default<(buttons:ODButtonManager_Default, builders:ODBuilderManager_Default, actions:ODActionManager_Default) => api.ODPromiseVoid>
|
||||
"onDropdownBuilderLoad": ODEvent_Default<(dropdowns:ODDropdownManager_Default, builders:ODBuilderManager_Default, actions:ODActionManager_Default) => api.ODPromiseVoid>
|
||||
"afterDropdownBuildersLoaded": ODEvent_Default<(dropdowns:ODDropdownManager_Default, builders:ODBuilderManager_Default, actions:ODActionManager_Default) => api.ODPromiseVoid>
|
||||
"onFileBuilderLoad": ODEvent_Default<(files:ODFileManager_Default, builders:ODBuilderManager_Default, actions:ODActionManager_Default) => api.ODPromiseVoid>
|
||||
"afterFileBuildersLoaded": ODEvent_Default<(files:ODFileManager_Default, builders:ODBuilderManager_Default, actions:ODActionManager_Default) => api.ODPromiseVoid>
|
||||
"onEmbedBuilderLoad": ODEvent_Default<(embeds:ODEmbedManager_Default, builders:ODBuilderManager_Default, actions:ODActionManager_Default) => api.ODPromiseVoid>
|
||||
"afterEmbedBuildersLoaded": ODEvent_Default<(embeds:ODEmbedManager_Default, builders:ODBuilderManager_Default, actions:ODActionManager_Default) => api.ODPromiseVoid>
|
||||
"onMessageBuilderLoad": ODEvent_Default<(messages:ODMessageManager_Default, builders:ODBuilderManager_Default, actions:ODActionManager_Default) => api.ODPromiseVoid>
|
||||
"afterMessageBuildersLoaded": ODEvent_Default<(messages:ODMessageManager_Default, builders:ODBuilderManager_Default, actions:ODActionManager_Default) => api.ODPromiseVoid>
|
||||
"onModalBuilderLoad": ODEvent_Default<(modals:ODModalManager_Default, builders:ODBuilderManager_Default, actions:ODActionManager_Default) => api.ODPromiseVoid>
|
||||
"afterModalBuildersLoaded": ODEvent_Default<(modals:ODModalManager_Default, builders:ODBuilderManager_Default, actions:ODActionManager_Default) => api.ODPromiseVoid>
|
||||
|
||||
//plugin loading before responders
|
||||
"onPluginBeforeResponderLoad": ODEvent_Default<() => ODPromiseVoid>,
|
||||
"afterPluginBeforeResponderLoaded": ODEvent_Default<() => ODPromiseVoid>,
|
||||
"onPluginBeforeResponderLoad": ODEvent_Default<() => api.ODPromiseVoid>,
|
||||
"afterPluginBeforeResponderLoaded": ODEvent_Default<() => api.ODPromiseVoid>,
|
||||
|
||||
//responders
|
||||
"onCommandResponderLoad": ODEvent_Default<(commands:ODCommandResponderManager_Default, responders:ODResponderManager_Default, actions:ODActionManager_Default) => ODPromiseVoid>
|
||||
"afterCommandRespondersLoaded": ODEvent_Default<(commands:ODCommandResponderManager_Default, responders:ODResponderManager_Default, actions:ODActionManager_Default) => ODPromiseVoid>
|
||||
"onButtonResponderLoad": ODEvent_Default<(buttons:ODButtonResponderManager_Default, responders:ODResponderManager_Default, actions:ODActionManager_Default) => ODPromiseVoid>
|
||||
"afterButtonRespondersLoaded": ODEvent_Default<(buttons:ODButtonResponderManager_Default, responders:ODResponderManager_Default, actions:ODActionManager_Default) => ODPromiseVoid>
|
||||
"onDropdownResponderLoad": ODEvent_Default<(dropdowns:ODDropdownResponderManager_Default, responders:ODResponderManager_Default, actions:ODActionManager_Default) => ODPromiseVoid>
|
||||
"afterDropdownRespondersLoaded": ODEvent_Default<(dropdowns:ODDropdownResponderManager_Default, responders:ODResponderManager_Default, actions:ODActionManager_Default) => ODPromiseVoid>
|
||||
"onModalResponderLoad": ODEvent_Default<(modals:ODModalResponderManager_Default, responders:ODResponderManager_Default, actions:ODActionManager_Default) => ODPromiseVoid>
|
||||
"afterModalRespondersLoaded": ODEvent_Default<(modals:ODModalResponderManager_Default, responders:ODResponderManager_Default, actions:ODActionManager_Default) => ODPromiseVoid>
|
||||
"onContextMenuResponderLoad": ODEvent_Default<(menus:ODContextMenuResponderManager_Default, responders:ODResponderManager_Default, actions:ODActionManager_Default) => ODPromiseVoid>
|
||||
"afterContextMenuRespondersLoaded": ODEvent_Default<(menus:ODContextMenuResponderManager_Default, responders:ODResponderManager_Default, actions:ODActionManager_Default) => ODPromiseVoid>
|
||||
"onAutocompleteResponderLoad": ODEvent_Default<(autocomplete:ODAutocompleteResponderManager_Default, responders:ODResponderManager_Default, actions:ODActionManager_Default) => ODPromiseVoid>
|
||||
"afterAutocompleteRespondersLoaded": ODEvent_Default<(autocomplete:ODAutocompleteResponderManager_Default, responders:ODResponderManager_Default, actions:ODActionManager_Default) => ODPromiseVoid>
|
||||
"onCommandResponderLoad": ODEvent_Default<(commands:ODCommandResponderManager_Default, responders:ODResponderManager_Default, actions:ODActionManager_Default) => api.ODPromiseVoid>
|
||||
"afterCommandRespondersLoaded": ODEvent_Default<(commands:ODCommandResponderManager_Default, responders:ODResponderManager_Default, actions:ODActionManager_Default) => api.ODPromiseVoid>
|
||||
"onButtonResponderLoad": ODEvent_Default<(buttons:ODButtonResponderManager_Default, responders:ODResponderManager_Default, actions:ODActionManager_Default) => api.ODPromiseVoid>
|
||||
"afterButtonRespondersLoaded": ODEvent_Default<(buttons:ODButtonResponderManager_Default, responders:ODResponderManager_Default, actions:ODActionManager_Default) => api.ODPromiseVoid>
|
||||
"onDropdownResponderLoad": ODEvent_Default<(dropdowns:ODDropdownResponderManager_Default, responders:ODResponderManager_Default, actions:ODActionManager_Default) => api.ODPromiseVoid>
|
||||
"afterDropdownRespondersLoaded": ODEvent_Default<(dropdowns:ODDropdownResponderManager_Default, responders:ODResponderManager_Default, actions:ODActionManager_Default) => api.ODPromiseVoid>
|
||||
"onModalResponderLoad": ODEvent_Default<(modals:ODModalResponderManager_Default, responders:ODResponderManager_Default, actions:ODActionManager_Default) => api.ODPromiseVoid>
|
||||
"afterModalRespondersLoaded": ODEvent_Default<(modals:ODModalResponderManager_Default, responders:ODResponderManager_Default, actions:ODActionManager_Default) => api.ODPromiseVoid>
|
||||
"onContextMenuResponderLoad": ODEvent_Default<(menus:ODContextMenuResponderManager_Default, responders:ODResponderManager_Default, actions:ODActionManager_Default) => api.ODPromiseVoid>
|
||||
"afterContextMenuRespondersLoaded": ODEvent_Default<(menus:ODContextMenuResponderManager_Default, responders:ODResponderManager_Default, actions:ODActionManager_Default) => api.ODPromiseVoid>
|
||||
"onAutocompleteResponderLoad": ODEvent_Default<(autocomplete:ODAutocompleteResponderManager_Default, responders:ODResponderManager_Default, actions:ODActionManager_Default) => api.ODPromiseVoid>
|
||||
"afterAutocompleteRespondersLoaded": ODEvent_Default<(autocomplete:ODAutocompleteResponderManager_Default, responders:ODResponderManager_Default, actions:ODActionManager_Default) => api.ODPromiseVoid>
|
||||
|
||||
//plugin loading before finalizations
|
||||
"onPluginBeforeFinalizationLoad": ODEvent_Default<() => ODPromiseVoid>,
|
||||
"afterPluginBeforeFinalizationLoaded": ODEvent_Default<() => ODPromiseVoid>,
|
||||
"onPluginBeforeFinalizationLoad": ODEvent_Default<() => api.ODPromiseVoid>,
|
||||
"afterPluginBeforeFinalizationLoaded": ODEvent_Default<() => api.ODPromiseVoid>,
|
||||
|
||||
//actions
|
||||
"onActionLoad": ODEvent_Default<(actions:ODActionManager_Default) => ODPromiseVoid>
|
||||
"afterActionsLoaded": ODEvent_Default<(actions:ODActionManager_Default) => ODPromiseVoid>
|
||||
"onActionLoad": ODEvent_Default<(actions:ODActionManager_Default) => api.ODPromiseVoid>
|
||||
"afterActionsLoaded": ODEvent_Default<(actions:ODActionManager_Default) => api.ODPromiseVoid>
|
||||
|
||||
//verifybars
|
||||
"onVerifyBarLoad": ODEvent_Default<(verifybars:ODVerifyBarManager_Default) => ODPromiseVoid>
|
||||
"afterVerifyBarsLoaded": ODEvent_Default<(verifybars:ODVerifyBarManager_Default) => ODPromiseVoid>
|
||||
"onVerifyBarLoad": ODEvent_Default<(verifybars:ODVerifyBarManager_Default) => api.ODPromiseVoid>
|
||||
"afterVerifyBarsLoaded": ODEvent_Default<(verifybars:ODVerifyBarManager_Default) => api.ODPromiseVoid>
|
||||
|
||||
//permissions
|
||||
"onPermissionLoad": ODEvent_Default<(permissions:ODPermissionManager_Default) => ODPromiseVoid>
|
||||
"afterPermissionsLoaded": ODEvent_Default<(permissions:ODPermissionManager_Default) => ODPromiseVoid>
|
||||
"onPermissionLoad": ODEvent_Default<(permissions:ODPermissionManager_Default) => api.ODPromiseVoid>
|
||||
"afterPermissionsLoaded": ODEvent_Default<(permissions:ODPermissionManager_Default) => api.ODPromiseVoid>
|
||||
|
||||
//posts
|
||||
"onPostLoad": ODEvent_Default<(posts:ODPostManager_Default) => ODPromiseVoid>
|
||||
"afterPostsLoaded": ODEvent_Default<(posts:ODPostManager_Default) => ODPromiseVoid>
|
||||
"onPostInit": ODEvent_Default<(posts:ODPostManager_Default) => ODPromiseVoid>
|
||||
"afterPostsInitiated": ODEvent_Default<(posts:ODPostManager_Default) => ODPromiseVoid>
|
||||
"onPostLoad": ODEvent_Default<(posts:ODPostManager_Default) => api.ODPromiseVoid>
|
||||
"afterPostsLoaded": ODEvent_Default<(posts:ODPostManager_Default) => api.ODPromiseVoid>
|
||||
"onPostInit": ODEvent_Default<(posts:ODPostManager_Default) => api.ODPromiseVoid>
|
||||
"afterPostsInitiated": ODEvent_Default<(posts:ODPostManager_Default) => api.ODPromiseVoid>
|
||||
|
||||
//cooldowns
|
||||
"onCooldownLoad": ODEvent_Default<(cooldowns:ODCooldownManager_Default) => ODPromiseVoid>
|
||||
"afterCooldownsLoaded": ODEvent_Default<(cooldowns:ODCooldownManager_Default) => ODPromiseVoid>
|
||||
"onCooldownInit": ODEvent_Default<(cooldowns:ODCooldownManager_Default) => ODPromiseVoid>
|
||||
"afterCooldownsInitiated": ODEvent_Default<(cooldowns:ODCooldownManager_Default) => ODPromiseVoid>
|
||||
"onCooldownLoad": ODEvent_Default<(cooldowns:ODCooldownManager_Default) => api.ODPromiseVoid>
|
||||
"afterCooldownsLoaded": ODEvent_Default<(cooldowns:ODCooldownManager_Default) => api.ODPromiseVoid>
|
||||
"onCooldownInit": ODEvent_Default<(cooldowns:ODCooldownManager_Default) => api.ODPromiseVoid>
|
||||
"afterCooldownsInitiated": ODEvent_Default<(cooldowns:ODCooldownManager_Default) => api.ODPromiseVoid>
|
||||
|
||||
//help menu
|
||||
"onHelpMenuCategoryLoad": ODEvent_Default<(menu:ODHelpMenuManager_Default) => ODPromiseVoid>
|
||||
"afterHelpMenuCategoriesLoaded": ODEvent_Default<(menu:ODHelpMenuManager_Default) => ODPromiseVoid>
|
||||
"onHelpMenuComponentLoad": ODEvent_Default<(menu:ODHelpMenuManager_Default) => ODPromiseVoid>
|
||||
"afterHelpMenuComponentsLoaded": ODEvent_Default<(menu:ODHelpMenuManager_Default) => ODPromiseVoid>
|
||||
"onHelpMenuCategoryLoad": ODEvent_Default<(menu:ODHelpMenuManager_Default) => api.ODPromiseVoid>
|
||||
"afterHelpMenuCategoriesLoaded": ODEvent_Default<(menu:ODHelpMenuManager_Default) => api.ODPromiseVoid>
|
||||
"onHelpMenuComponentLoad": ODEvent_Default<(menu:ODHelpMenuManager_Default) => api.ODPromiseVoid>
|
||||
"afterHelpMenuComponentsLoaded": ODEvent_Default<(menu:ODHelpMenuManager_Default) => api.ODPromiseVoid>
|
||||
|
||||
//stats
|
||||
"onStatScopeLoad": ODEvent_Default<(stats:ODStatsManager_Default) => ODPromiseVoid>
|
||||
"afterStatScopesLoaded": ODEvent_Default<(stats:ODStatsManager_Default) => ODPromiseVoid>
|
||||
"onStatLoad": ODEvent_Default<(stats:ODStatsManager_Default) => ODPromiseVoid>
|
||||
"afterStatsLoaded": ODEvent_Default<(stats:ODStatsManager_Default) => ODPromiseVoid>
|
||||
"onStatInit": ODEvent_Default<(stats:ODStatsManager_Default) => ODPromiseVoid>
|
||||
"afterStatsInitiated": ODEvent_Default<(stats:ODStatsManager_Default) => ODPromiseVoid>
|
||||
"onStatScopeLoad": ODEvent_Default<(stats:ODStatsManager_Default) => api.ODPromiseVoid>
|
||||
"afterStatScopesLoaded": ODEvent_Default<(stats:ODStatsManager_Default) => api.ODPromiseVoid>
|
||||
"onStatLoad": ODEvent_Default<(stats:ODStatsManager_Default) => api.ODPromiseVoid>
|
||||
"afterStatsLoaded": ODEvent_Default<(stats:ODStatsManager_Default) => api.ODPromiseVoid>
|
||||
"onStatInit": ODEvent_Default<(stats:ODStatsManager_Default) => api.ODPromiseVoid>
|
||||
"afterStatsInitiated": ODEvent_Default<(stats:ODStatsManager_Default) => api.ODPromiseVoid>
|
||||
|
||||
//plugin loading before code
|
||||
"onPluginBeforeCodeLoad": ODEvent_Default<() => ODPromiseVoid>,
|
||||
"afterPluginBeforeCodeLoaded": ODEvent_Default<() => ODPromiseVoid>,
|
||||
"onPluginBeforeCodeLoad": ODEvent_Default<() => api.ODPromiseVoid>,
|
||||
"afterPluginBeforeCodeLoaded": ODEvent_Default<() => api.ODPromiseVoid>,
|
||||
|
||||
//code
|
||||
"onCodeLoad": ODEvent_Default<(code:ODCodeManager_Default) => ODPromiseVoid>
|
||||
"afterCodeLoaded": ODEvent_Default<(code:ODCodeManager_Default) => ODPromiseVoid>
|
||||
"onCodeExecute": ODEvent_Default<(code:ODCodeManager_Default) => ODPromiseVoid>
|
||||
"afterCodeExecuted": ODEvent_Default<(code:ODCodeManager_Default) => ODPromiseVoid>
|
||||
"onCodeLoad": ODEvent_Default<(code:ODCodeManager_Default) => api.ODPromiseVoid>
|
||||
"afterCodeLoaded": ODEvent_Default<(code:ODCodeManager_Default) => api.ODPromiseVoid>
|
||||
"onCodeExecute": ODEvent_Default<(code:ODCodeManager_Default) => api.ODPromiseVoid>
|
||||
"afterCodeExecuted": ODEvent_Default<(code:ODCodeManager_Default) => api.ODPromiseVoid>
|
||||
|
||||
//livestatus
|
||||
"onLiveStatusSourceLoad": ODEvent_Default<(livestatus:ODLiveStatusManager_Default) => ODPromiseVoid>
|
||||
"afterLiveStatusSourcesLoaded": ODEvent_Default<(livestatus:ODLiveStatusManager_Default) => ODPromiseVoid>
|
||||
"onLiveStatusSourceLoad": ODEvent_Default<(livestatus:ODLiveStatusManager_Default) => api.ODPromiseVoid>
|
||||
"afterLiveStatusSourcesLoaded": ODEvent_Default<(livestatus:ODLiveStatusManager_Default) => api.ODPromiseVoid>
|
||||
|
||||
//startscreen
|
||||
"onStartScreenLoad": ODEvent_Default<(startscreen:ODStartScreenManager_Default) => ODPromiseVoid>
|
||||
"afterStartScreensLoaded": ODEvent_Default<(startscreen:ODStartScreenManager_Default) => ODPromiseVoid>
|
||||
"onStartScreenRender": ODEvent_Default<(startscreen:ODStartScreenManager_Default) => ODPromiseVoid>
|
||||
"afterStartScreensRendered": ODEvent_Default<(startscreen:ODStartScreenManager_Default) => ODPromiseVoid>
|
||||
"onStartScreenLoad": ODEvent_Default<(startscreen:ODStartScreenManager_Default) => api.ODPromiseVoid>
|
||||
"afterStartScreensLoaded": ODEvent_Default<(startscreen:ODStartScreenManager_Default) => api.ODPromiseVoid>
|
||||
"onStartScreenRender": ODEvent_Default<(startscreen:ODStartScreenManager_Default) => api.ODPromiseVoid>
|
||||
"afterStartScreensRendered": ODEvent_Default<(startscreen:ODStartScreenManager_Default) => api.ODPromiseVoid>
|
||||
|
||||
//ready
|
||||
"beforeReadyForUsage": ODEvent_Default<() => ODPromiseVoid>
|
||||
"onReadyForUsage": ODEvent_Default<() => ODPromiseVoid>
|
||||
"beforeReadyForUsage": ODEvent_Default<() => api.ODPromiseVoid>
|
||||
"onReadyForUsage": ODEvent_Default<() => api.ODPromiseVoid>
|
||||
}
|
||||
|
||||
/**## ODEventManager_Default `default_class`
|
||||
@@ -344,25 +338,25 @@ export interface ODEventIds_Default {
|
||||
*
|
||||
* This default class is made for the global variable `opendiscord.events`!
|
||||
*/
|
||||
export class ODEventManager_Default extends ODEventManager {
|
||||
export class ODEventManager_Default extends api.ODEventManager {
|
||||
get<StartScreenId extends keyof ODEventIds_Default>(id:StartScreenId): ODEventIds_Default[StartScreenId]
|
||||
get(id:ODValidId): ODEvent|null
|
||||
get(id:api.ODValidId): api.ODEvent|null
|
||||
|
||||
get(id:ODValidId): ODEvent|null {
|
||||
get(id:api.ODValidId): api.ODEvent|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<StartScreenId extends keyof ODEventIds_Default>(id:StartScreenId): ODEventIds_Default[StartScreenId]
|
||||
remove(id:ODValidId): ODEvent|null
|
||||
remove(id:api.ODValidId): api.ODEvent|null
|
||||
|
||||
remove(id:ODValidId): ODEvent|null {
|
||||
remove(id:api.ODValidId): api.ODEvent|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODEventIds_Default): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
}
|
||||
@@ -373,7 +367,7 @@ export class ODEventManager_Default extends ODEventManager {
|
||||
*
|
||||
* This default class is made for the global variable `opendiscord.events`!
|
||||
*/
|
||||
export class ODEvent_Default<Callback extends ((...args:any) => ODPromiseVoid)> extends ODEvent {
|
||||
export class ODEvent_Default<Callback extends ((...args:any) => api.ODPromiseVoid)> extends api.ODEvent {
|
||||
listen(callback:Callback): void {
|
||||
return super.listen(callback)
|
||||
}
|
||||
|
||||
@@ -1,30 +1,29 @@
|
||||
///////////////////////////////////////
|
||||
//DEFAULT PROCESS MODULE
|
||||
///////////////////////////////////////
|
||||
import { ODValidId } from "../modules/base"
|
||||
import { ODFlagManager, ODFlag } from "../modules/flag"
|
||||
import * as api from "@open-discord-bots/framework/api"
|
||||
|
||||
/**## ODFlagManagerIds_Default `interface`
|
||||
* This interface is a list of ids available in the `ODFlagManager_Default` class.
|
||||
* It's used to generate typescript declarations for this class.
|
||||
*/
|
||||
export interface ODFlagManagerIds_Default {
|
||||
"opendiscord:no-migration":ODFlag,
|
||||
"opendiscord:dev-config":ODFlag,
|
||||
"opendiscord:dev-database":ODFlag,
|
||||
"opendiscord:debug":ODFlag,
|
||||
"opendiscord:crash":ODFlag,
|
||||
"opendiscord:no-transcripts":ODFlag,
|
||||
"opendiscord:no-checker":ODFlag,
|
||||
"opendiscord:checker":ODFlag,
|
||||
"opendiscord:no-easter":ODFlag,
|
||||
"opendiscord:no-plugins":ODFlag,
|
||||
"opendiscord:soft-plugins":ODFlag,
|
||||
"opendiscord:force-slash-update":ODFlag,
|
||||
"opendiscord:no-compile":ODFlag,
|
||||
"opendiscord:compile-only":ODFlag,
|
||||
"opendiscord:silent":ODFlag,
|
||||
"opendiscord:cli":ODFlag,
|
||||
"opendiscord:no-migration":api.ODFlag,
|
||||
"opendiscord:dev-config":api.ODFlag,
|
||||
"opendiscord:dev-database":api.ODFlag,
|
||||
"opendiscord:debug":api.ODFlag,
|
||||
"opendiscord:crash":api.ODFlag,
|
||||
"opendiscord:no-transcripts":api.ODFlag,
|
||||
"opendiscord:no-checker":api.ODFlag,
|
||||
"opendiscord:checker":api.ODFlag,
|
||||
"opendiscord:no-easter":api.ODFlag,
|
||||
"opendiscord:no-plugins":api.ODFlag,
|
||||
"opendiscord:soft-plugins":api.ODFlag,
|
||||
"opendiscord:force-slash-update":api.ODFlag,
|
||||
"opendiscord:no-compile":api.ODFlag,
|
||||
"opendiscord:compile-only":api.ODFlag,
|
||||
"opendiscord:silent":api.ODFlag,
|
||||
"opendiscord:cli":api.ODFlag,
|
||||
}
|
||||
|
||||
/**## ODFlagManager_Default `default_class`
|
||||
@@ -33,25 +32,25 @@ export interface ODFlagManagerIds_Default {
|
||||
*
|
||||
* This default class is made for the global variable `opendiscord.flags`!
|
||||
*/
|
||||
export class ODFlagManager_Default extends ODFlagManager {
|
||||
export class ODFlagManager_Default extends api.ODFlagManager {
|
||||
get<FlagId extends keyof ODFlagManagerIds_Default>(id:FlagId): ODFlagManagerIds_Default[FlagId]
|
||||
get(id:ODValidId): ODFlag|null
|
||||
get(id:api.ODValidId): api.ODFlag|null
|
||||
|
||||
get(id:ODValidId): ODFlag|null {
|
||||
get(id:api.ODValidId): api.ODFlag|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<FlagId extends keyof ODFlagManagerIds_Default>(id:FlagId): ODFlagManagerIds_Default[FlagId]
|
||||
remove(id:ODValidId): ODFlag|null
|
||||
remove(id:api.ODValidId): api.ODFlag|null
|
||||
|
||||
remove(id:ODValidId): ODFlag|null {
|
||||
remove(id:api.ODValidId): api.ODFlag|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODFlagManagerIds_Default): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
///////////////////////////////////////
|
||||
//DEFAULT FUSE MODULE
|
||||
///////////////////////////////////////
|
||||
import * as api from "@open-discord-bots/framework/api"
|
||||
|
||||
export interface ODOpenTicketFuseList {
|
||||
/**Load the default Open Ticket questions (from `config/questions.json`) */
|
||||
questionLoading:boolean,
|
||||
/**Load the default Open Ticket options (from `config/options.json`) */
|
||||
optionLoading:boolean,
|
||||
/**Load the default Open Ticket panels (from `config/panels.json`) */
|
||||
panelLoading:boolean,
|
||||
/**Load the default Open Ticket tickets (from `database/tickets.json`) */
|
||||
ticketLoading:boolean,
|
||||
/**Load the default Open Ticket reaction roles (from `config/options.json`) */
|
||||
roleLoading:boolean,
|
||||
/**Load the default Open Ticket blacklist (from `database/users.json`) */
|
||||
blacklistLoading:boolean,
|
||||
/**Load the default Open Ticket transcript compilers. */
|
||||
transcriptCompilerLoading:boolean,
|
||||
/**Load the default Open Ticket transcript history (from `database/transcripts.json`) */
|
||||
transcriptHistoryLoading:boolean,
|
||||
/**The interval in milliseconds that are between autoclose timeout checkers. */
|
||||
autocloseCheckInterval:number,
|
||||
/**The interval in milliseconds that are between autodelete timeout checkers. */
|
||||
autodeleteCheckInterval:number,
|
||||
}
|
||||
@@ -1,8 +1,7 @@
|
||||
///////////////////////////////////////
|
||||
//DEFAULT HELP MODULE
|
||||
///////////////////////////////////////
|
||||
import { ODValidId } from "../modules/base"
|
||||
import { ODHelpMenuCategory, ODHelpMenuCommandComponent, ODHelpMenuComponent, ODHelpMenuManager } from "../modules/helpmenu"
|
||||
import * as api from "@open-discord-bots/framework/api"
|
||||
|
||||
/** (CONTRIBUTOR GUIDE) HOW TO ADD NEW COMMANDS?
|
||||
* - Register the command in loadAllSlashCommands() & loadAllTextCommands() in (./src/data/framework/commandLoader.ts)
|
||||
@@ -34,25 +33,25 @@ export interface ODHelpMenuManagerIds_Default {
|
||||
*
|
||||
* This default class is made for the global variable `opendiscord.helpmenu`!
|
||||
*/
|
||||
export class ODHelpMenuManager_Default extends ODHelpMenuManager {
|
||||
export class ODHelpMenuManager_Default extends api.ODHelpMenuManager {
|
||||
get<HelpMenuCategoryId extends keyof ODHelpMenuManagerIds_Default>(id:HelpMenuCategoryId): ODHelpMenuManagerIds_Default[HelpMenuCategoryId]
|
||||
get(id:ODValidId): ODHelpMenuCategory|null
|
||||
get(id:api.ODValidId): api.ODHelpMenuCategory|null
|
||||
|
||||
get(id:ODValidId): ODHelpMenuCategory|null {
|
||||
get(id:api.ODValidId): api.ODHelpMenuCategory|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<HelpMenuCategoryId extends keyof ODHelpMenuManagerIds_Default>(id:HelpMenuCategoryId): ODHelpMenuManagerIds_Default[HelpMenuCategoryId]
|
||||
remove(id:ODValidId): ODHelpMenuCategory|null
|
||||
remove(id:api.ODValidId): api.ODHelpMenuCategory|null
|
||||
|
||||
remove(id:ODValidId): ODHelpMenuCategory|null {
|
||||
remove(id:api.ODValidId): api.ODHelpMenuCategory|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODHelpMenuManagerIds_Default): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
}
|
||||
@@ -62,8 +61,8 @@ export class ODHelpMenuManager_Default extends ODHelpMenuManager {
|
||||
* It's used to generate typescript declarations for this class.
|
||||
*/
|
||||
export interface ODHelpMenuManagerCategoryIds_DefaultGeneral {
|
||||
"opendiscord:help":ODHelpMenuCommandComponent,
|
||||
"opendiscord:ticket":ODHelpMenuCommandComponent|null
|
||||
"opendiscord:help":api.ODHelpMenuCommandComponent,
|
||||
"opendiscord:ticket":api.ODHelpMenuCommandComponent|null
|
||||
}
|
||||
|
||||
/**## ODHelpMenuCategory_DefaultGeneral `default_class`
|
||||
@@ -72,25 +71,25 @@ export interface ODHelpMenuManagerCategoryIds_DefaultGeneral {
|
||||
*
|
||||
* This default class is made for the `opendiscord:general` category in `opendiscord.helpmenu`!
|
||||
*/
|
||||
export class ODHelpMenuCategory_DefaultGeneral extends ODHelpMenuCategory {
|
||||
export class ODHelpMenuCategory_DefaultGeneral extends api.ODHelpMenuCategory {
|
||||
get<HelpMenuCategoryId extends keyof ODHelpMenuManagerCategoryIds_DefaultGeneral>(id:HelpMenuCategoryId): ODHelpMenuManagerCategoryIds_DefaultGeneral[HelpMenuCategoryId]
|
||||
get(id:ODValidId): ODHelpMenuComponent|null
|
||||
get(id:api.ODValidId): api.ODHelpMenuComponent|null
|
||||
|
||||
get(id:ODValidId): ODHelpMenuComponent|null {
|
||||
get(id:api.ODValidId): api.ODHelpMenuComponent|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<HelpMenuCategoryId extends keyof ODHelpMenuManagerCategoryIds_DefaultGeneral>(id:HelpMenuCategoryId): ODHelpMenuManagerCategoryIds_DefaultGeneral[HelpMenuCategoryId]
|
||||
remove(id:ODValidId): ODHelpMenuComponent|null
|
||||
remove(id:api.ODValidId): api.ODHelpMenuComponent|null
|
||||
|
||||
remove(id:ODValidId): ODHelpMenuComponent|null {
|
||||
remove(id:api.ODValidId): api.ODHelpMenuComponent|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODHelpMenuManagerCategoryIds_DefaultGeneral): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
}
|
||||
@@ -100,9 +99,9 @@ export class ODHelpMenuCategory_DefaultGeneral extends ODHelpMenuCategory {
|
||||
* It's used to generate typescript declarations for this class.
|
||||
*/
|
||||
export interface ODHelpMenuManagerCategoryIds_DefaultTicketBasic {
|
||||
"opendiscord:close":ODHelpMenuCommandComponent,
|
||||
"opendiscord:delete":ODHelpMenuCommandComponent,
|
||||
"opendiscord:reopen":ODHelpMenuCommandComponent
|
||||
"opendiscord:close":api.ODHelpMenuCommandComponent,
|
||||
"opendiscord:delete":api.ODHelpMenuCommandComponent,
|
||||
"opendiscord:reopen":api.ODHelpMenuCommandComponent
|
||||
}
|
||||
|
||||
/**## ODHelpMenuCategory_DefaultTicketBasic `default_class`
|
||||
@@ -111,25 +110,25 @@ export interface ODHelpMenuManagerCategoryIds_DefaultTicketBasic {
|
||||
*
|
||||
* This default class is made for the `opendiscord:ticket` category in `opendiscord.helpmenu`!
|
||||
*/
|
||||
export class ODHelpMenuCategory_DefaultTicketBasic extends ODHelpMenuCategory {
|
||||
export class ODHelpMenuCategory_DefaultTicketBasic extends api.ODHelpMenuCategory {
|
||||
get<HelpMenuCategoryId extends keyof ODHelpMenuManagerCategoryIds_DefaultTicketBasic>(id:HelpMenuCategoryId): ODHelpMenuManagerCategoryIds_DefaultTicketBasic[HelpMenuCategoryId]
|
||||
get(id:ODValidId): ODHelpMenuComponent|null
|
||||
get(id:api.ODValidId): api.ODHelpMenuComponent|null
|
||||
|
||||
get(id:ODValidId): ODHelpMenuComponent|null {
|
||||
get(id:api.ODValidId): api.ODHelpMenuComponent|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<HelpMenuCategoryId extends keyof ODHelpMenuManagerCategoryIds_DefaultTicketBasic>(id:HelpMenuCategoryId): ODHelpMenuManagerCategoryIds_DefaultTicketBasic[HelpMenuCategoryId]
|
||||
remove(id:ODValidId): ODHelpMenuComponent|null
|
||||
remove(id:api.ODValidId): api.ODHelpMenuComponent|null
|
||||
|
||||
remove(id:ODValidId): ODHelpMenuComponent|null {
|
||||
remove(id:api.ODValidId): api.ODHelpMenuComponent|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODHelpMenuManagerCategoryIds_DefaultTicketBasic): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
}
|
||||
@@ -139,10 +138,10 @@ export class ODHelpMenuCategory_DefaultTicketBasic extends ODHelpMenuCategory {
|
||||
* It's used to generate typescript declarations for this class.
|
||||
*/
|
||||
export interface ODHelpMenuManagerCategoryIds_DefaultTicketAdvanced {
|
||||
"opendiscord:pin":ODHelpMenuCommandComponent,
|
||||
"opendiscord:unpin":ODHelpMenuCommandComponent,
|
||||
"opendiscord:move":ODHelpMenuCommandComponent,
|
||||
"opendiscord:rename":ODHelpMenuCommandComponent
|
||||
"opendiscord:pin":api.ODHelpMenuCommandComponent,
|
||||
"opendiscord:unpin":api.ODHelpMenuCommandComponent,
|
||||
"opendiscord:move":api.ODHelpMenuCommandComponent,
|
||||
"opendiscord:rename":api.ODHelpMenuCommandComponent
|
||||
}
|
||||
|
||||
/**## ODHelpMenuCategory_DefaultTicketAdvanced `default_class`
|
||||
@@ -151,25 +150,25 @@ export interface ODHelpMenuManagerCategoryIds_DefaultTicketAdvanced {
|
||||
*
|
||||
* This default class is made for the `opendiscord:ticket` category in `opendiscord.helpmenu`!
|
||||
*/
|
||||
export class ODHelpMenuCategory_DefaultTicketAdvanced extends ODHelpMenuCategory {
|
||||
export class ODHelpMenuCategory_DefaultTicketAdvanced extends api.ODHelpMenuCategory {
|
||||
get<HelpMenuCategoryId extends keyof ODHelpMenuManagerCategoryIds_DefaultTicketAdvanced>(id:HelpMenuCategoryId): ODHelpMenuManagerCategoryIds_DefaultTicketAdvanced[HelpMenuCategoryId]
|
||||
get(id:ODValidId): ODHelpMenuComponent|null
|
||||
get(id:api.ODValidId): api.ODHelpMenuComponent|null
|
||||
|
||||
get(id:ODValidId): ODHelpMenuComponent|null {
|
||||
get(id:api.ODValidId): api.ODHelpMenuComponent|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<HelpMenuCategoryId extends keyof ODHelpMenuManagerCategoryIds_DefaultTicketAdvanced>(id:HelpMenuCategoryId): ODHelpMenuManagerCategoryIds_DefaultTicketAdvanced[HelpMenuCategoryId]
|
||||
remove(id:ODValidId): ODHelpMenuComponent|null
|
||||
remove(id:api.ODValidId): api.ODHelpMenuComponent|null
|
||||
|
||||
remove(id:ODValidId): ODHelpMenuComponent|null {
|
||||
remove(id:api.ODValidId): api.ODHelpMenuComponent|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODHelpMenuManagerCategoryIds_DefaultTicketAdvanced): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
}
|
||||
@@ -179,11 +178,11 @@ export class ODHelpMenuCategory_DefaultTicketAdvanced extends ODHelpMenuCategory
|
||||
* It's used to generate typescript declarations for this class.
|
||||
*/
|
||||
export interface ODHelpMenuManagerCategoryIds_DefaultTicketUser {
|
||||
"opendiscord:claim":ODHelpMenuCommandComponent,
|
||||
"opendiscord:unclaim":ODHelpMenuCommandComponent,
|
||||
"opendiscord:add":ODHelpMenuCommandComponent,
|
||||
"opendiscord:remove":ODHelpMenuCommandComponent,
|
||||
"opendiscord:transfer":ODHelpMenuCommandComponent,
|
||||
"opendiscord:claim":api.ODHelpMenuCommandComponent,
|
||||
"opendiscord:unclaim":api.ODHelpMenuCommandComponent,
|
||||
"opendiscord:add":api.ODHelpMenuCommandComponent,
|
||||
"opendiscord:remove":api.ODHelpMenuCommandComponent,
|
||||
"opendiscord:transfer":api.ODHelpMenuCommandComponent,
|
||||
}
|
||||
|
||||
/**## ODHelpMenuCategory_DefaultTicketUser `default_class`
|
||||
@@ -192,25 +191,25 @@ export interface ODHelpMenuManagerCategoryIds_DefaultTicketUser {
|
||||
*
|
||||
* This default class is made for the `opendiscord:ticket` category in `opendiscord.helpmenu`!
|
||||
*/
|
||||
export class ODHelpMenuCategory_DefaultTicketUser extends ODHelpMenuCategory {
|
||||
export class ODHelpMenuCategory_DefaultTicketUser extends api.ODHelpMenuCategory {
|
||||
get<HelpMenuCategoryId extends keyof ODHelpMenuManagerCategoryIds_DefaultTicketUser>(id:HelpMenuCategoryId): ODHelpMenuManagerCategoryIds_DefaultTicketUser[HelpMenuCategoryId]
|
||||
get(id:ODValidId): ODHelpMenuComponent|null
|
||||
get(id:api.ODValidId): api.ODHelpMenuComponent|null
|
||||
|
||||
get(id:ODValidId): ODHelpMenuComponent|null {
|
||||
get(id:api.ODValidId): api.ODHelpMenuComponent|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<HelpMenuCategoryId extends keyof ODHelpMenuManagerCategoryIds_DefaultTicketUser>(id:HelpMenuCategoryId): ODHelpMenuManagerCategoryIds_DefaultTicketUser[HelpMenuCategoryId]
|
||||
remove(id:ODValidId): ODHelpMenuComponent|null
|
||||
remove(id:api.ODValidId): api.ODHelpMenuComponent|null
|
||||
|
||||
remove(id:ODValidId): ODHelpMenuComponent|null {
|
||||
remove(id:api.ODValidId): api.ODHelpMenuComponent|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODHelpMenuManagerCategoryIds_DefaultTicketUser): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
}
|
||||
@@ -220,11 +219,11 @@ export class ODHelpMenuCategory_DefaultTicketUser extends ODHelpMenuCategory {
|
||||
* It's used to generate typescript declarations for this class.
|
||||
*/
|
||||
export interface ODHelpMenuManagerCategoryIds_DefaultAdmin {
|
||||
"opendiscord:panel":ODHelpMenuCommandComponent,
|
||||
"opendiscord:blacklist-view":ODHelpMenuCommandComponent,
|
||||
"opendiscord:blacklist-add":ODHelpMenuCommandComponent,
|
||||
"opendiscord:blacklist-remove":ODHelpMenuCommandComponent,
|
||||
"opendiscord:blacklist-get":ODHelpMenuCommandComponent
|
||||
"opendiscord:panel":api.ODHelpMenuCommandComponent,
|
||||
"opendiscord:blacklist-view":api.ODHelpMenuCommandComponent,
|
||||
"opendiscord:blacklist-add":api.ODHelpMenuCommandComponent,
|
||||
"opendiscord:blacklist-remove":api.ODHelpMenuCommandComponent,
|
||||
"opendiscord:blacklist-get":api.ODHelpMenuCommandComponent
|
||||
}
|
||||
|
||||
/**## ODHelpMenuCategory_DefaultAdmin `default_class`
|
||||
@@ -233,25 +232,25 @@ export interface ODHelpMenuManagerCategoryIds_DefaultAdmin {
|
||||
*
|
||||
* This default class is made for the `opendiscord:admin` category in `opendiscord.helpmenu`!
|
||||
*/
|
||||
export class ODHelpMenuCategory_DefaultAdmin extends ODHelpMenuCategory {
|
||||
export class ODHelpMenuCategory_DefaultAdmin extends api.ODHelpMenuCategory {
|
||||
get<HelpMenuCategoryId extends keyof ODHelpMenuManagerCategoryIds_DefaultAdmin>(id:HelpMenuCategoryId): ODHelpMenuManagerCategoryIds_DefaultAdmin[HelpMenuCategoryId]
|
||||
get(id:ODValidId): ODHelpMenuComponent|null
|
||||
get(id:api.ODValidId): api.ODHelpMenuComponent|null
|
||||
|
||||
get(id:ODValidId): ODHelpMenuComponent|null {
|
||||
get(id:api.ODValidId): api.ODHelpMenuComponent|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<HelpMenuCategoryId extends keyof ODHelpMenuManagerCategoryIds_DefaultAdmin>(id:HelpMenuCategoryId): ODHelpMenuManagerCategoryIds_DefaultAdmin[HelpMenuCategoryId]
|
||||
remove(id:ODValidId): ODHelpMenuComponent|null
|
||||
remove(id:api.ODValidId): api.ODHelpMenuComponent|null
|
||||
|
||||
remove(id:ODValidId): ODHelpMenuComponent|null {
|
||||
remove(id:api.ODValidId): api.ODHelpMenuComponent|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODHelpMenuManagerCategoryIds_DefaultAdmin): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
}
|
||||
@@ -261,16 +260,16 @@ export class ODHelpMenuCategory_DefaultAdmin extends ODHelpMenuCategory {
|
||||
* It's used to generate typescript declarations for this class.
|
||||
*/
|
||||
export interface ODHelpMenuManagerCategoryIds_DefaultAdvanced {
|
||||
"opendiscord:stats-global":ODHelpMenuCommandComponent,
|
||||
"opendiscord:stats-reset":ODHelpMenuCommandComponent,
|
||||
"opendiscord:stats-ticket":ODHelpMenuCommandComponent,
|
||||
"opendiscord:stats-user":ODHelpMenuCommandComponent,
|
||||
"opendiscord:autoclose-disable":ODHelpMenuCommandComponent,
|
||||
"opendiscord:autoclose-enable":ODHelpMenuCommandComponent,
|
||||
"opendiscord:autodelete-disable":ODHelpMenuCommandComponent,
|
||||
"opendiscord:autodelete-enable":ODHelpMenuCommandComponent,
|
||||
"opendiscord:topic-set":ODHelpMenuCommandComponent,
|
||||
"opendiscord:priority-set":ODHelpMenuCommandComponent,
|
||||
"opendiscord:stats-global":api.ODHelpMenuCommandComponent,
|
||||
"opendiscord:stats-reset":api.ODHelpMenuCommandComponent,
|
||||
"opendiscord:stats-ticket":api.ODHelpMenuCommandComponent,
|
||||
"opendiscord:stats-user":api.ODHelpMenuCommandComponent,
|
||||
"opendiscord:autoclose-disable":api.ODHelpMenuCommandComponent,
|
||||
"opendiscord:autoclose-enable":api.ODHelpMenuCommandComponent,
|
||||
"opendiscord:autodelete-disable":api.ODHelpMenuCommandComponent,
|
||||
"opendiscord:autodelete-enable":api.ODHelpMenuCommandComponent,
|
||||
"opendiscord:topic-set":api.ODHelpMenuCommandComponent,
|
||||
"opendiscord:priority-set":api.ODHelpMenuCommandComponent,
|
||||
}
|
||||
|
||||
/**## ODHelpMenuCategory_DefaultAdvanced `default_class`
|
||||
@@ -279,25 +278,25 @@ export interface ODHelpMenuManagerCategoryIds_DefaultAdvanced {
|
||||
*
|
||||
* This default class is made for the `opendiscord:advanced` category in `opendiscord.helpmenu`!
|
||||
*/
|
||||
export class ODHelpMenuCategory_DefaultAdvanced extends ODHelpMenuCategory {
|
||||
export class ODHelpMenuCategory_DefaultAdvanced extends api.ODHelpMenuCategory {
|
||||
get<HelpMenuCategoryId extends keyof ODHelpMenuManagerCategoryIds_DefaultAdvanced>(id:HelpMenuCategoryId): ODHelpMenuManagerCategoryIds_DefaultAdvanced[HelpMenuCategoryId]
|
||||
get(id:ODValidId): ODHelpMenuComponent|null
|
||||
get(id:api.ODValidId): api.ODHelpMenuComponent|null
|
||||
|
||||
get(id:ODValidId): ODHelpMenuComponent|null {
|
||||
get(id:api.ODValidId): api.ODHelpMenuComponent|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<HelpMenuCategoryId extends keyof ODHelpMenuManagerCategoryIds_DefaultAdvanced>(id:HelpMenuCategoryId): ODHelpMenuManagerCategoryIds_DefaultAdvanced[HelpMenuCategoryId]
|
||||
remove(id:ODValidId): ODHelpMenuComponent|null
|
||||
remove(id:api.ODValidId): api.ODHelpMenuComponent|null
|
||||
|
||||
remove(id:ODValidId): ODHelpMenuComponent|null {
|
||||
remove(id:api.ODValidId): api.ODHelpMenuComponent|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODHelpMenuManagerCategoryIds_DefaultAdvanced): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
}
|
||||
@@ -314,25 +313,25 @@ export interface ODHelpMenuManagerCategoryIds_DefaultExtra {}
|
||||
*
|
||||
* This default class is made for the `opendiscord:general` category in `opendiscord.helpmenu`!
|
||||
*/
|
||||
export class ODHelpMenuCategory_DefaultExtra extends ODHelpMenuCategory {
|
||||
export class ODHelpMenuCategory_DefaultExtra extends api.ODHelpMenuCategory {
|
||||
get<HelpMenuCategoryId extends keyof ODHelpMenuManagerCategoryIds_DefaultExtra>(id:HelpMenuCategoryId): ODHelpMenuManagerCategoryIds_DefaultExtra[HelpMenuCategoryId]
|
||||
get(id:ODValidId): ODHelpMenuComponent|null
|
||||
get(id:api.ODValidId): api.ODHelpMenuComponent|null
|
||||
|
||||
get(id:ODValidId): ODHelpMenuComponent|null {
|
||||
get(id:api.ODValidId): api.ODHelpMenuComponent|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<HelpMenuCategoryId extends keyof ODHelpMenuManagerCategoryIds_DefaultExtra>(id:HelpMenuCategoryId): ODHelpMenuManagerCategoryIds_DefaultExtra[HelpMenuCategoryId]
|
||||
remove(id:ODValidId): ODHelpMenuComponent|null
|
||||
remove(id:api.ODValidId): api.ODHelpMenuComponent|null
|
||||
|
||||
remove(id:ODValidId): ODHelpMenuComponent|null {
|
||||
remove(id:api.ODValidId): api.ODHelpMenuComponent|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODHelpMenuManagerCategoryIds_DefaultExtra): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,7 @@
|
||||
///////////////////////////////////////
|
||||
//DEFAULT LANGUAGE MODULE
|
||||
///////////////////////////////////////
|
||||
import { ODValidId } from "../modules/base"
|
||||
import { ODLanguageManager, ODLanguage } from "../modules/language"
|
||||
import * as api from "@open-discord-bots/framework/api"
|
||||
|
||||
/** (CONTRIBUTOR GUIDE) HOW TO ADD NEW LANGUAGES?
|
||||
* - Add the file to (./languages/) and make sure the metadata is valid.
|
||||
@@ -18,43 +17,43 @@ import { ODLanguageManager, ODLanguage } from "../modules/language"
|
||||
* It's used to generate typescript declarations for this class.
|
||||
*/
|
||||
export interface ODLanguageManagerIds_Default {
|
||||
"opendiscord:custom":ODLanguage,
|
||||
"opendiscord:english":ODLanguage,
|
||||
"opendiscord:dutch":ODLanguage,
|
||||
"opendiscord:portuguese":ODLanguage,
|
||||
"opendiscord:czech":ODLanguage,
|
||||
"opendiscord:german":ODLanguage,
|
||||
"opendiscord:catalan":ODLanguage,
|
||||
"opendiscord:hungarian":ODLanguage,
|
||||
"opendiscord:spanish":ODLanguage,
|
||||
"opendiscord:romanian":ODLanguage,
|
||||
"opendiscord:ukrainian":ODLanguage,
|
||||
"opendiscord:indonesian":ODLanguage,
|
||||
"opendiscord:italian":ODLanguage,
|
||||
"opendiscord:estonian":ODLanguage,
|
||||
"opendiscord:finnish":ODLanguage,
|
||||
"opendiscord:danish":ODLanguage,
|
||||
"opendiscord:thai":ODLanguage,
|
||||
"opendiscord:turkish":ODLanguage,
|
||||
"opendiscord:french":ODLanguage,
|
||||
"opendiscord:arabic":ODLanguage,
|
||||
"opendiscord:hindi":ODLanguage,
|
||||
"opendiscord:lithuanian":ODLanguage,
|
||||
"opendiscord:polish":ODLanguage,
|
||||
"opendiscord:latvian":ODLanguage,
|
||||
"opendiscord:norwegian":ODLanguage,
|
||||
"opendiscord:russian":ODLanguage,
|
||||
"opendiscord:swedish":ODLanguage,
|
||||
"opendiscord:vietnamese":ODLanguage,
|
||||
"opendiscord:persian":ODLanguage,
|
||||
"opendiscord:bengali":ODLanguage,
|
||||
"opendiscord:greek":ODLanguage,
|
||||
"opendiscord:japanese":ODLanguage,
|
||||
"opendiscord:korean":ODLanguage,
|
||||
"opendiscord:kurdish":ODLanguage,
|
||||
"opendiscord:simplified-chinese":ODLanguage,
|
||||
"opendiscord:slovenian":ODLanguage,
|
||||
"opendiscord:tamil":ODLanguage,
|
||||
"opendiscord:custom":api.ODLanguage,
|
||||
"opendiscord:english":api.ODLanguage,
|
||||
"opendiscord:dutch":api.ODLanguage,
|
||||
"opendiscord:portuguese":api.ODLanguage,
|
||||
"opendiscord:czech":api.ODLanguage,
|
||||
"opendiscord:german":api.ODLanguage,
|
||||
"opendiscord:catalan":api.ODLanguage,
|
||||
"opendiscord:hungarian":api.ODLanguage,
|
||||
"opendiscord:spanish":api.ODLanguage,
|
||||
"opendiscord:romanian":api.ODLanguage,
|
||||
"opendiscord:ukrainian":api.ODLanguage,
|
||||
"opendiscord:indonesian":api.ODLanguage,
|
||||
"opendiscord:italian":api.ODLanguage,
|
||||
"opendiscord:estonian":api.ODLanguage,
|
||||
"opendiscord:finnish":api.ODLanguage,
|
||||
"opendiscord:danish":api.ODLanguage,
|
||||
"opendiscord:thai":api.ODLanguage,
|
||||
"opendiscord:turkish":api.ODLanguage,
|
||||
"opendiscord:french":api.ODLanguage,
|
||||
"opendiscord:arabic":api.ODLanguage,
|
||||
"opendiscord:hindi":api.ODLanguage,
|
||||
"opendiscord:lithuanian":api.ODLanguage,
|
||||
"opendiscord:polish":api.ODLanguage,
|
||||
"opendiscord:latvian":api.ODLanguage,
|
||||
"opendiscord:norwegian":api.ODLanguage,
|
||||
"opendiscord:russian":api.ODLanguage,
|
||||
"opendiscord:swedish":api.ODLanguage,
|
||||
"opendiscord:vietnamese":api.ODLanguage,
|
||||
"opendiscord:persian":api.ODLanguage,
|
||||
"opendiscord:bengali":api.ODLanguage,
|
||||
"opendiscord:greek":api.ODLanguage,
|
||||
"opendiscord:japanese":api.ODLanguage,
|
||||
"opendiscord:korean":api.ODLanguage,
|
||||
"opendiscord:kurdish":api.ODLanguage,
|
||||
"opendiscord:simplified-chinese":api.ODLanguage,
|
||||
"opendiscord:slovenian":api.ODLanguage,
|
||||
"opendiscord:tamil":api.ODLanguage,
|
||||
//ADD NEW LANGUAGES HERE!!!
|
||||
}
|
||||
|
||||
@@ -628,25 +627,25 @@ export type ODLanguageManagerTranslations_Default = (
|
||||
*
|
||||
* This default class is made for the global variable `opendiscord.languages`!
|
||||
*/
|
||||
export class ODLanguageManager_Default extends ODLanguageManager {
|
||||
export class ODLanguageManager_Default extends api.ODLanguageManager {
|
||||
get<LanguageId extends keyof ODLanguageManagerIds_Default>(id:LanguageId): ODLanguageManagerIds_Default[LanguageId]
|
||||
get(id:ODValidId): ODLanguage|null
|
||||
get(id:api.ODValidId): api.ODLanguage|null
|
||||
|
||||
get(id:ODValidId): ODLanguage|null {
|
||||
get(id:api.ODValidId): api.ODLanguage|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<LanguageId extends keyof ODLanguageManagerIds_Default>(id:LanguageId): ODLanguageManagerIds_Default[LanguageId]
|
||||
remove(id:ODValidId): ODLanguage|null
|
||||
remove(id:api.ODValidId): api.ODLanguage|null
|
||||
|
||||
remove(id:ODValidId): ODLanguage|null {
|
||||
remove(id:api.ODValidId): api.ODLanguage|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODLanguageManagerIds_Default): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
|
||||
@@ -658,16 +657,16 @@ export class ODLanguageManager_Default extends ODLanguageManager {
|
||||
}
|
||||
|
||||
setCurrentLanguage(id:keyof ODLanguageManagerIds_Default): void
|
||||
setCurrentLanguage(id:ODValidId): void
|
||||
setCurrentLanguage(id:api.ODValidId): void
|
||||
|
||||
setCurrentLanguage(id:ODValidId): void {
|
||||
setCurrentLanguage(id:api.ODValidId): void {
|
||||
return super.setCurrentLanguage(id)
|
||||
}
|
||||
|
||||
setBackupLanguage(id:keyof ODLanguageManagerIds_Default): void
|
||||
setBackupLanguage(id:ODValidId): void
|
||||
setBackupLanguage(id:api.ODValidId): void
|
||||
|
||||
setBackupLanguage(id:ODValidId): void {
|
||||
setBackupLanguage(id:api.ODValidId): void {
|
||||
return super.setBackupLanguage(id)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
///////////////////////////////////////
|
||||
//DEFAULT PERMISSION MODULE
|
||||
///////////////////////////////////////
|
||||
import { ODDebugger } from "../modules/console"
|
||||
import { ODPermissionManager } from "../modules/permission"
|
||||
import * as api from "@open-discord-bots/framework/api"
|
||||
import { ODClientManager_Default } from "./client"
|
||||
|
||||
/**## ODPermissionManager_Default `default_class`
|
||||
@@ -11,8 +10,8 @@ import { ODClientManager_Default } from "./client"
|
||||
*
|
||||
* This default class is made for the global variable `opendiscord.permissions`!
|
||||
*/
|
||||
export class ODPermissionManager_Default extends ODPermissionManager {
|
||||
constructor(debug:ODDebugger,client:ODClientManager_Default){
|
||||
export class ODPermissionManager_Default extends api.ODPermissionManager {
|
||||
constructor(debug:api.ODDebugger,client:ODClientManager_Default){
|
||||
super(debug,client,true)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
///////////////////////////////////////
|
||||
//DEFAULT POST MODULE
|
||||
///////////////////////////////////////
|
||||
import { ODValidId, ODManagerData } from "../modules/base"
|
||||
import { ODPlugin, ODPluginClassManager, ODPluginManager } from "../modules/plugin"
|
||||
import * as api from "@open-discord-bots/framework/api"
|
||||
|
||||
/**## ODPluginManagerIds_Default `interface`
|
||||
* This interface is a list of ids available in the `ODPluginManager_Default` class.
|
||||
@@ -16,27 +15,27 @@ export interface ODPluginManagerIds_Default {}
|
||||
*
|
||||
* This default class is made for the global variable `opendiscord.plugins`!
|
||||
*/
|
||||
export class ODPluginManager_Default extends ODPluginManager {
|
||||
export class ODPluginManager_Default extends api.ODPluginManager {
|
||||
declare classes: ODPluginClassManager_Default
|
||||
|
||||
get<PluginId extends keyof ODPluginManagerIds_Default>(id:PluginId): ODPluginManagerIds_Default[PluginId]
|
||||
get(id:ODValidId): ODPlugin|null
|
||||
get(id:api.ODValidId): api.ODPlugin|null
|
||||
|
||||
get(id:ODValidId): ODPlugin|null {
|
||||
get(id:api.ODValidId): api.ODPlugin|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<PluginId extends keyof ODPluginManagerIds_Default>(id:PluginId): ODPluginManagerIds_Default[PluginId]
|
||||
remove(id:ODValidId): ODPlugin|null
|
||||
remove(id:api.ODValidId): api.ODPlugin|null
|
||||
|
||||
remove(id:ODValidId): ODPlugin|null {
|
||||
remove(id:api.ODValidId): api.ODPlugin|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODPluginManagerIds_Default): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
}
|
||||
@@ -53,25 +52,25 @@ export interface ODPluginClassManagerIds_Default {}
|
||||
*
|
||||
* This default class is made for the global variable `opendiscord.plugins.classes`!
|
||||
*/
|
||||
export class ODPluginClassManager_Default extends ODPluginClassManager {
|
||||
export class ODPluginClassManager_Default extends api.ODPluginClassManager {
|
||||
get<PluginClassId extends keyof ODPluginClassManagerIds_Default>(id:PluginClassId): ODPluginClassManagerIds_Default[PluginClassId]
|
||||
get(id:ODValidId): ODManagerData|null
|
||||
get(id:api.ODValidId): api.ODManagerData|null
|
||||
|
||||
get(id:ODValidId): ODManagerData|null {
|
||||
get(id:api.ODValidId): api.ODManagerData|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<PluginClassId extends keyof ODPluginClassManagerIds_Default>(id:PluginClassId): ODPluginClassManagerIds_Default[PluginClassId]
|
||||
remove(id:ODValidId): ODManagerData|null
|
||||
remove(id:api.ODValidId): api.ODManagerData|null
|
||||
|
||||
remove(id:ODValidId): ODManagerData|null {
|
||||
remove(id:api.ODValidId): api.ODManagerData|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODPluginClassManagerIds_Default): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,7 @@
|
||||
///////////////////////////////////////
|
||||
//DEFAULT POST MODULE
|
||||
///////////////////////////////////////
|
||||
import { ODValidId } from "../modules/base"
|
||||
import { ODPost, ODPostManager } from "../modules/post"
|
||||
import * as api from "@open-discord-bots/framework/api"
|
||||
import * as discord from "discord.js"
|
||||
|
||||
/**## ODPostManagerIds_Default `interface`
|
||||
@@ -10,8 +9,8 @@ import * as discord from "discord.js"
|
||||
* It's used to generate typescript declarations for this class.
|
||||
*/
|
||||
export interface ODPostManagerIds_Default {
|
||||
"opendiscord:logs":ODPost<discord.GuildTextBasedChannel>|null,
|
||||
"opendiscord:transcripts":ODPost<discord.GuildTextBasedChannel>|null
|
||||
"opendiscord:logs":api.ODPost<discord.GuildTextBasedChannel>|null,
|
||||
"opendiscord:transcripts":api.ODPost<discord.GuildTextBasedChannel>|null
|
||||
}
|
||||
|
||||
/**## ODPostManager_Default `default_class`
|
||||
@@ -20,25 +19,25 @@ export interface ODPostManagerIds_Default {
|
||||
*
|
||||
* This default class is made for the global variable `opendiscord.code`!
|
||||
*/
|
||||
export class ODPostManager_Default extends ODPostManager {
|
||||
export class ODPostManager_Default extends api.ODPostManager {
|
||||
get<PostId extends keyof ODPostManagerIds_Default>(id:PostId): ODPostManagerIds_Default[PostId]
|
||||
get(id:ODValidId): ODPost<discord.GuildBasedChannel>|null
|
||||
get(id:api.ODValidId): api.ODPost<discord.GuildBasedChannel>|null
|
||||
|
||||
get(id:ODValidId): ODPost<discord.GuildBasedChannel>|null {
|
||||
get(id:api.ODValidId): api.ODPost<discord.GuildBasedChannel>|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<PostId extends keyof ODPostManagerIds_Default>(id:PostId): ODPostManagerIds_Default[PostId]
|
||||
remove(id:ODValidId): ODPost<discord.GuildBasedChannel>|null
|
||||
remove(id:api.ODValidId): api.ODPost<discord.GuildBasedChannel>|null
|
||||
|
||||
remove(id:ODValidId): ODPost<discord.GuildBasedChannel>|null {
|
||||
remove(id:api.ODValidId): api.ODPost<discord.GuildBasedChannel>|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODPostManagerIds_Default): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,7 @@
|
||||
///////////////////////////////////////
|
||||
//DEFAULT PROGRESS BAR MODULE
|
||||
///////////////////////////////////////
|
||||
import { ODValidId } from "../modules/base"
|
||||
import { ODValidConsoleColor } from "../modules/console"
|
||||
import { ODManualProgressBar, ODProgressBar, ODProgressBarManager, ODProgressBarRenderer, ODProgressBarRendererManager } from "../modules/progressbar"
|
||||
import * as api from "@open-discord-bots/framework/api"
|
||||
import ansis from "ansis"
|
||||
|
||||
/**## ODProgressBarRenderer_DefaultSettingsLabel `type`
|
||||
@@ -16,17 +14,17 @@ export type ODProgressBarRenderer_DefaultSettingsLabel = "value"|"percentage"|"f
|
||||
*/
|
||||
export interface ODProgressBarRenderer_DefaultSettings {
|
||||
/**The color of the progress bar border. */
|
||||
borderColor:ODValidConsoleColor|"openticket",
|
||||
borderColor:api.ODValidConsoleColor|"openticket",
|
||||
/**The color of the progress bar (filled side). */
|
||||
filledBarColor:ODValidConsoleColor|"openticket",
|
||||
filledBarColor:api.ODValidConsoleColor|"openticket",
|
||||
/**The color of the progress bar (empty side). */
|
||||
emptyBarColor:ODValidConsoleColor|"openticket",
|
||||
emptyBarColor:api.ODValidConsoleColor|"openticket",
|
||||
/**The color of the text before the progress bar. */
|
||||
prefixColor:ODValidConsoleColor|"openticket",
|
||||
prefixColor:api.ODValidConsoleColor|"openticket",
|
||||
/**The color of the text after the progress bar. */
|
||||
suffixColor:ODValidConsoleColor|"openticket",
|
||||
suffixColor:api.ODValidConsoleColor|"openticket",
|
||||
/**The color of the progress bar label. */
|
||||
labelColor:ODValidConsoleColor|"openticket",
|
||||
labelColor:api.ODValidConsoleColor|"openticket",
|
||||
|
||||
/**The character used in the left border. */
|
||||
leftBorderChar:string,
|
||||
@@ -51,8 +49,8 @@ export interface ODProgressBarRenderer_DefaultSettings {
|
||||
showBorder:boolean,
|
||||
}
|
||||
|
||||
export class ODProgressBarRenderer_Default extends ODProgressBarRenderer<ODProgressBarRenderer_DefaultSettings> {
|
||||
constructor(id:ODValidId,settings:ODProgressBarRenderer_DefaultSettings){
|
||||
export class ODProgressBarRenderer_Default extends api.ODProgressBarRenderer<ODProgressBarRenderer_DefaultSettings> {
|
||||
constructor(id:api.ODValidId,settings:ODProgressBarRenderer_DefaultSettings){
|
||||
super(id,(settings,min,max,value,rawPrefix,rawSuffix) => {
|
||||
const percentage = (value-min)/(max-min)
|
||||
const barLevel = Math.round(percentage*settings.barWidth)
|
||||
@@ -103,25 +101,25 @@ export interface ODProgressBarRendererManagerIds_Default {
|
||||
*
|
||||
* This default class is made for the global variable `opendiscord.progressbars.renderers`!
|
||||
*/
|
||||
export class ODProgressBarRendererManager_Default extends ODProgressBarRendererManager {
|
||||
export class ODProgressBarRendererManager_Default extends api.ODProgressBarRendererManager {
|
||||
get<ProgressBarId extends keyof ODProgressBarRendererManagerIds_Default>(id:ProgressBarId): ODProgressBarRendererManagerIds_Default[ProgressBarId]
|
||||
get(id:ODValidId): ODProgressBarRenderer<{}>|null
|
||||
get(id:api.ODValidId): api.ODProgressBarRenderer<{}>|null
|
||||
|
||||
get(id:ODValidId): ODProgressBarRenderer<{}>|null {
|
||||
get(id:api.ODValidId): api.ODProgressBarRenderer<{}>|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<ProgressBarId extends keyof ODProgressBarRendererManagerIds_Default>(id:ProgressBarId): ODProgressBarRendererManagerIds_Default[ProgressBarId]
|
||||
remove(id:ODValidId): ODProgressBarRenderer<{}>|null
|
||||
remove(id:api.ODValidId): api.ODProgressBarRenderer<{}>|null
|
||||
|
||||
remove(id:ODValidId): ODProgressBarRenderer<{}>|null {
|
||||
remove(id:api.ODValidId): api.ODProgressBarRenderer<{}>|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODProgressBarRendererManagerIds_Default): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
}
|
||||
@@ -131,12 +129,12 @@ export class ODProgressBarRendererManager_Default extends ODProgressBarRendererM
|
||||
* It's used to generate typescript declarations for this class.
|
||||
*/
|
||||
export interface ODProgressBarManagerIds_Default {
|
||||
"opendiscord:slash-command-remove":ODManualProgressBar,
|
||||
"opendiscord:slash-command-create":ODManualProgressBar,
|
||||
"opendiscord:slash-command-update":ODManualProgressBar,
|
||||
"opendiscord:context-menu-remove":ODManualProgressBar,
|
||||
"opendiscord:context-menu-create":ODManualProgressBar,
|
||||
"opendiscord:context-menu-update":ODManualProgressBar,
|
||||
"opendiscord:slash-command-remove":api.ODManualProgressBar,
|
||||
"opendiscord:slash-command-create":api.ODManualProgressBar,
|
||||
"opendiscord:slash-command-update":api.ODManualProgressBar,
|
||||
"opendiscord:context-menu-remove":api.ODManualProgressBar,
|
||||
"opendiscord:context-menu-create":api.ODManualProgressBar,
|
||||
"opendiscord:context-menu-update":api.ODManualProgressBar,
|
||||
}
|
||||
|
||||
/**## ODProgressBarManager_Default `default_class`
|
||||
@@ -145,27 +143,27 @@ export interface ODProgressBarManagerIds_Default {
|
||||
*
|
||||
* This default class is made for the global variable `opendiscord.progressbars`!
|
||||
*/
|
||||
export class ODProgressBarManager_Default extends ODProgressBarManager {
|
||||
export class ODProgressBarManager_Default extends api.ODProgressBarManager {
|
||||
declare renderers: ODProgressBarRendererManager_Default
|
||||
|
||||
get<ProgressBarId extends keyof ODProgressBarManagerIds_Default>(id:ProgressBarId): ODProgressBarManagerIds_Default[ProgressBarId]
|
||||
get(id:ODValidId): ODProgressBar|null
|
||||
get(id:api.ODValidId): api.ODProgressBar|null
|
||||
|
||||
get(id:ODValidId): ODProgressBar|null {
|
||||
get(id:api.ODValidId): api.ODProgressBar|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<ProgressBarId extends keyof ODProgressBarManagerIds_Default>(id:ProgressBarId): ODProgressBarManagerIds_Default[ProgressBarId]
|
||||
remove(id:ODValidId): ODProgressBar|null
|
||||
remove(id:api.ODValidId): api.ODProgressBar|null
|
||||
|
||||
remove(id:ODValidId): ODProgressBar|null {
|
||||
remove(id:api.ODValidId): api.ODProgressBar|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODProgressBarManagerIds_Default): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,7 @@
|
||||
///////////////////////////////////////
|
||||
//DEFAULT RESPONDER MODULE
|
||||
///////////////////////////////////////
|
||||
import { ODValidId } from "../modules/base"
|
||||
import { ODAutocompleteResponder, ODAutocompleteResponderInstance, ODAutocompleteResponderManager, ODButtonResponder, ODButtonResponderInstance, ODButtonResponderManager, ODCommandResponder, ODCommandResponderInstance, ODCommandResponderManager, ODContextMenuResponder, ODContextMenuResponderInstance, ODContextMenuResponderManager, ODDropdownResponder, ODDropdownResponderInstance, ODDropdownResponderManager, ODModalResponder, ODModalResponderInstance, ODModalResponderManager, ODResponderManager } from "../modules/responder"
|
||||
import * as api from "@open-discord-bots/framework/api"
|
||||
import { ODWorkerManager_Default } from "./worker"
|
||||
|
||||
/**## ODResponderManager_Default `default_class`
|
||||
@@ -11,7 +10,7 @@ import { ODWorkerManager_Default } from "./worker"
|
||||
*
|
||||
* This default class is made for the global variable `opendiscord.responders`!
|
||||
*/
|
||||
export class ODResponderManager_Default extends ODResponderManager {
|
||||
export class ODResponderManager_Default extends api.ODResponderManager {
|
||||
declare commands: ODCommandResponderManager_Default
|
||||
declare buttons: ODButtonResponderManager_Default
|
||||
declare dropdowns: ODDropdownResponderManager_Default
|
||||
@@ -58,25 +57,25 @@ export interface ODCommandResponderManagerIds_Default {
|
||||
*
|
||||
* This default class is made for the global variable `opendiscord.responders.commands`!
|
||||
*/
|
||||
export class ODCommandResponderManager_Default extends ODCommandResponderManager {
|
||||
export class ODCommandResponderManager_Default extends api.ODCommandResponderManager {
|
||||
get<CommandResponderId extends keyof ODCommandResponderManagerIds_Default>(id:CommandResponderId): ODCommandResponder_Default<ODCommandResponderManagerIds_Default[CommandResponderId]["source"],ODCommandResponderManagerIds_Default[CommandResponderId]["params"],ODCommandResponderManagerIds_Default[CommandResponderId]["workers"]>
|
||||
get(id:ODValidId): ODCommandResponder<"slash"|"text",any>|null
|
||||
get(id:api.ODValidId): api.ODCommandResponder<"slash"|"text",any>|null
|
||||
|
||||
get(id:ODValidId): ODCommandResponder<"slash"|"text",any>|null {
|
||||
get(id:api.ODValidId): api.ODCommandResponder<"slash"|"text",any>|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<CommandResponderId extends keyof ODCommandResponderManagerIds_Default>(id:CommandResponderId): ODCommandResponder_Default<ODCommandResponderManagerIds_Default[CommandResponderId]["source"],ODCommandResponderManagerIds_Default[CommandResponderId]["params"],ODCommandResponderManagerIds_Default[CommandResponderId]["workers"]>
|
||||
remove(id:ODValidId): ODCommandResponder<"slash"|"text",any>|null
|
||||
remove(id:api.ODValidId): api.ODCommandResponder<"slash"|"text",any>|null
|
||||
|
||||
remove(id:ODValidId): ODCommandResponder<"slash"|"text",any>|null {
|
||||
remove(id:api.ODValidId): api.ODCommandResponder<"slash"|"text",any>|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODCommandResponderManagerIds_Default): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
}
|
||||
@@ -87,8 +86,8 @@ export class ODCommandResponderManager_Default extends ODCommandResponderManager
|
||||
*
|
||||
* This default class is made for the default `ODCommandResponder`'s!
|
||||
*/
|
||||
export class ODCommandResponder_Default<Source extends "slash"|"text", Params, WorkerIds extends string> extends ODCommandResponder<Source,Params> {
|
||||
declare workers: ODWorkerManager_Default<ODCommandResponderInstance,Source,Params,WorkerIds>
|
||||
export class ODCommandResponder_Default<Source extends "slash"|"text", Params, WorkerIds extends string> extends api.ODCommandResponder<Source,Params> {
|
||||
declare workers: ODWorkerManager_Default<api.ODCommandResponderInstance,Source,Params,WorkerIds>
|
||||
}
|
||||
|
||||
/**## ODButtonResponderManagerIds_Default `interface`
|
||||
@@ -125,25 +124,25 @@ export interface ODButtonResponderManagerIds_Default {
|
||||
*
|
||||
* This default class is made for the global variable `opendiscord.responders.buttons`!
|
||||
*/
|
||||
export class ODButtonResponderManager_Default extends ODButtonResponderManager {
|
||||
export class ODButtonResponderManager_Default extends api.ODButtonResponderManager {
|
||||
get<ButtonResponderId extends keyof ODButtonResponderManagerIds_Default>(id:ButtonResponderId): ODButtonResponder_Default<ODButtonResponderManagerIds_Default[ButtonResponderId]["source"],ODButtonResponderManagerIds_Default[ButtonResponderId]["params"],ODButtonResponderManagerIds_Default[ButtonResponderId]["workers"]>
|
||||
get(id:ODValidId): ODButtonResponder<"button",any>|null
|
||||
get(id:api.ODValidId): api.ODButtonResponder<"button",any>|null
|
||||
|
||||
get(id:ODValidId): ODButtonResponder<"button",any>|null {
|
||||
get(id:api.ODValidId): api.ODButtonResponder<"button",any>|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<ButtonResponderId extends keyof ODButtonResponderManagerIds_Default>(id:ButtonResponderId): ODButtonResponder_Default<ODButtonResponderManagerIds_Default[ButtonResponderId]["source"],ODButtonResponderManagerIds_Default[ButtonResponderId]["params"],ODButtonResponderManagerIds_Default[ButtonResponderId]["workers"]>
|
||||
remove(id:ODValidId): ODButtonResponder<"button",any>|null
|
||||
remove(id:api.ODValidId): api.ODButtonResponder<"button",any>|null
|
||||
|
||||
remove(id:ODValidId): ODButtonResponder<"button",any>|null {
|
||||
remove(id:api.ODValidId): api.ODButtonResponder<"button",any>|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODButtonResponderManagerIds_Default): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
}
|
||||
@@ -154,8 +153,8 @@ export class ODButtonResponderManager_Default extends ODButtonResponderManager {
|
||||
*
|
||||
* This default class is made for the default `ODButtonResponder`'s!
|
||||
*/
|
||||
export class ODButtonResponder_Default<Source extends string, Params, WorkerIds extends string> extends ODButtonResponder<Source,Params> {
|
||||
declare workers: ODWorkerManager_Default<ODButtonResponderInstance,Source,Params,WorkerIds>
|
||||
export class ODButtonResponder_Default<Source extends string, Params, WorkerIds extends string> extends api.ODButtonResponder<Source,Params> {
|
||||
declare workers: ODWorkerManager_Default<api.ODButtonResponderInstance,Source,Params,WorkerIds>
|
||||
}
|
||||
|
||||
/**## ODDropdownResponderManagerIds_Default `interface`
|
||||
@@ -172,25 +171,25 @@ export interface ODDropdownResponderManagerIds_Default {
|
||||
*
|
||||
* This default class is made for the global variable `opendiscord.responders.dropdowns`!
|
||||
*/
|
||||
export class ODDropdownResponderManager_Default extends ODDropdownResponderManager {
|
||||
export class ODDropdownResponderManager_Default extends api.ODDropdownResponderManager {
|
||||
get<DropdownResponderId extends keyof ODDropdownResponderManagerIds_Default>(id:DropdownResponderId): ODDropdownResponder_Default<ODDropdownResponderManagerIds_Default[DropdownResponderId]["source"],ODDropdownResponderManagerIds_Default[DropdownResponderId]["params"],ODDropdownResponderManagerIds_Default[DropdownResponderId]["workers"]>
|
||||
get(id:ODValidId): ODDropdownResponder<"dropdown",any>|null
|
||||
get(id:api.ODValidId): api.ODDropdownResponder<"dropdown",any>|null
|
||||
|
||||
get(id:ODValidId): ODDropdownResponder<"dropdown",any>|null {
|
||||
get(id:api.ODValidId): api.ODDropdownResponder<"dropdown",any>|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<DropdownResponderId extends keyof ODDropdownResponderManagerIds_Default>(id:DropdownResponderId): ODDropdownResponder_Default<ODDropdownResponderManagerIds_Default[DropdownResponderId]["source"],ODDropdownResponderManagerIds_Default[DropdownResponderId]["params"],ODDropdownResponderManagerIds_Default[DropdownResponderId]["workers"]>
|
||||
remove(id:ODValidId): ODDropdownResponder<"dropdown",any>|null
|
||||
remove(id:api.ODValidId): api.ODDropdownResponder<"dropdown",any>|null
|
||||
|
||||
remove(id:ODValidId): ODDropdownResponder<"dropdown",any>|null {
|
||||
remove(id:api.ODValidId): api.ODDropdownResponder<"dropdown",any>|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODDropdownResponderManagerIds_Default): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
}
|
||||
@@ -201,8 +200,8 @@ export class ODDropdownResponderManager_Default extends ODDropdownResponderManag
|
||||
*
|
||||
* This default class is made for the default `ODDropdownResponder`'s!
|
||||
*/
|
||||
export class ODDropdownResponder_Default<Source extends string, Params, WorkerIds extends string> extends ODDropdownResponder<Source,Params> {
|
||||
declare workers: ODWorkerManager_Default<ODDropdownResponderInstance,Source,Params,WorkerIds>
|
||||
export class ODDropdownResponder_Default<Source extends string, Params, WorkerIds extends string> extends api.ODDropdownResponder<Source,Params> {
|
||||
declare workers: ODWorkerManager_Default<api.ODDropdownResponderInstance,Source,Params,WorkerIds>
|
||||
}
|
||||
|
||||
/**## ODModalResponderManagerIds_Default `interface`
|
||||
@@ -226,25 +225,25 @@ export interface ODModalResponderManagerIds_Default {
|
||||
*
|
||||
* This default class is made for the global variable `opendiscord.responders.dropdowns`!
|
||||
*/
|
||||
export class ODModalResponderManager_Default extends ODModalResponderManager {
|
||||
export class ODModalResponderManager_Default extends api.ODModalResponderManager {
|
||||
get<ModalResponderId extends keyof ODModalResponderManagerIds_Default>(id:ModalResponderId): ODModalResponder_Default<ODModalResponderManagerIds_Default[ModalResponderId]["source"],ODModalResponderManagerIds_Default[ModalResponderId]["params"],ODModalResponderManagerIds_Default[ModalResponderId]["workers"]>
|
||||
get(id:ODValidId): ODModalResponder<"modal",any>|null
|
||||
get(id:api.ODValidId): api.ODModalResponder<"modal",any>|null
|
||||
|
||||
get(id:ODValidId): ODModalResponder<"modal",any>|null {
|
||||
get(id:api.ODValidId): api.ODModalResponder<"modal",any>|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<ModalResponderId extends keyof ODModalResponderManagerIds_Default>(id:ModalResponderId): ODModalResponder_Default<ODModalResponderManagerIds_Default[ModalResponderId]["source"],ODModalResponderManagerIds_Default[ModalResponderId]["params"],ODModalResponderManagerIds_Default[ModalResponderId]["workers"]>
|
||||
remove(id:ODValidId): ODModalResponder<"modal",any>|null
|
||||
remove(id:api.ODValidId): api.ODModalResponder<"modal",any>|null
|
||||
|
||||
remove(id:ODValidId): ODModalResponder<"modal",any>|null {
|
||||
remove(id:api.ODValidId): api.ODModalResponder<"modal",any>|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODModalResponderManagerIds_Default): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
}
|
||||
@@ -255,8 +254,8 @@ export class ODModalResponderManager_Default extends ODModalResponderManager {
|
||||
*
|
||||
* This default class is made for the default `ODModalResponder`'s!
|
||||
*/
|
||||
export class ODModalResponder_Default<Source extends string, Params, WorkerIds extends string> extends ODModalResponder<Source,Params> {
|
||||
declare workers: ODWorkerManager_Default<ODModalResponderInstance,Source,Params,WorkerIds>
|
||||
export class ODModalResponder_Default<Source extends string, Params, WorkerIds extends string> extends api.ODModalResponder<Source,Params> {
|
||||
declare workers: ODWorkerManager_Default<api.ODModalResponderInstance,Source,Params,WorkerIds>
|
||||
}
|
||||
|
||||
/**## ODContextMenuResponderManagerIds_Default `interface`
|
||||
@@ -273,25 +272,25 @@ export interface ODContextMenuResponderManagerIds_Default {
|
||||
*
|
||||
* This default class is made for the global variable `opendiscord.responders.contextMenus`!
|
||||
*/
|
||||
export class ODContextMenuResponderManager_Default extends ODContextMenuResponderManager {
|
||||
export class ODContextMenuResponderManager_Default extends api.ODContextMenuResponderManager {
|
||||
get<ModalResponderId extends keyof ODContextMenuResponderManagerIds_Default>(id:ModalResponderId): ODContextMenuResponder_Default<ODContextMenuResponderManagerIds_Default[ModalResponderId]["source"],ODContextMenuResponderManagerIds_Default[ModalResponderId]["params"],ODContextMenuResponderManagerIds_Default[ModalResponderId]["workers"]>
|
||||
get(id:ODValidId): ODContextMenuResponder<"context-menu",any>|null
|
||||
get(id:api.ODValidId): api.ODContextMenuResponder<"context-menu",any>|null
|
||||
|
||||
get(id:ODValidId): ODContextMenuResponder<"context-menu",any>|null {
|
||||
get(id:api.ODValidId): api.ODContextMenuResponder<"context-menu",any>|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<ModalResponderId extends keyof ODContextMenuResponderManagerIds_Default>(id:ModalResponderId): ODContextMenuResponder_Default<ODContextMenuResponderManagerIds_Default[ModalResponderId]["source"],ODContextMenuResponderManagerIds_Default[ModalResponderId]["params"],ODContextMenuResponderManagerIds_Default[ModalResponderId]["workers"]>
|
||||
remove(id:ODValidId): ODContextMenuResponder<"context-menu",any>|null
|
||||
remove(id:api.ODValidId): api.ODContextMenuResponder<"context-menu",any>|null
|
||||
|
||||
remove(id:ODValidId): ODContextMenuResponder<"context-menu",any>|null {
|
||||
remove(id:api.ODValidId): api.ODContextMenuResponder<"context-menu",any>|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODContextMenuResponderManagerIds_Default): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
}
|
||||
@@ -302,8 +301,8 @@ export class ODContextMenuResponderManager_Default extends ODContextMenuResponde
|
||||
*
|
||||
* This default class is made for the default `ODContextMenuResponder`'s!
|
||||
*/
|
||||
export class ODContextMenuResponder_Default<Source extends string, Params, WorkerIds extends string> extends ODContextMenuResponder<Source,Params> {
|
||||
declare workers: ODWorkerManager_Default<ODContextMenuResponderInstance,Source,Params,WorkerIds>
|
||||
export class ODContextMenuResponder_Default<Source extends string, Params, WorkerIds extends string> extends api.ODContextMenuResponder<Source,Params> {
|
||||
declare workers: ODWorkerManager_Default<api.ODContextMenuResponderInstance,Source,Params,WorkerIds>
|
||||
}
|
||||
|
||||
/**## ODAutocompleteResponderManagerIds_Default `interface`
|
||||
@@ -321,25 +320,25 @@ export interface ODAutocompleteResponderManagerIds_Default {
|
||||
*
|
||||
* This default class is made for the global variable `opendiscord.responders.autocomplete`!
|
||||
*/
|
||||
export class ODAutocompleteResponderManager_Default extends ODAutocompleteResponderManager {
|
||||
export class ODAutocompleteResponderManager_Default extends api.ODAutocompleteResponderManager {
|
||||
get<ModalResponderId extends keyof ODAutocompleteResponderManagerIds_Default>(id:ModalResponderId): ODAutocompleteResponder_Default<ODAutocompleteResponderManagerIds_Default[ModalResponderId]["source"],ODAutocompleteResponderManagerIds_Default[ModalResponderId]["params"],ODAutocompleteResponderManagerIds_Default[ModalResponderId]["workers"]>
|
||||
get(id:ODValidId): ODAutocompleteResponder<"autocomplete",any>|null
|
||||
get(id:api.ODValidId): api.ODAutocompleteResponder<"autocomplete",any>|null
|
||||
|
||||
get(id:ODValidId): ODAutocompleteResponder<"autocomplete",any>|null {
|
||||
get(id:api.ODValidId): api.ODAutocompleteResponder<"autocomplete",any>|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<ModalResponderId extends keyof ODAutocompleteResponderManagerIds_Default>(id:ModalResponderId): ODAutocompleteResponder_Default<ODAutocompleteResponderManagerIds_Default[ModalResponderId]["source"],ODAutocompleteResponderManagerIds_Default[ModalResponderId]["params"],ODAutocompleteResponderManagerIds_Default[ModalResponderId]["workers"]>
|
||||
remove(id:ODValidId): ODAutocompleteResponder<"autocomplete",any>|null
|
||||
remove(id:api.ODValidId): api.ODAutocompleteResponder<"autocomplete",any>|null
|
||||
|
||||
remove(id:ODValidId): ODAutocompleteResponder<"autocomplete",any>|null {
|
||||
remove(id:api.ODValidId): api.ODAutocompleteResponder<"autocomplete",any>|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODAutocompleteResponderManagerIds_Default): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
}
|
||||
@@ -350,6 +349,6 @@ export class ODAutocompleteResponderManager_Default extends ODAutocompleteRespon
|
||||
*
|
||||
* This default class is made for the default `ODAutocompleteResponder`'s!
|
||||
*/
|
||||
export class ODAutocompleteResponder_Default<Source extends string, Params, WorkerIds extends string> extends ODAutocompleteResponder<Source,Params> {
|
||||
declare workers: ODWorkerManager_Default<ODAutocompleteResponderInstance,Source,Params,WorkerIds>
|
||||
export class ODAutocompleteResponder_Default<Source extends string, Params, WorkerIds extends string> extends api.ODAutocompleteResponder<Source,Params> {
|
||||
declare workers: ODWorkerManager_Default<api.ODAutocompleteResponderInstance,Source,Params,WorkerIds>
|
||||
}
|
||||
@@ -1,8 +1,7 @@
|
||||
///////////////////////////////////////
|
||||
//DEFAULT SESSION MODULE
|
||||
///////////////////////////////////////
|
||||
import { ODValidId } from "../modules/base"
|
||||
import { ODSession, ODSessionManager } from "../modules/session"
|
||||
import * as api from "@open-discord-bots/framework/api"
|
||||
|
||||
/**## ODSessionManagerIds_Default `interface`
|
||||
* This interface is a list of ids available in the `ODSessionManager_Default` class.
|
||||
@@ -18,25 +17,25 @@ export interface ODSessionManagerIds_Default {
|
||||
*
|
||||
* This default class is made for the global variable `opendiscord.sessions`!
|
||||
*/
|
||||
export class ODSessionManager_Default extends ODSessionManager {
|
||||
export class ODSessionManager_Default extends api.ODSessionManager {
|
||||
get<SessionId extends keyof ODSessionManagerIds_Default>(id:SessionId): ODSessionManagerIds_Default[SessionId]
|
||||
get(id:ODValidId): ODSession|null
|
||||
get(id:api.ODValidId): api.ODSession|null
|
||||
|
||||
get(id:ODValidId): ODSession|null {
|
||||
get(id:api.ODValidId): api.ODSession|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<SessionId extends keyof ODSessionManagerIds_Default>(id:SessionId): ODSessionManagerIds_Default[SessionId]
|
||||
remove(id:ODValidId): ODSession|null
|
||||
remove(id:api.ODValidId): api.ODSession|null
|
||||
|
||||
remove(id:ODValidId): ODSession|null {
|
||||
remove(id:api.ODValidId): api.ODSession|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODSessionManagerIds_Default): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
}
|
||||
@@ -1,21 +1,20 @@
|
||||
///////////////////////////////////////
|
||||
//DEFAULT STARTSCREEN MODULE
|
||||
///////////////////////////////////////
|
||||
import { ODValidId } from "../modules/base"
|
||||
import { ODStartScreenCategoryComponent, ODStartScreenComponent, ODStartScreenFlagsCategoryComponent, ODStartScreenHeaderComponent, ODStartScreenLiveStatusCategoryComponent, ODStartScreenLogoComponent, ODStartScreenManager, ODStartScreenPluginsCategoryComponent, ODStartScreenPropertiesCategoryComponent } from "../modules/startscreen"
|
||||
import * as api from "@open-discord-bots/framework/api"
|
||||
|
||||
/**## ODStartScreenManagerIds_Default `interface`
|
||||
* This interface is a list of ids available in the `ODStartScreenManager_Default` class.
|
||||
* It's used to generate typescript declarations for this class.
|
||||
*/
|
||||
export interface ODStartScreenManagerIds_Default {
|
||||
"opendiscord:logo":ODStartScreenLogoComponent,
|
||||
"opendiscord:header":ODStartScreenHeaderComponent,
|
||||
"opendiscord:flags":ODStartScreenFlagsCategoryComponent,
|
||||
"opendiscord:plugins":ODStartScreenPluginsCategoryComponent,
|
||||
"opendiscord:stats":ODStartScreenPropertiesCategoryComponent,
|
||||
"opendiscord:livestatus":ODStartScreenLiveStatusCategoryComponent,
|
||||
"opendiscord:logs":ODStartScreenCategoryComponent
|
||||
"opendiscord:logo":api.ODStartScreenLogoComponent,
|
||||
"opendiscord:header":api.ODStartScreenHeaderComponent,
|
||||
"opendiscord:flags":api.ODStartScreenFlagsCategoryComponent,
|
||||
"opendiscord:plugins":api.ODStartScreenPluginsCategoryComponent,
|
||||
"opendiscord:stats":api.ODStartScreenPropertiesCategoryComponent,
|
||||
"opendiscord:livestatus":api.ODStartScreenLiveStatusCategoryComponent,
|
||||
"opendiscord:logs":api.ODStartScreenCategoryComponent
|
||||
}
|
||||
|
||||
/**## ODStartScreenManager_Default `default_class`
|
||||
@@ -24,25 +23,25 @@ export interface ODStartScreenManagerIds_Default {
|
||||
*
|
||||
* This default class is made for the global variable `opendiscord.startscreen`!
|
||||
*/
|
||||
export class ODStartScreenManager_Default extends ODStartScreenManager {
|
||||
export class ODStartScreenManager_Default extends api.ODStartScreenManager {
|
||||
get<StartScreenId extends keyof ODStartScreenManagerIds_Default>(id:StartScreenId): ODStartScreenManagerIds_Default[StartScreenId]
|
||||
get(id:ODValidId): ODStartScreenComponent|null
|
||||
get(id:api.ODValidId): api.ODStartScreenComponent|null
|
||||
|
||||
get(id:ODValidId): ODStartScreenComponent|null {
|
||||
get(id:api.ODValidId): api.ODStartScreenComponent|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<StartScreenId extends keyof ODStartScreenManagerIds_Default>(id:StartScreenId): ODStartScreenManagerIds_Default[StartScreenId]
|
||||
remove(id:ODValidId): ODStartScreenComponent|null
|
||||
remove(id:api.ODValidId): api.ODStartScreenComponent|null
|
||||
|
||||
remove(id:ODValidId): ODStartScreenComponent|null {
|
||||
remove(id:api.ODValidId): api.ODStartScreenComponent|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODStartScreenManagerIds_Default): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
}
|
||||
+163
-164
@@ -1,8 +1,7 @@
|
||||
///////////////////////////////////////
|
||||
//DEFAULT SESSION MODULE
|
||||
///////////////////////////////////////
|
||||
import { ODValidId } from "../modules/base"
|
||||
import { ODStatScope, ODStatGlobalScope, ODStatsManager, ODStat, ODBasicStat, ODDynamicStat, ODValidStatValue, ODStatScopeSetMode } from "../modules/stat"
|
||||
import * as api from "@open-discord-bots/framework/api"
|
||||
|
||||
/**## ODStatsManagerIds_Default `interface`
|
||||
* This interface is a list of ids available in the `ODStatsManager_Default` class.
|
||||
@@ -23,25 +22,25 @@ export interface ODStatsManagerIds_Default {
|
||||
*
|
||||
* This default class is made for the global variable `opendiscord.stats`!
|
||||
*/
|
||||
export class ODStatsManager_Default extends ODStatsManager {
|
||||
export class ODStatsManager_Default extends api.ODStatsManager {
|
||||
get<StatsId extends keyof ODStatsManagerIds_Default>(id:StatsId): ODStatsManagerIds_Default[StatsId]
|
||||
get(id:ODValidId): ODStatScope|null
|
||||
get(id:api.ODValidId): api.ODStatScope|null
|
||||
|
||||
get(id:ODValidId): ODStatScope|null {
|
||||
get(id:api.ODValidId): api.ODStatScope|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<StatsId extends keyof ODStatsManagerIds_Default>(id:StatsId): ODStatsManagerIds_Default[StatsId]
|
||||
remove(id:ODValidId): ODStatScope|null
|
||||
remove(id:api.ODValidId): api.ODStatScope|null
|
||||
|
||||
remove(id:ODValidId): ODStatScope|null {
|
||||
remove(id:api.ODValidId): api.ODStatScope|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODStatsManagerIds_Default): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
}
|
||||
@@ -51,20 +50,20 @@ export class ODStatsManager_Default extends ODStatsManager {
|
||||
* It's used to generate typescript declarations for this class.
|
||||
*/
|
||||
export interface ODStatGlobalScopeIds_DefaultGlobal {
|
||||
"opendiscord:tickets-created":ODBasicStat,
|
||||
"opendiscord:tickets-closed":ODBasicStat,
|
||||
"opendiscord:tickets-deleted":ODBasicStat,
|
||||
"opendiscord:tickets-reopened":ODBasicStat,
|
||||
"opendiscord:tickets-autoclosed":ODBasicStat,
|
||||
"opendiscord:tickets-autodeleted":ODBasicStat,
|
||||
"opendiscord:tickets-claimed":ODBasicStat,
|
||||
"opendiscord:tickets-pinned":ODBasicStat,
|
||||
"opendiscord:tickets-moved":ODBasicStat,
|
||||
"opendiscord:tickets-transferred":ODBasicStat,
|
||||
"opendiscord:users-blacklisted":ODBasicStat,
|
||||
"opendiscord:transcripts-created":ODBasicStat,
|
||||
"opendiscord:ticket-volume":ODDynamicStat,
|
||||
"opendiscord:average-tickets":ODDynamicStat,
|
||||
"opendiscord:tickets-created":api.ODBasicStat,
|
||||
"opendiscord:tickets-closed":api.ODBasicStat,
|
||||
"opendiscord:tickets-deleted":api.ODBasicStat,
|
||||
"opendiscord:tickets-reopened":api.ODBasicStat,
|
||||
"opendiscord:tickets-autoclosed":api.ODBasicStat,
|
||||
"opendiscord:tickets-autodeleted":api.ODBasicStat,
|
||||
"opendiscord:tickets-claimed":api.ODBasicStat,
|
||||
"opendiscord:tickets-pinned":api.ODBasicStat,
|
||||
"opendiscord:tickets-moved":api.ODBasicStat,
|
||||
"opendiscord:tickets-transferred":api.ODBasicStat,
|
||||
"opendiscord:users-blacklisted":api.ODBasicStat,
|
||||
"opendiscord:transcripts-created":api.ODBasicStat,
|
||||
"opendiscord:ticket-volume":api.ODDynamicStat,
|
||||
"opendiscord:average-tickets":api.ODDynamicStat,
|
||||
}
|
||||
|
||||
/**## ODStatGlobalScope_DefaultGlobal `default_class`
|
||||
@@ -73,53 +72,53 @@ export interface ODStatGlobalScopeIds_DefaultGlobal {
|
||||
*
|
||||
* This default class is made for the `opendiscord:global` category in `opendiscord.stats`!
|
||||
*/
|
||||
export class ODStatGlobalScope_DefaultGlobal extends ODStatGlobalScope {
|
||||
export class ODStatGlobalScope_DefaultGlobal extends api.ODStatGlobalScope {
|
||||
get<StatsId extends keyof ODStatGlobalScopeIds_DefaultGlobal>(id:StatsId): ODStatGlobalScopeIds_DefaultGlobal[StatsId]
|
||||
get(id:ODValidId): ODStat|null
|
||||
get(id:api.ODValidId): api.ODStat|null
|
||||
|
||||
get(id:ODValidId): ODStat|null {
|
||||
get(id:api.ODValidId): api.ODStat|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<StatsId extends keyof ODStatGlobalScopeIds_DefaultGlobal>(id:StatsId): ODStatGlobalScopeIds_DefaultGlobal[StatsId]
|
||||
remove(id:ODValidId): ODStat|null
|
||||
remove(id:api.ODValidId): api.ODStat|null
|
||||
|
||||
remove(id:ODValidId): ODStat|null {
|
||||
remove(id:api.ODValidId): api.ODStat|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODStatGlobalScopeIds_DefaultGlobal): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
|
||||
getStat<StatsId extends keyof ODStatGlobalScopeIds_DefaultGlobal>(id:StatsId): Promise<ODValidStatValue|null>
|
||||
getStat(id:ODValidId): Promise<ODValidStatValue|null>
|
||||
getStat<StatsId extends keyof ODStatGlobalScopeIds_DefaultGlobal>(id:StatsId): Promise<api.ODValidStatValue|null>
|
||||
getStat(id:api.ODValidId): Promise<api.ODValidStatValue|null>
|
||||
|
||||
getStat(id:ODValidId): Promise<ODValidStatValue|null> {
|
||||
getStat(id:api.ODValidId): Promise<api.ODValidStatValue|null> {
|
||||
return super.getStat(id)
|
||||
}
|
||||
|
||||
getAllStats<StatsId extends keyof ODStatGlobalScopeIds_DefaultGlobal>(id:StatsId): Promise<{id:string,value:ODValidStatValue}[]>
|
||||
getAllStats(id:ODValidId): Promise<{id:string,value:ODValidStatValue}[]>
|
||||
getAllStats<StatsId extends keyof ODStatGlobalScopeIds_DefaultGlobal>(id:StatsId): Promise<{id:string,value:api.ODValidStatValue}[]>
|
||||
getAllStats(id:api.ODValidId): Promise<{id:string,value:api.ODValidStatValue}[]>
|
||||
|
||||
getAllStats(id:ODValidId): Promise<{id:string,value:ODValidStatValue}[]> {
|
||||
getAllStats(id:api.ODValidId): Promise<{id:string,value:api.ODValidStatValue}[]> {
|
||||
return super.getAllStats(id)
|
||||
}
|
||||
|
||||
setStat<StatsId extends keyof ODStatGlobalScopeIds_DefaultGlobal>(id:StatsId, value:ODValidStatValue, mode:ODStatScopeSetMode): Promise<boolean>
|
||||
setStat(id:ODValidId, value:ODValidStatValue, mode:ODStatScopeSetMode): Promise<boolean>
|
||||
setStat<StatsId extends keyof ODStatGlobalScopeIds_DefaultGlobal>(id:StatsId, value:api.ODValidStatValue, mode:api.ODStatScopeSetMode): Promise<boolean>
|
||||
setStat(id:api.ODValidId, value:api.ODValidStatValue, mode:api.ODStatScopeSetMode): Promise<boolean>
|
||||
|
||||
setStat(id:ODValidId, value:ODValidStatValue, mode:ODStatScopeSetMode): Promise<boolean> {
|
||||
setStat(id:api.ODValidId, value:api.ODValidStatValue, mode:api.ODStatScopeSetMode): Promise<boolean> {
|
||||
return super.setStat(id,value,mode)
|
||||
}
|
||||
|
||||
resetStat<StatsId extends keyof ODStatGlobalScopeIds_DefaultGlobal>(id:ODValidId): Promise<ODValidStatValue|null>
|
||||
resetStat(id:ODValidId): Promise<ODValidStatValue|null>
|
||||
resetStat<StatsId extends keyof ODStatGlobalScopeIds_DefaultGlobal>(id:api.ODValidId): Promise<api.ODValidStatValue|null>
|
||||
resetStat(id:api.ODValidId): Promise<api.ODValidStatValue|null>
|
||||
|
||||
resetStat(id:ODValidId): Promise<ODValidStatValue|null> {
|
||||
resetStat(id:api.ODValidId): Promise<api.ODValidStatValue|null> {
|
||||
return super.resetStat(id)
|
||||
}
|
||||
}
|
||||
@@ -129,9 +128,9 @@ export class ODStatGlobalScope_DefaultGlobal extends ODStatGlobalScope {
|
||||
* It's used to generate typescript declarations for this class.
|
||||
*/
|
||||
export interface ODStatGlobalScopeIds_DefaultSystem {
|
||||
"opendiscord:startup-date":ODDynamicStat,
|
||||
"opendiscord:system-uptime":ODDynamicStat,
|
||||
"opendiscord:version":ODDynamicStat
|
||||
"opendiscord:startup-date":api.ODDynamicStat,
|
||||
"opendiscord:system-uptime":api.ODDynamicStat,
|
||||
"opendiscord:version":api.ODDynamicStat
|
||||
}
|
||||
|
||||
/**## ODStatGlobalScope_DefaultSystem `default_class`
|
||||
@@ -140,53 +139,53 @@ export interface ODStatGlobalScopeIds_DefaultSystem {
|
||||
*
|
||||
* This default class is made for the `opendiscord:system` category in `opendiscord.stats`!
|
||||
*/
|
||||
export class ODStatGlobalScope_DefaultSystem extends ODStatGlobalScope {
|
||||
export class ODStatGlobalScope_DefaultSystem extends api.ODStatGlobalScope {
|
||||
get<StatsId extends keyof ODStatGlobalScopeIds_DefaultSystem>(id:StatsId): ODStatGlobalScopeIds_DefaultSystem[StatsId]
|
||||
get(id:ODValidId): ODStat|null
|
||||
get(id:api.ODValidId): api.ODStat|null
|
||||
|
||||
get(id:ODValidId): ODStat|null {
|
||||
get(id:api.ODValidId): api.ODStat|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<StatsId extends keyof ODStatGlobalScopeIds_DefaultSystem>(id:StatsId): ODStatGlobalScopeIds_DefaultSystem[StatsId]
|
||||
remove(id:ODValidId): ODStat|null
|
||||
remove(id:api.ODValidId): api.ODStat|null
|
||||
|
||||
remove(id:ODValidId): ODStat|null {
|
||||
remove(id:api.ODValidId): api.ODStat|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODStatGlobalScopeIds_DefaultSystem): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
|
||||
getStat<StatsId extends keyof ODStatGlobalScopeIds_DefaultSystem>(id:StatsId): Promise<ODValidStatValue|null>
|
||||
getStat(id:ODValidId): Promise<ODValidStatValue|null>
|
||||
getStat<StatsId extends keyof ODStatGlobalScopeIds_DefaultSystem>(id:StatsId): Promise<api.ODValidStatValue|null>
|
||||
getStat(id:api.ODValidId): Promise<api.ODValidStatValue|null>
|
||||
|
||||
getStat(id:ODValidId): Promise<ODValidStatValue|null> {
|
||||
getStat(id:api.ODValidId): Promise<api.ODValidStatValue|null> {
|
||||
return super.getStat(id)
|
||||
}
|
||||
|
||||
getAllStats<StatsId extends keyof ODStatGlobalScopeIds_DefaultSystem>(id:StatsId): Promise<{id:string,value:ODValidStatValue}[]>
|
||||
getAllStats(id:ODValidId): Promise<{id:string,value:ODValidStatValue}[]>
|
||||
getAllStats<StatsId extends keyof ODStatGlobalScopeIds_DefaultSystem>(id:StatsId): Promise<{id:string,value:api.ODValidStatValue}[]>
|
||||
getAllStats(id:api.ODValidId): Promise<{id:string,value:api.ODValidStatValue}[]>
|
||||
|
||||
getAllStats(id:ODValidId): Promise<{id:string,value:ODValidStatValue}[]> {
|
||||
getAllStats(id:api.ODValidId): Promise<{id:string,value:api.ODValidStatValue}[]> {
|
||||
return super.getAllStats(id)
|
||||
}
|
||||
|
||||
setStat<StatsId extends keyof ODStatGlobalScopeIds_DefaultSystem>(id:StatsId, value:ODValidStatValue, mode:ODStatScopeSetMode): Promise<boolean>
|
||||
setStat(id:ODValidId, value:ODValidStatValue, mode:ODStatScopeSetMode): Promise<boolean>
|
||||
setStat<StatsId extends keyof ODStatGlobalScopeIds_DefaultSystem>(id:StatsId, value:api.ODValidStatValue, mode:api.ODStatScopeSetMode): Promise<boolean>
|
||||
setStat(id:api.ODValidId, value:api.ODValidStatValue, mode:api.ODStatScopeSetMode): Promise<boolean>
|
||||
|
||||
setStat(id:ODValidId, value:ODValidStatValue, mode:ODStatScopeSetMode): Promise<boolean> {
|
||||
setStat(id:api.ODValidId, value:api.ODValidStatValue, mode:api.ODStatScopeSetMode): Promise<boolean> {
|
||||
return super.setStat(id,value,mode)
|
||||
}
|
||||
|
||||
resetStat<StatsId extends keyof ODStatGlobalScopeIds_DefaultSystem>(id:ODValidId): Promise<ODValidStatValue|null>
|
||||
resetStat(id:ODValidId): Promise<ODValidStatValue|null>
|
||||
resetStat<StatsId extends keyof ODStatGlobalScopeIds_DefaultSystem>(id:api.ODValidId): Promise<api.ODValidStatValue|null>
|
||||
resetStat(id:api.ODValidId): Promise<api.ODValidStatValue|null>
|
||||
|
||||
resetStat(id:ODValidId): Promise<ODValidStatValue|null> {
|
||||
resetStat(id:api.ODValidId): Promise<api.ODValidStatValue|null> {
|
||||
return super.resetStat(id)
|
||||
}
|
||||
}
|
||||
@@ -196,19 +195,19 @@ export class ODStatGlobalScope_DefaultSystem extends ODStatGlobalScope {
|
||||
* It's used to generate typescript declarations for this class.
|
||||
*/
|
||||
export interface ODStatScopeIds_DefaultUser {
|
||||
"opendiscord:name":ODDynamicStat,
|
||||
"opendiscord:role":ODDynamicStat,
|
||||
"opendiscord:tickets-created":ODBasicStat,
|
||||
"opendiscord:tickets-closed":ODBasicStat,
|
||||
"opendiscord:tickets-deleted":ODBasicStat,
|
||||
"opendiscord:tickets-reopened":ODBasicStat,
|
||||
"opendiscord:tickets-claimed":ODBasicStat,
|
||||
"opendiscord:tickets-pinned":ODBasicStat,
|
||||
"opendiscord:tickets-moved":ODBasicStat,
|
||||
"opendiscord:tickets-transferred":ODBasicStat,
|
||||
"opendiscord:users-blacklisted":ODBasicStat,
|
||||
"opendiscord:transcripts-created":ODBasicStat,
|
||||
"opendiscord:current-tickets":ODDynamicStat,
|
||||
"opendiscord:name":api.ODDynamicStat,
|
||||
"opendiscord:role":api.ODDynamicStat,
|
||||
"opendiscord:tickets-created":api.ODBasicStat,
|
||||
"opendiscord:tickets-closed":api.ODBasicStat,
|
||||
"opendiscord:tickets-deleted":api.ODBasicStat,
|
||||
"opendiscord:tickets-reopened":api.ODBasicStat,
|
||||
"opendiscord:tickets-claimed":api.ODBasicStat,
|
||||
"opendiscord:tickets-pinned":api.ODBasicStat,
|
||||
"opendiscord:tickets-moved":api.ODBasicStat,
|
||||
"opendiscord:tickets-transferred":api.ODBasicStat,
|
||||
"opendiscord:users-blacklisted":api.ODBasicStat,
|
||||
"opendiscord:transcripts-created":api.ODBasicStat,
|
||||
"opendiscord:current-tickets":api.ODDynamicStat,
|
||||
}
|
||||
|
||||
/**## ODStatScope_DefaultUser `default_class`
|
||||
@@ -217,53 +216,53 @@ export interface ODStatScopeIds_DefaultUser {
|
||||
*
|
||||
* This default class is made for the `opendiscord:user` category in `opendiscord.stats`!
|
||||
*/
|
||||
export class ODStatScope_DefaultUser extends ODStatScope {
|
||||
export class ODStatScope_DefaultUser extends api.ODStatScope {
|
||||
get<StatsId extends keyof ODStatScopeIds_DefaultUser>(id:StatsId): ODStatScopeIds_DefaultUser[StatsId]
|
||||
get(id:ODValidId): ODStat|null
|
||||
get(id:api.ODValidId): api.ODStat|null
|
||||
|
||||
get(id:ODValidId): ODStat|null {
|
||||
get(id:api.ODValidId): api.ODStat|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<StatsId extends keyof ODStatScopeIds_DefaultUser>(id:StatsId): ODStatScopeIds_DefaultUser[StatsId]
|
||||
remove(id:ODValidId): ODStat|null
|
||||
remove(id:api.ODValidId): api.ODStat|null
|
||||
|
||||
remove(id:ODValidId): ODStat|null {
|
||||
remove(id:api.ODValidId): api.ODStat|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODStatScopeIds_DefaultUser): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
|
||||
getStat<StatsId extends keyof ODStatScopeIds_DefaultUser>(id:StatsId, scopeId:string): Promise<ODValidStatValue|null>
|
||||
getStat(id:ODValidId, scopeId:string): Promise<ODValidStatValue|null>
|
||||
getStat<StatsId extends keyof ODStatScopeIds_DefaultUser>(id:StatsId, scopeId:string): Promise<api.ODValidStatValue|null>
|
||||
getStat(id:api.ODValidId, scopeId:string): Promise<api.ODValidStatValue|null>
|
||||
|
||||
getStat(id:ODValidId, scopeId:string): Promise<ODValidStatValue|null> {
|
||||
getStat(id:api.ODValidId, scopeId:string): Promise<api.ODValidStatValue|null> {
|
||||
return super.getStat(id,scopeId)
|
||||
}
|
||||
|
||||
getAllStats<StatsId extends keyof ODStatScopeIds_DefaultUser>(id:StatsId): Promise<{id:string,value:ODValidStatValue}[]>
|
||||
getAllStats(id:ODValidId): Promise<{id:string,value:ODValidStatValue}[]>
|
||||
getAllStats<StatsId extends keyof ODStatScopeIds_DefaultUser>(id:StatsId): Promise<{id:string,value:api.ODValidStatValue}[]>
|
||||
getAllStats(id:api.ODValidId): Promise<{id:string,value:api.ODValidStatValue}[]>
|
||||
|
||||
getAllStats(id:ODValidId): Promise<{id:string,value:ODValidStatValue}[]> {
|
||||
getAllStats(id:api.ODValidId): Promise<{id:string,value:api.ODValidStatValue}[]> {
|
||||
return super.getAllStats(id)
|
||||
}
|
||||
|
||||
setStat<StatsId extends keyof ODStatScopeIds_DefaultUser>(id:StatsId, scopeId:string, value:ODValidStatValue, mode:ODStatScopeSetMode): Promise<boolean>
|
||||
setStat(id:ODValidId, scopeId:string, value:ODValidStatValue, mode:ODStatScopeSetMode): Promise<boolean>
|
||||
setStat<StatsId extends keyof ODStatScopeIds_DefaultUser>(id:StatsId, scopeId:string, value:api.ODValidStatValue, mode:api.ODStatScopeSetMode): Promise<boolean>
|
||||
setStat(id:api.ODValidId, scopeId:string, value:api.ODValidStatValue, mode:api.ODStatScopeSetMode): Promise<boolean>
|
||||
|
||||
setStat(id:ODValidId, scopeId:string, value:ODValidStatValue, mode:ODStatScopeSetMode): Promise<boolean> {
|
||||
setStat(id:api.ODValidId, scopeId:string, value:api.ODValidStatValue, mode:api.ODStatScopeSetMode): Promise<boolean> {
|
||||
return super.setStat(id,scopeId,value,mode)
|
||||
}
|
||||
|
||||
resetStat<StatsId extends keyof ODStatScopeIds_DefaultUser>(id:ODValidId, scopeId:string): Promise<ODValidStatValue|null>
|
||||
resetStat(id:ODValidId, scopeId:string): Promise<ODValidStatValue|null>
|
||||
resetStat<StatsId extends keyof ODStatScopeIds_DefaultUser>(id:api.ODValidId, scopeId:string): Promise<api.ODValidStatValue|null>
|
||||
resetStat(id:api.ODValidId, scopeId:string): Promise<api.ODValidStatValue|null>
|
||||
|
||||
resetStat(id:ODValidId, scopeId:string): Promise<ODValidStatValue|null> {
|
||||
resetStat(id:api.ODValidId, scopeId:string): Promise<api.ODValidStatValue|null> {
|
||||
return super.resetStat(id,scopeId)
|
||||
}
|
||||
}
|
||||
@@ -273,15 +272,15 @@ export class ODStatScope_DefaultUser extends ODStatScope {
|
||||
* It's used to generate typescript declarations for this class.
|
||||
*/
|
||||
export interface ODStatScopeIds_DefaultTicket {
|
||||
"opendiscord:name":ODDynamicStat,
|
||||
"opendiscord:status":ODDynamicStat,
|
||||
"opendiscord:claimed":ODDynamicStat,
|
||||
"opendiscord:pinned":ODDynamicStat,
|
||||
"opendiscord:creation-date":ODDynamicStat,
|
||||
"opendiscord:creator":ODDynamicStat,
|
||||
"opendiscord:ticket-age":ODDynamicStat,
|
||||
"opendiscord:response-time":ODDynamicStat,
|
||||
"opendiscord:resolution-time":ODDynamicStat,
|
||||
"opendiscord:name":api.ODDynamicStat,
|
||||
"opendiscord:status":api.ODDynamicStat,
|
||||
"opendiscord:claimed":api.ODDynamicStat,
|
||||
"opendiscord:pinned":api.ODDynamicStat,
|
||||
"opendiscord:creation-date":api.ODDynamicStat,
|
||||
"opendiscord:creator":api.ODDynamicStat,
|
||||
"opendiscord:ticket-age":api.ODDynamicStat,
|
||||
"opendiscord:response-time":api.ODDynamicStat,
|
||||
"opendiscord:resolution-time":api.ODDynamicStat,
|
||||
}
|
||||
|
||||
/**## ODStatScope_DefaultTicket `default_class`
|
||||
@@ -290,53 +289,53 @@ export interface ODStatScopeIds_DefaultTicket {
|
||||
*
|
||||
* This default class is made for the `opendiscord:ticket` category in `opendiscord.stats`!
|
||||
*/
|
||||
export class ODStatScope_DefaultTicket extends ODStatScope {
|
||||
export class ODStatScope_DefaultTicket extends api.ODStatScope {
|
||||
get<StatsId extends keyof ODStatScopeIds_DefaultTicket>(id:StatsId): ODStatScopeIds_DefaultTicket[StatsId]
|
||||
get(id:ODValidId): ODStat|null
|
||||
get(id:api.ODValidId): api.ODStat|null
|
||||
|
||||
get(id:ODValidId): ODStat|null {
|
||||
get(id:api.ODValidId): api.ODStat|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<StatsId extends keyof ODStatScopeIds_DefaultTicket>(id:StatsId): ODStatScopeIds_DefaultTicket[StatsId]
|
||||
remove(id:ODValidId): ODStat|null
|
||||
remove(id:api.ODValidId): api.ODStat|null
|
||||
|
||||
remove(id:ODValidId): ODStat|null {
|
||||
remove(id:api.ODValidId): api.ODStat|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODStatScopeIds_DefaultTicket): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
|
||||
getStat<StatsId extends keyof ODStatScopeIds_DefaultTicket>(id:StatsId, scopeId:string): Promise<ODValidStatValue|null>
|
||||
getStat(id:ODValidId, scopeId:string): Promise<ODValidStatValue|null>
|
||||
getStat<StatsId extends keyof ODStatScopeIds_DefaultTicket>(id:StatsId, scopeId:string): Promise<api.ODValidStatValue|null>
|
||||
getStat(id:api.ODValidId, scopeId:string): Promise<api.ODValidStatValue|null>
|
||||
|
||||
getStat(id:ODValidId, scopeId:string): Promise<ODValidStatValue|null> {
|
||||
getStat(id:api.ODValidId, scopeId:string): Promise<api.ODValidStatValue|null> {
|
||||
return super.getStat(id,scopeId)
|
||||
}
|
||||
|
||||
getAllStats<StatsId extends keyof ODStatScopeIds_DefaultTicket>(id:StatsId): Promise<{id:string,value:ODValidStatValue}[]>
|
||||
getAllStats(id:ODValidId): Promise<{id:string,value:ODValidStatValue}[]>
|
||||
getAllStats<StatsId extends keyof ODStatScopeIds_DefaultTicket>(id:StatsId): Promise<{id:string,value:api.ODValidStatValue}[]>
|
||||
getAllStats(id:api.ODValidId): Promise<{id:string,value:api.ODValidStatValue}[]>
|
||||
|
||||
getAllStats(id:ODValidId): Promise<{id:string,value:ODValidStatValue}[]> {
|
||||
getAllStats(id:api.ODValidId): Promise<{id:string,value:api.ODValidStatValue}[]> {
|
||||
return super.getAllStats(id)
|
||||
}
|
||||
|
||||
setStat<StatsId extends keyof ODStatScopeIds_DefaultTicket>(id:StatsId, scopeId:string, value:ODValidStatValue, mode:ODStatScopeSetMode): Promise<boolean>
|
||||
setStat(id:ODValidId, scopeId:string, value:ODValidStatValue, mode:ODStatScopeSetMode): Promise<boolean>
|
||||
setStat<StatsId extends keyof ODStatScopeIds_DefaultTicket>(id:StatsId, scopeId:string, value:api.ODValidStatValue, mode:api.ODStatScopeSetMode): Promise<boolean>
|
||||
setStat(id:api.ODValidId, scopeId:string, value:api.ODValidStatValue, mode:api.ODStatScopeSetMode): Promise<boolean>
|
||||
|
||||
setStat(id:ODValidId, scopeId:string, value:ODValidStatValue, mode:ODStatScopeSetMode): Promise<boolean> {
|
||||
setStat(id:api.ODValidId, scopeId:string, value:api.ODValidStatValue, mode:api.ODStatScopeSetMode): Promise<boolean> {
|
||||
return super.setStat(id,scopeId,value,mode)
|
||||
}
|
||||
|
||||
resetStat<StatsId extends keyof ODStatScopeIds_DefaultTicket>(id:ODValidId, scopeId:string): Promise<ODValidStatValue|null>
|
||||
resetStat(id:ODValidId, scopeId:string): Promise<ODValidStatValue|null>
|
||||
resetStat<StatsId extends keyof ODStatScopeIds_DefaultTicket>(id:api.ODValidId, scopeId:string): Promise<api.ODValidStatValue|null>
|
||||
resetStat(id:api.ODValidId, scopeId:string): Promise<api.ODValidStatValue|null>
|
||||
|
||||
resetStat(id:ODValidId, scopeId:string): Promise<ODValidStatValue|null> {
|
||||
resetStat(id:api.ODValidId, scopeId:string): Promise<api.ODValidStatValue|null> {
|
||||
return super.resetStat(id,scopeId)
|
||||
}
|
||||
}
|
||||
@@ -346,7 +345,7 @@ export class ODStatScope_DefaultTicket extends ODStatScope {
|
||||
* It's used to generate typescript declarations for this class.
|
||||
*/
|
||||
export interface ODStatScopeIds_DefaultParticipants {
|
||||
"opendiscord:participants":ODDynamicStat
|
||||
"opendiscord:participants":api.ODDynamicStat
|
||||
}
|
||||
|
||||
/**## ODStatScope_DefaultParticipants `default_class`
|
||||
@@ -355,53 +354,53 @@ export interface ODStatScopeIds_DefaultParticipants {
|
||||
*
|
||||
* This default class is made for the `opendiscord:participants` category in `opendiscord.stats`!
|
||||
*/
|
||||
export class ODStatScope_DefaultParticipants extends ODStatScope {
|
||||
export class ODStatScope_DefaultParticipants extends api.ODStatScope {
|
||||
get<StatsId extends keyof ODStatScopeIds_DefaultParticipants>(id:StatsId): ODStatScopeIds_DefaultParticipants[StatsId]
|
||||
get(id:ODValidId): ODStat|null
|
||||
get(id:api.ODValidId): api.ODStat|null
|
||||
|
||||
get(id:ODValidId): ODStat|null {
|
||||
get(id:api.ODValidId): api.ODStat|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<StatsId extends keyof ODStatScopeIds_DefaultParticipants>(id:StatsId): ODStatScopeIds_DefaultParticipants[StatsId]
|
||||
remove(id:ODValidId): ODStat|null
|
||||
remove(id:api.ODValidId): api.ODStat|null
|
||||
|
||||
remove(id:ODValidId): ODStat|null {
|
||||
remove(id:api.ODValidId): api.ODStat|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODStatScopeIds_DefaultParticipants): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
|
||||
getStat<StatsId extends keyof ODStatScopeIds_DefaultParticipants>(id:StatsId, scopeId:string): Promise<ODValidStatValue|null>
|
||||
getStat(id:ODValidId, scopeId:string): Promise<ODValidStatValue|null>
|
||||
getStat<StatsId extends keyof ODStatScopeIds_DefaultParticipants>(id:StatsId, scopeId:string): Promise<api.ODValidStatValue|null>
|
||||
getStat(id:api.ODValidId, scopeId:string): Promise<api.ODValidStatValue|null>
|
||||
|
||||
getStat(id:ODValidId, scopeId:string): Promise<ODValidStatValue|null> {
|
||||
getStat(id:api.ODValidId, scopeId:string): Promise<api.ODValidStatValue|null> {
|
||||
return super.getStat(id,scopeId)
|
||||
}
|
||||
|
||||
getAllStats<StatsId extends keyof ODStatScopeIds_DefaultParticipants>(id:StatsId): Promise<{id:string,value:ODValidStatValue}[]>
|
||||
getAllStats(id:ODValidId): Promise<{id:string,value:ODValidStatValue}[]>
|
||||
getAllStats<StatsId extends keyof ODStatScopeIds_DefaultParticipants>(id:StatsId): Promise<{id:string,value:api.ODValidStatValue}[]>
|
||||
getAllStats(id:api.ODValidId): Promise<{id:string,value:api.ODValidStatValue}[]>
|
||||
|
||||
getAllStats(id:ODValidId): Promise<{id:string,value:ODValidStatValue}[]> {
|
||||
getAllStats(id:api.ODValidId): Promise<{id:string,value:api.ODValidStatValue}[]> {
|
||||
return super.getAllStats(id)
|
||||
}
|
||||
|
||||
setStat<StatsId extends keyof ODStatScopeIds_DefaultParticipants>(id:StatsId, scopeId:string, value:ODValidStatValue, mode:ODStatScopeSetMode): Promise<boolean>
|
||||
setStat(id:ODValidId, scopeId:string, value:ODValidStatValue, mode:ODStatScopeSetMode): Promise<boolean>
|
||||
setStat<StatsId extends keyof ODStatScopeIds_DefaultParticipants>(id:StatsId, scopeId:string, value:api.ODValidStatValue, mode:api.ODStatScopeSetMode): Promise<boolean>
|
||||
setStat(id:api.ODValidId, scopeId:string, value:api.ODValidStatValue, mode:api.ODStatScopeSetMode): Promise<boolean>
|
||||
|
||||
setStat(id:ODValidId, scopeId:string, value:ODValidStatValue, mode:ODStatScopeSetMode): Promise<boolean> {
|
||||
setStat(id:api.ODValidId, scopeId:string, value:api.ODValidStatValue, mode:api.ODStatScopeSetMode): Promise<boolean> {
|
||||
return super.setStat(id,scopeId,value,mode)
|
||||
}
|
||||
|
||||
resetStat<StatsId extends keyof ODStatScopeIds_DefaultParticipants>(id:ODValidId, scopeId:string): Promise<ODValidStatValue|null>
|
||||
resetStat(id:ODValidId, scopeId:string): Promise<ODValidStatValue|null>
|
||||
resetStat<StatsId extends keyof ODStatScopeIds_DefaultParticipants>(id:api.ODValidId, scopeId:string): Promise<api.ODValidStatValue|null>
|
||||
resetStat(id:api.ODValidId, scopeId:string): Promise<api.ODValidStatValue|null>
|
||||
|
||||
resetStat(id:ODValidId, scopeId:string): Promise<ODValidStatValue|null> {
|
||||
resetStat(id:api.ODValidId, scopeId:string): Promise<api.ODValidStatValue|null> {
|
||||
return super.resetStat(id,scopeId)
|
||||
}
|
||||
}
|
||||
@@ -411,7 +410,7 @@ export class ODStatScope_DefaultParticipants extends ODStatScope {
|
||||
* It's used to generate typescript declarations for this class.
|
||||
*/
|
||||
export interface ODStatScopeIds_DefaultMessages {
|
||||
"opendiscord:count":ODDynamicStat
|
||||
"opendiscord:count":api.ODDynamicStat
|
||||
}
|
||||
|
||||
/**## ODStatScope_DefaultMessages `default_class`
|
||||
@@ -420,53 +419,53 @@ export interface ODStatScopeIds_DefaultMessages {
|
||||
*
|
||||
* This default class is made for the `opendiscord:participants` category in `opendiscord.stats`!
|
||||
*/
|
||||
export class ODStatScope_DefaultMessages extends ODStatScope {
|
||||
export class ODStatScope_DefaultMessages extends api.ODStatScope {
|
||||
get<StatsId extends keyof ODStatScopeIds_DefaultMessages>(id:StatsId): ODStatScopeIds_DefaultMessages[StatsId]
|
||||
get(id:ODValidId): ODStat|null
|
||||
get(id:api.ODValidId): api.ODStat|null
|
||||
|
||||
get(id:ODValidId): ODStat|null {
|
||||
get(id:api.ODValidId): api.ODStat|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<StatsId extends keyof ODStatScopeIds_DefaultMessages>(id:StatsId): ODStatScopeIds_DefaultMessages[StatsId]
|
||||
remove(id:ODValidId): ODStat|null
|
||||
remove(id:api.ODValidId): api.ODStat|null
|
||||
|
||||
remove(id:ODValidId): ODStat|null {
|
||||
remove(id:api.ODValidId): api.ODStat|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODStatScopeIds_DefaultMessages): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
|
||||
getStat<StatsId extends keyof ODStatScopeIds_DefaultMessages>(id:StatsId, scopeId:string): Promise<ODValidStatValue|null>
|
||||
getStat(id:ODValidId, scopeId:string): Promise<ODValidStatValue|null>
|
||||
getStat<StatsId extends keyof ODStatScopeIds_DefaultMessages>(id:StatsId, scopeId:string): Promise<api.ODValidStatValue|null>
|
||||
getStat(id:api.ODValidId, scopeId:string): Promise<api.ODValidStatValue|null>
|
||||
|
||||
getStat(id:ODValidId, scopeId:string): Promise<ODValidStatValue|null> {
|
||||
getStat(id:api.ODValidId, scopeId:string): Promise<api.ODValidStatValue|null> {
|
||||
return super.getStat(id,scopeId)
|
||||
}
|
||||
|
||||
getAllStats<StatsId extends keyof ODStatScopeIds_DefaultMessages>(id:StatsId): Promise<{id:string,value:ODValidStatValue}[]>
|
||||
getAllStats(id:ODValidId): Promise<{id:string,value:ODValidStatValue}[]>
|
||||
getAllStats<StatsId extends keyof ODStatScopeIds_DefaultMessages>(id:StatsId): Promise<{id:string,value:api.ODValidStatValue}[]>
|
||||
getAllStats(id:api.ODValidId): Promise<{id:string,value:api.ODValidStatValue}[]>
|
||||
|
||||
getAllStats(id:ODValidId): Promise<{id:string,value:ODValidStatValue}[]> {
|
||||
getAllStats(id:api.ODValidId): Promise<{id:string,value:api.ODValidStatValue}[]> {
|
||||
return super.getAllStats(id)
|
||||
}
|
||||
|
||||
setStat<StatsId extends keyof ODStatScopeIds_DefaultMessages>(id:StatsId, scopeId:string, value:ODValidStatValue, mode:ODStatScopeSetMode): Promise<boolean>
|
||||
setStat(id:ODValidId, scopeId:string, value:ODValidStatValue, mode:ODStatScopeSetMode): Promise<boolean>
|
||||
setStat<StatsId extends keyof ODStatScopeIds_DefaultMessages>(id:StatsId, scopeId:string, value:api.ODValidStatValue, mode:api.ODStatScopeSetMode): Promise<boolean>
|
||||
setStat(id:api.ODValidId, scopeId:string, value:api.ODValidStatValue, mode:api.ODStatScopeSetMode): Promise<boolean>
|
||||
|
||||
setStat(id:ODValidId, scopeId:string, value:ODValidStatValue, mode:ODStatScopeSetMode): Promise<boolean> {
|
||||
setStat(id:api.ODValidId, scopeId:string, value:api.ODValidStatValue, mode:api.ODStatScopeSetMode): Promise<boolean> {
|
||||
return super.setStat(id,scopeId,value,mode)
|
||||
}
|
||||
|
||||
resetStat<StatsId extends keyof ODStatScopeIds_DefaultMessages>(id:ODValidId, scopeId:string): Promise<ODValidStatValue|null>
|
||||
resetStat(id:ODValidId, scopeId:string): Promise<ODValidStatValue|null>
|
||||
resetStat<StatsId extends keyof ODStatScopeIds_DefaultMessages>(id:api.ODValidId, scopeId:string): Promise<api.ODValidStatValue|null>
|
||||
resetStat(id:api.ODValidId, scopeId:string): Promise<api.ODValidStatValue|null>
|
||||
|
||||
resetStat(id:ODValidId, scopeId:string): Promise<ODValidStatValue|null> {
|
||||
resetStat(id:api.ODValidId, scopeId:string): Promise<api.ODValidStatValue|null> {
|
||||
return super.resetStat(id,scopeId)
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,8 @@
|
||||
///////////////////////////////////////
|
||||
//DEFAULT VERIFYBAR MODULE
|
||||
///////////////////////////////////////
|
||||
import { ODValidId } from "../modules/base"
|
||||
import { ODButtonResponderInstance } from "../modules/responder"
|
||||
import * as api from "@open-discord-bots/framework/api"
|
||||
import { ODWorkerManager_Default } from "../defaults/worker"
|
||||
import { ODVerifyBarManager, ODVerifyBar } from "../modules/verifybar"
|
||||
import * as discord from "discord.js"
|
||||
|
||||
/**## ODVerifyBarManagerIds_Default `interface`
|
||||
@@ -37,25 +35,25 @@ export interface ODVerifyBarManagerIds_Default {
|
||||
*
|
||||
* This default class is made for the global variable `opendiscord.verifybars`!
|
||||
*/
|
||||
export class ODVerifyBarManager_Default extends ODVerifyBarManager {
|
||||
export class ODVerifyBarManager_Default extends api.ODVerifyBarManager {
|
||||
get<VerifyBarId extends keyof ODVerifyBarManagerIds_Default>(id:VerifyBarId): ODVerifyBar_Default<ODVerifyBarManagerIds_Default[VerifyBarId]["successWorkerIds"],ODVerifyBarManagerIds_Default[VerifyBarId]["failureWorkerIds"]>
|
||||
get(id:ODValidId): ODVerifyBar|null
|
||||
get(id:api.ODValidId): api.ODVerifyBar|null
|
||||
|
||||
get(id:ODValidId): ODVerifyBar|null {
|
||||
get(id:api.ODValidId): api.ODVerifyBar|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<VerifyBarId extends keyof ODVerifyBarManagerIds_Default>(id:VerifyBarId): ODVerifyBar_Default<ODVerifyBarManagerIds_Default[VerifyBarId]["successWorkerIds"],ODVerifyBarManagerIds_Default[VerifyBarId]["failureWorkerIds"]>
|
||||
remove(id:ODValidId): ODVerifyBar|null
|
||||
remove(id:api.ODValidId): api.ODVerifyBar|null
|
||||
|
||||
remove(id:ODValidId): ODVerifyBar|null {
|
||||
remove(id:api.ODValidId): api.ODVerifyBar|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODVerifyBarManagerIds_Default): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
}
|
||||
@@ -66,7 +64,7 @@ export class ODVerifyBarManager_Default extends ODVerifyBarManager {
|
||||
*
|
||||
* This default class is made for the default `ODVerifyBar`'s!
|
||||
*/
|
||||
export class ODVerifyBar_Default<SuccessWorkerIds extends string,FailureWorkerIds extends string> extends ODVerifyBar {
|
||||
declare success: ODWorkerManager_Default<ODButtonResponderInstance,"verifybar",{data:string|null,verifybarMessage:discord.Message<boolean>|null},SuccessWorkerIds>
|
||||
declare failure: ODWorkerManager_Default<ODButtonResponderInstance,"verifybar",{data:string|null,verifybarMessage:discord.Message<boolean>|null},FailureWorkerIds>
|
||||
export class ODVerifyBar_Default<SuccessWorkerIds extends string,FailureWorkerIds extends string> extends api.ODVerifyBar {
|
||||
declare success: ODWorkerManager_Default<api.ODButtonResponderInstance,"verifybar",{data:string|null,verifybarMessage:discord.Message<boolean>|null},SuccessWorkerIds>
|
||||
declare failure: ODWorkerManager_Default<api.ODButtonResponderInstance,"verifybar",{data:string|null,verifybarMessage:discord.Message<boolean>|null},FailureWorkerIds>
|
||||
}
|
||||
@@ -1,9 +1,7 @@
|
||||
///////////////////////////////////////
|
||||
//DEFAULT WORKER MODULE
|
||||
///////////////////////////////////////
|
||||
import { ODValidId } from "../modules/base"
|
||||
import { ODWorker, ODWorkerManager } from "../modules/worker"
|
||||
|
||||
import * as api from "@open-discord-bots/framework/api"
|
||||
|
||||
/**## ODWorkerManager_Default `default_class`
|
||||
* This is a special class that adds type definitions & typescript to the ODWorkerManager class.
|
||||
@@ -11,25 +9,25 @@ import { ODWorker, ODWorkerManager } from "../modules/worker"
|
||||
*
|
||||
* This default class is made for the worker manager in actions, builders & responders!
|
||||
*/
|
||||
export class ODWorkerManager_Default<Instance, Source extends string, Params, WorkerIds extends string> extends ODWorkerManager<Instance,Source,Params> {
|
||||
get(id:WorkerIds): ODWorker<Instance,Source,Params>
|
||||
get(id:ODValidId): ODWorker<Instance,Source,Params>|null
|
||||
export class ODWorkerManager_Default<Instance, Source extends string, Params, WorkerIds extends string> extends api.ODWorkerManager<Instance,Source,Params> {
|
||||
get(id:WorkerIds): api.ODWorker<Instance,Source,Params>
|
||||
get(id:api.ODValidId): api.ODWorker<Instance,Source,Params>|null
|
||||
|
||||
get(id:ODValidId): ODWorker<Instance,Source,Params>|null {
|
||||
get(id:api.ODValidId): api.ODWorker<Instance,Source,Params>|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove(id:WorkerIds): ODWorker<Instance,Source,Params>
|
||||
remove(id:ODValidId): ODWorker<Instance,Source,Params>|null
|
||||
remove(id:WorkerIds): api.ODWorker<Instance,Source,Params>
|
||||
remove(id:api.ODValidId): api.ODWorker<Instance,Source,Params>|null
|
||||
|
||||
remove(id:ODValidId): ODWorker<Instance,Source,Params>|null {
|
||||
remove(id:api.ODValidId): api.ODWorker<Instance,Source,Params>|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:WorkerIds): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
}
|
||||
+104
-170
@@ -1,193 +1,127 @@
|
||||
//BASE MODULES
|
||||
import { ODEnvHelper, ODVersion } from "./modules/base"
|
||||
import { ODConsoleManager, ODConsoleMessage, ODConsoleMessageParam, ODConsoleMessageTypes, ODDebugFileManager, ODDebugger, ODError } from "./modules/console"
|
||||
import { ODCheckerStorage } from "./modules/checker"
|
||||
import { ODDefaultsManager } from "./modules/defaults"
|
||||
///////////////////////////////////////
|
||||
//OPEN TICKET MAIN MODULE
|
||||
///////////////////////////////////////
|
||||
import * as api from "./api"
|
||||
import * as utilities from "@open-discord-bots/framework/utilities"
|
||||
|
||||
//DEFAULT MODULES
|
||||
import { ODVersionManager_Default } from "./defaults/base"
|
||||
import { ODPluginManager_Default } from "./defaults/plugin"
|
||||
import { ODEventManager_Default } from "./defaults/event"
|
||||
import { ODConfigManager_Default} from "./defaults/config"
|
||||
import { ODDatabaseManager_Default } from "./defaults/database"
|
||||
import { ODFlagManager_Default } from "./defaults/flag"
|
||||
import { ODSessionManager_Default } from "./defaults/session"
|
||||
import { ODLanguageManager_Default } from "./defaults/language"
|
||||
import { ODCheckerFunctionManager_Default, ODCheckerManager_Default, ODCheckerRenderer_Default, ODCheckerTranslationRegister_Default } from "./defaults/checker"
|
||||
import { ODClientManager_Default } from "./defaults/client"
|
||||
import { ODBuilderManager_Default } from "./defaults/builder"
|
||||
import { ODResponderManager_Default } from "./defaults/responder"
|
||||
import { ODActionManager_Default } from "./defaults/action"
|
||||
import { ODPermissionManager_Default } from "./defaults/permission"
|
||||
import { ODHelpMenuManager_Default } from "./defaults/helpmenu"
|
||||
import { ODStatsManager_Default } from "./defaults/stat"
|
||||
import { ODCodeManager_Default } from "./defaults/code"
|
||||
import { ODCooldownManager_Default } from "./defaults/cooldown"
|
||||
import { ODPostManager_Default } from "./defaults/post"
|
||||
import { ODVerifyBarManager_Default } from "./defaults/verifybar"
|
||||
import { ODProgressBarManager_Default } from "./defaults/progressbar"
|
||||
import { ODStartScreenManager_Default } from "./defaults/startscreen"
|
||||
import { ODLiveStatusManager_Default } from "./defaults/console"
|
||||
export class ODOpenTicketMain extends api.ODMain {
|
||||
declare versions: api.ODVersionManager_Default
|
||||
declare events: api.ODEventManager_Default
|
||||
|
||||
//OPEN TICKET MODULES
|
||||
import { ODOptionManager } from "./openticket/option"
|
||||
import { ODPanelManager } from "./openticket/panel"
|
||||
import { ODTicketManager } from "./openticket/ticket"
|
||||
import { ODQuestionManager } from "./openticket/question"
|
||||
import { ODBlacklistManager } from "./openticket/blacklist"
|
||||
import { ODTranscriptManager_Default } from "./openticket/transcript"
|
||||
import { ODRoleManager } from "./openticket/role"
|
||||
import { ODPriorityManager_Default } from "./openticket/priority"
|
||||
|
||||
/**## ODMain `class`
|
||||
* This is the main Open Ticket class.
|
||||
* It contains all managers from the entire bot & has shortcuts to the event & logging system.
|
||||
*
|
||||
* This class can't be overwritten or extended & is available as the global variable `openticket`!
|
||||
*/
|
||||
export class ODMain {
|
||||
/**The manager that handles all versions in the bot. */
|
||||
versions: ODVersionManager_Default
|
||||
|
||||
/**The timestamp that the (node.js) process of the bot started. */
|
||||
processStartupDate: Date = new Date()
|
||||
/**The timestamp that the bot finished loading and is ready for usage. */
|
||||
readyStartupDate: Date|null = null
|
||||
|
||||
/**The manager responsible for the debug file. (`otdebug.txt`) */
|
||||
debugfile: ODDebugFileManager
|
||||
/**The manager responsible for the console system. (logs, errors, etc) */
|
||||
console: ODConsoleManager
|
||||
/**The manager responsible for sending debug logs to the debug file. (`otdebug.txt`) */
|
||||
debug: ODDebugger
|
||||
/**The manager containing all Open Ticket events. */
|
||||
events: ODEventManager_Default
|
||||
|
||||
/**The manager that handles & executes all plugins in the bot. */
|
||||
plugins: ODPluginManager_Default
|
||||
/**The manager that manages & checks all the console flags of the bot. (like `--debug`) */
|
||||
flags: ODFlagManager_Default
|
||||
/**The manager responsible for progress bars in the console. */
|
||||
progressbars: ODProgressBarManager_Default
|
||||
/**The manager that manages & contains all the config files of the bot. (like `config/general.json`) */
|
||||
configs: ODConfigManager_Default
|
||||
/**The manager that manages & contains all the databases of the bot. (like `database/global.json`) */
|
||||
databases: ODDatabaseManager_Default
|
||||
/**The manager that manages all the data sessions of the bot. (it's a temporary database) */
|
||||
sessions: ODSessionManager_Default
|
||||
/**The manager that manages all languages & translations of the bot. (but not for plugins) */
|
||||
languages: ODLanguageManager_Default
|
||||
declare plugins: api.ODPluginManager_Default
|
||||
declare flags: api.ODFlagManager_Default
|
||||
declare progressbars: api.ODProgressBarManager_Default
|
||||
declare configs: api.ODConfigManager_Default
|
||||
declare databases: api.ODDatabaseManager_Default
|
||||
declare sessions: api.ODSessionManager_Default
|
||||
declare languages: api.ODLanguageManager_Default
|
||||
|
||||
/**The manager that handles & executes all config checkers in the bot. (the code that checks if you have something wrong in your config) */
|
||||
checkers: ODCheckerManager_Default
|
||||
/**The manager that manages all builders in the bot. (e.g. buttons, dropdowns, messages, modals, etc) */
|
||||
builders: ODBuilderManager_Default
|
||||
/**The manager that manages all responders in the bot. (e.g. commands, buttons, dropdowns, modals) */
|
||||
responders: ODResponderManager_Default
|
||||
/**The manager that manages all actions or procedures in the bot. (e.g. ticket-creation, ticket-deletion, ticket-claiming, etc) */
|
||||
actions: ODActionManager_Default
|
||||
/**The manager that manages all verify bars in the bot. (the ✅ ❌ buttons) */
|
||||
verifybars: ODVerifyBarManager_Default
|
||||
/**The manager that contains all permissions for commands & actions in the bot. (use it to check if someone has admin perms or not) */
|
||||
permissions: ODPermissionManager_Default
|
||||
/**The manager that contains all cooldowns of the bot. (e.g. ticket-cooldowns) */
|
||||
cooldowns: ODCooldownManager_Default
|
||||
/**The manager that manages & renders the Open Ticket help menu. (not the embed, but the text) */
|
||||
helpmenu: ODHelpMenuManager_Default
|
||||
/**The manager that manages, saves & renders the Open Ticket statistics. (not the embed, but the text & database) */
|
||||
stats: ODStatsManager_Default
|
||||
/**This manager is a place where you can put code that executes when the bot almost finishes the setup. (can be used for less important stuff that doesn't require an exact time-order) */
|
||||
code: ODCodeManager_Default
|
||||
/**The manager that manages all posts (static discord channels) in the bot. (e.g. (transcript) logs, etc) */
|
||||
posts: ODPostManager_Default
|
||||
declare checkers: api.ODCheckerManager_Default
|
||||
declare builders: api.ODBuilderManager_Default
|
||||
declare responders: api.ODResponderManager_Default
|
||||
declare actions: api.ODActionManager_Default
|
||||
declare verifybars: api.ODVerifyBarManager_Default
|
||||
declare permissions: api.ODPermissionManager_Default
|
||||
declare cooldowns: api.ODCooldownManager_Default
|
||||
declare helpmenu: api.ODHelpMenuManager_Default
|
||||
declare stats: api.ODStatsManager_Default
|
||||
declare code: api.ODCodeManager_Default
|
||||
declare posts: api.ODPostManager_Default
|
||||
|
||||
/**The manager responsible for everything related to the client. (e.g. status, login, slash & text commands, etc) */
|
||||
client: ODClientManager_Default
|
||||
/**This manager contains A LOD of booleans. With these switches, you can turn off "default behaviours" from the bot. This is used if you want to replace the default Open Ticket code. */
|
||||
defaults: ODDefaultsManager
|
||||
/**This manager manages all the variables in the ENV. It reads from both the `.env` file & the `process.env`. (these 2 will be combined) */
|
||||
env: ODEnvHelper
|
||||
declare client: api.ODClientManager_Default
|
||||
declare livestatus: api.ODLiveStatusManager_Default
|
||||
declare startscreen: api.ODStartScreenManager_Default
|
||||
|
||||
/**The manager responsible for the livestatus system. (remote console logs) */
|
||||
livestatus: ODLiveStatusManager_Default
|
||||
/**The manager responsible for the livestatus system. (remote console logs) */
|
||||
startscreen: ODStartScreenManager_Default
|
||||
/////////////////////
|
||||
//// OPEN TICKET ////
|
||||
/////////////////////
|
||||
|
||||
//OPEN TICKET
|
||||
/**Open Ticket specific fuses. With these fuses/switches, you can turn off "default behaviours" from the bot. Useful for replacing default behaviour with a custom implementation. */
|
||||
fuses: api.ODFuseManager<api.ODOpenTicketFuseList>
|
||||
/**The manager that manages all the data of questions in the bot. (these are used in options & tickets) */
|
||||
questions: ODQuestionManager
|
||||
questions: api.ODQuestionManager
|
||||
/**The manager that manages all the data of options in the bot. (these are used for panels, ticket creation, reaction roles) */
|
||||
options: ODOptionManager
|
||||
options: api.ODOptionManager
|
||||
/**The manager that manages all the data of panels in the bot. (panels contain the options) */
|
||||
panels: ODPanelManager
|
||||
panels: api.ODPanelManager
|
||||
/**The manager that manages all tickets in the bot. (here, you can get & edit a lot of data from tickets) */
|
||||
tickets: ODTicketManager
|
||||
tickets: api.ODTicketManager
|
||||
/**The manager that manages the ticket blacklist. (people who are blacklisted can't create a ticket) */
|
||||
blacklist: ODBlacklistManager
|
||||
blacklist: api.ODBlacklistManager
|
||||
/**The manager that manages the ticket transcripts. (both the history & compilers) */
|
||||
transcripts: ODTranscriptManager_Default
|
||||
transcripts: api.ODTranscriptManager_Default
|
||||
/**The manager that manages all reaction roles in the bot. (here, you can add additional data to roles) */
|
||||
roles: ODRoleManager
|
||||
roles: api.ODRoleManager
|
||||
/**The manager that manages all priority levels in the bot. (register/edit ticket priority levels) */
|
||||
priorities: ODPriorityManager_Default
|
||||
priorities: api.ODPriorityManager_Default
|
||||
|
||||
constructor(){
|
||||
this.versions = new ODVersionManager_Default()
|
||||
this.versions.add(ODVersion.fromString("opendiscord:version","v4.1.3"))
|
||||
this.versions.add(ODVersion.fromString("opendiscord:api","v1.0.0"))
|
||||
this.versions.add(ODVersion.fromString("opendiscord:transcripts","v2.1.0"))
|
||||
this.versions.add(ODVersion.fromString("opendiscord:livestatus","v2.0.0"))
|
||||
const version = api.ODVersion.fromString("opendiscord:version","v4.1.3")
|
||||
const debugfile = new api.ODDebugFileManager("./","otdebug.txt",5000,version)
|
||||
const console = new api.ODConsoleManager(100,debugfile)
|
||||
const debug = new api.ODDebugger(console)
|
||||
const client = new api.ODClientManager_Default(debug)
|
||||
const livestatus = new api.ODLiveStatusManager_Default(debug,console)
|
||||
const permissions = new api.ODPermissionManager_Default(debug,client)
|
||||
|
||||
this.debugfile = new ODDebugFileManager("./","otdebug.txt",5000,this.versions.get("opendiscord:version"))
|
||||
this.console = new ODConsoleManager(100,this.debugfile)
|
||||
this.debug = new ODDebugger(this.console)
|
||||
this.events = new ODEventManager_Default(this.debug)
|
||||
super({
|
||||
versions:new api.ODVersionManager_Default(),
|
||||
debugfile,console,debug,
|
||||
events:new api.ODEventManager_Default(debug),
|
||||
processStartupDate:new Date(),
|
||||
readyStartupDate:null,
|
||||
|
||||
this.plugins = new ODPluginManager_Default(this.debug)
|
||||
this.flags = new ODFlagManager_Default(this.debug)
|
||||
this.progressbars = new ODProgressBarManager_Default(this.debug)
|
||||
this.configs = new ODConfigManager_Default(this.debug)
|
||||
this.databases = new ODDatabaseManager_Default(this.debug)
|
||||
this.sessions = new ODSessionManager_Default(this.debug)
|
||||
this.languages = new ODLanguageManager_Default(this.debug,false)
|
||||
|
||||
this.checkers = new ODCheckerManager_Default(this.debug,new ODCheckerStorage(),new ODCheckerRenderer_Default(),new ODCheckerTranslationRegister_Default(),new ODCheckerFunctionManager_Default(this.debug))
|
||||
this.builders = new ODBuilderManager_Default(this.debug)
|
||||
this.client = new ODClientManager_Default(this.debug)
|
||||
this.responders = new ODResponderManager_Default(this.debug,this.client)
|
||||
this.actions = new ODActionManager_Default(this.debug)
|
||||
this.verifybars = new ODVerifyBarManager_Default(this.debug)
|
||||
this.permissions = new ODPermissionManager_Default(this.debug,this.client)
|
||||
this.cooldowns = new ODCooldownManager_Default(this.debug)
|
||||
this.helpmenu = new ODHelpMenuManager_Default(this.debug)
|
||||
this.stats = new ODStatsManager_Default(this.debug)
|
||||
this.code = new ODCodeManager_Default(this.debug)
|
||||
this.posts = new ODPostManager_Default(this.debug)
|
||||
|
||||
this.defaults = new ODDefaultsManager()
|
||||
this.env = new ODEnvHelper()
|
||||
plugins:new api.ODPluginManager_Default(debug),
|
||||
flags:new api.ODFlagManager_Default(debug),
|
||||
progressbars:new api.ODProgressBarManager_Default(debug),
|
||||
configs:new api.ODConfigManager_Default(debug),
|
||||
databases:new api.ODDatabaseManager_Default(debug),
|
||||
sessions:new api.ODSessionManager_Default(debug),
|
||||
languages:new api.ODLanguageManager_Default(debug,false),
|
||||
|
||||
checkers:new api.ODCheckerManager_Default(debug,new api.ODCheckerStorage(),new api.ODCheckerRenderer_Default(),new api.ODCheckerTranslationRegister_Default(),new api.ODCheckerFunctionManager_Default(debug)),
|
||||
builders:new api.ODBuilderManager_Default(debug),
|
||||
client,
|
||||
responders:new api.ODResponderManager_Default(debug,client),
|
||||
actions:new api.ODActionManager_Default(debug),
|
||||
verifybars:new api.ODVerifyBarManager_Default(debug),
|
||||
permissions,
|
||||
cooldowns:new api.ODCooldownManager_Default(debug),
|
||||
helpmenu:new api.ODHelpMenuManager_Default(debug),
|
||||
stats:new api.ODStatsManager_Default(debug),
|
||||
code:new api.ODCodeManager_Default(debug),
|
||||
posts:new api.ODPostManager_Default(debug),
|
||||
|
||||
sharedFuses:utilities.sharedFuses,
|
||||
env:new api.ODEnvHelper(),
|
||||
livestatus,
|
||||
startscreen:new api.ODStartScreenManager_Default(debug,livestatus),
|
||||
},"openticket")
|
||||
|
||||
this.livestatus = new ODLiveStatusManager_Default(this.debug,this)
|
||||
this.startscreen = new ODStartScreenManager_Default(this.debug,this.livestatus)
|
||||
this.livestatus.useMain(this)
|
||||
this.versions.add(api.ODVersion.fromString("opendiscord:version","v4.1.3"))
|
||||
this.versions.add(api.ODVersion.fromString("opendiscord:transcripts","v2.1.0"))
|
||||
|
||||
//OPEN TICKET
|
||||
this.questions = new ODQuestionManager(this.debug)
|
||||
this.options = new ODOptionManager(this.debug)
|
||||
this.panels = new ODPanelManager(this.debug)
|
||||
this.tickets = new ODTicketManager(this.debug,this.client)
|
||||
this.blacklist = new ODBlacklistManager(this.debug)
|
||||
this.transcripts = new ODTranscriptManager_Default(this.debug,this.tickets,this.client,this.permissions)
|
||||
this.roles = new ODRoleManager(this.debug)
|
||||
this.priorities = new ODPriorityManager_Default(this.debug)
|
||||
}
|
||||
|
||||
/**Log a message to the console. But in the Open Ticket style :) */
|
||||
log(message:ODConsoleMessage): void
|
||||
log(message:ODError): void
|
||||
log(message:string, type?:ODConsoleMessageTypes, params?:ODConsoleMessageParam[]): void
|
||||
log(message:ODConsoleMessage|ODError|string, type?:ODConsoleMessageTypes, params?:ODConsoleMessageParam[]){
|
||||
if (message instanceof ODConsoleMessage) this.console.log(message)
|
||||
else if (message instanceof ODError) this.console.log(message)
|
||||
else if (["string","number","boolean","object"].includes(typeof message)) this.console.log(message,type,params)
|
||||
this.fuses = new api.ODFuseManager<api.ODOpenTicketFuseList>({
|
||||
questionLoading:true,
|
||||
optionLoading:true,
|
||||
panelLoading:true,
|
||||
ticketLoading:true,
|
||||
roleLoading:true,
|
||||
blacklistLoading:true,
|
||||
transcriptCompilerLoading:true,
|
||||
transcriptHistoryLoading:true,
|
||||
autocloseCheckInterval:300000, //5 minutes
|
||||
autodeleteCheckInterval:300000 //5 minutes
|
||||
})
|
||||
this.questions = new api.ODQuestionManager(debug)
|
||||
this.options = new api.ODOptionManager(debug)
|
||||
this.panels = new api.ODPanelManager(debug)
|
||||
this.tickets = new api.ODTicketManager(debug,client)
|
||||
this.blacklist = new api.ODBlacklistManager(debug)
|
||||
this.transcripts = new api.ODTranscriptManager_Default(debug,this.tickets,client,permissions)
|
||||
this.roles = new api.ODRoleManager(debug)
|
||||
this.priorities = new api.ODPriorityManager_Default(debug)
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
///////////////////////////////////////
|
||||
//ACTION MODULE
|
||||
///////////////////////////////////////
|
||||
import { ODId, ODManager, ODValidId, ODSystemError, ODManagerData } from "./base"
|
||||
import { ODWorkerManager, ODWorkerCallback, ODWorker } from "./worker"
|
||||
import { ODDebugger } from "./console"
|
||||
|
||||
/**## ODActionImplementation `class`
|
||||
* This is an Open Ticket action implementation.
|
||||
*
|
||||
* It is a basic implementation of the `ODWorkerManager` used by all `ODAction` classes.
|
||||
*
|
||||
* This class can't be used stand-alone & needs to be extended from!
|
||||
*/
|
||||
export class ODActionImplementation<Source extends string,Params extends object,Result extends object> extends ODManagerData {
|
||||
/**The manager that has all workers of this implementation */
|
||||
workers: ODWorkerManager<object,Source,Params>
|
||||
|
||||
constructor(id:ODValidId, callback?:ODWorkerCallback<object,Source,Params>, priority?:number, callbackId?:ODValidId){
|
||||
super(id)
|
||||
this.workers = new ODWorkerManager("descending")
|
||||
if (callback) this.workers.add(new ODWorker(callbackId ? callbackId : id,priority ?? 0,callback))
|
||||
}
|
||||
/**Execute all workers & return the result. */
|
||||
async run(source:Source, params:Params): Promise<Partial<Result>> {
|
||||
throw new ODSystemError("Tried to build an unimplemented ODResponderImplementation")
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODActionManager `class`
|
||||
* This is an Open Ticket action manager.
|
||||
*
|
||||
* It contains all Open Ticket actions. You can compare actions with some sort of "procedure".
|
||||
* It's a complicated task that is divided into multiple functions.
|
||||
*
|
||||
* Some examples are `ticket-creation`, `ticket-closing`, `ticket-claiming`, ...
|
||||
*
|
||||
* It's recommended to use this system in combination with Open Ticket responders!
|
||||
*/
|
||||
export class ODActionManager extends ODManager<ODAction<string,{},{}>> {
|
||||
constructor(debug:ODDebugger){
|
||||
super(debug,"action")
|
||||
}
|
||||
}
|
||||
|
||||
export class ODAction<Source extends string,Params extends object,Result extends object> extends ODActionImplementation<Source,Params,Result> {
|
||||
/**Run this action */
|
||||
async run(source:Source, params:Params): Promise<Partial<Result>> {
|
||||
//create instance
|
||||
const instance = {}
|
||||
|
||||
//wait for workers to finish
|
||||
await this.workers.executeWorkers(instance,source,params)
|
||||
|
||||
//return data generated by workers
|
||||
return instance
|
||||
}
|
||||
}
|
||||
@@ -1,763 +0,0 @@
|
||||
///////////////////////////////////////
|
||||
//BASE MODULE
|
||||
///////////////////////////////////////
|
||||
import * as fs from "fs"
|
||||
import { ODConsoleWarningMessage, ODDebugger } from "./console"
|
||||
|
||||
/**## ODPromiseVoid `type`
|
||||
* This is a simple type to represent a callback return value that could be a promise or not.
|
||||
*/
|
||||
export type ODPromiseVoid = void|Promise<void>
|
||||
|
||||
/**## ODOptionalPromise `type`
|
||||
* This is a simple type to represent a type as normal value or a promise value.
|
||||
*/
|
||||
export type ODOptionalPromise<T> = T|Promise<T>
|
||||
|
||||
|
||||
/**## ODValidButtonColor `type`
|
||||
* This is a collection of all the possible button colors.
|
||||
*/
|
||||
export type ODValidButtonColor = "gray"|"red"|"green"|"blue"
|
||||
|
||||
/**## ODValidId `type`
|
||||
* This is a valid Open Ticket identifier. It can be an `ODId` or `string`!
|
||||
*
|
||||
* You will see this type in many functions from Open Ticket.
|
||||
*/
|
||||
export type ODValidId = string|ODId
|
||||
|
||||
/**## ODValidJsonType `type`
|
||||
* This is a collection of all types that can be stored in a JSON file!
|
||||
*
|
||||
* list: `string`, `number`, `boolean`, `array`, `object`, `null`
|
||||
*/
|
||||
export type ODValidJsonType = string|number|boolean|object|ODValidJsonType[]|null
|
||||
|
||||
|
||||
/**## ODInterfaceWithPartialProperty `type`
|
||||
* This is a utility type to create an interface where some properties are optional!
|
||||
*/
|
||||
export type ODInterfaceWithPartialProperty<Interface,Key extends keyof Interface> = Omit<Interface,Key> & Partial<Pick<Interface,Key>>
|
||||
|
||||
/**## ODDiscordIdType `type`
|
||||
* A list of all available discord ID types. Used in the config checker.
|
||||
*/
|
||||
export type ODDiscordIdType = "role"|"server"|"channel"|"category"|"user"|"member"|"interaction"|"message"
|
||||
|
||||
/**## ODId `class`
|
||||
* This is an Open Ticket identifier.
|
||||
*
|
||||
* It can only contain the following characters: `a-z`, `A-Z`, `0-9`, `:`, `-` & `_`
|
||||
*
|
||||
* You can use this class to assign a unique id when creating configs, databases, languages & more!
|
||||
*/
|
||||
export class ODId {
|
||||
/**The full value of this `ODId` as a `string`. */
|
||||
#value: string
|
||||
/**The full value of this `ODId` as a `string`. */
|
||||
set value(id:string){
|
||||
this._change(this.#value,id)
|
||||
this.#value = id
|
||||
}
|
||||
get value(){
|
||||
return this.#value
|
||||
}
|
||||
/**The change listener for the parent `ODManager` of this `ODId`. */
|
||||
#change: ((oldId:string,newId:string) => void)|null = null
|
||||
|
||||
constructor(id:ODValidId){
|
||||
if (typeof id != "string" && !(id instanceof ODId)) throw new ODSystemError("Invalid constructor parameter => id:ODValidId")
|
||||
|
||||
if (typeof id == "string"){
|
||||
//id is string
|
||||
const result: string[] = []
|
||||
const charregex = /[a-zA-Z0-9éèçàêâôûî\:\-\_]/
|
||||
|
||||
id.split("").forEach((char) => {
|
||||
if (charregex.test(char)){
|
||||
result.push(char)
|
||||
}
|
||||
})
|
||||
|
||||
if (result.length > 0) this.#value = result.join("")
|
||||
else throw new ODSystemError("invalid ID at 'new ODID(id: "+id+")'")
|
||||
}else{
|
||||
//id is ODId
|
||||
this.#value = id.#value
|
||||
}
|
||||
}
|
||||
|
||||
/**Returns a string representation of this id. (same as `this.value`) */
|
||||
toString(){
|
||||
return this.#value
|
||||
}
|
||||
/**The namespace of the id before `:`. (e.g. `openticket` for `openticket:autoclose-enabled`) */
|
||||
getNamespace(){
|
||||
const splitted = this.#value.split(":")
|
||||
if (splitted.length > 1) return splitted[0]
|
||||
else return ""
|
||||
}
|
||||
/**The identifier of the id after `:`. (e.g. `autoclose-enabled` for `openticket:autoclose-enabled`) */
|
||||
getIdentifier(){
|
||||
const splitted = this.#value.split(":")
|
||||
if (splitted.length > 1){
|
||||
splitted.shift()
|
||||
return splitted.join(":")
|
||||
}else return this.#value
|
||||
}
|
||||
/**Trigger an `onChange()` event in the parent `ODManager` of this class. */
|
||||
protected _change(oldId:string,newId:string){
|
||||
if (this.#change){
|
||||
try{
|
||||
this.#change(oldId,newId)
|
||||
}catch(err){
|
||||
process.emit("uncaughtException",err)
|
||||
throw new ODSystemError("Failed to execute _change() callback!")
|
||||
}
|
||||
}
|
||||
}
|
||||
/****(❌ SYSTEM ONLY!!)** Set the callback executed when a value inside this class changes. */
|
||||
changed(callback:((oldId:string,newId:string) => void)|null){
|
||||
this.#change = callback
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODManagerChangeHelper `class`
|
||||
* This is an Open Ticket manager change helper.
|
||||
*
|
||||
* It is used to let the "onChange" event in the `ODManager` class work.
|
||||
* You can use this class when extending your own `ODManager`
|
||||
*/
|
||||
export class ODManagerChangeHelper {
|
||||
#change: (() => void)|null = null
|
||||
|
||||
/**Trigger an `onChange()` event in the parent `ODManager` of this class. */
|
||||
protected _change(){
|
||||
if (this.#change){
|
||||
try{
|
||||
this.#change()
|
||||
}catch(err){
|
||||
process.emit("uncaughtException",err)
|
||||
throw new ODSystemError("Failed to execute _change() callback!")
|
||||
}
|
||||
}
|
||||
}
|
||||
/****(❌ SYSTEM ONLY!!)** Set the callback executed when a value inside this class changes. */
|
||||
changed(callback:(() => void)|null){
|
||||
this.#change = callback
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODManagerData `class`
|
||||
* This is Open Ticket manager data.
|
||||
*
|
||||
* It provides a template for all classes that are used in the `ODManager`.
|
||||
*
|
||||
* There is an `id:ODId` property & also some events used in the manager.
|
||||
*/
|
||||
export class ODManagerData extends ODManagerChangeHelper {
|
||||
/**The id of this data. */
|
||||
id: ODId
|
||||
|
||||
constructor(id:ODValidId){
|
||||
if (typeof id != "string" && !(id instanceof ODId)) throw new ODSystemError("Invalid constructor parameter => id:ODValidId")
|
||||
super()
|
||||
this.id = new ODId(id)
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODManagerCallback `type`
|
||||
* This is a callback for the `onChange` and `onRemove` events in the `ODManager`
|
||||
*/
|
||||
export type ODManagerCallback<DataType extends ODManagerData> = (data:DataType) => void
|
||||
/**## ODManagerAddCallback `type`
|
||||
* This is a callback for the `onAdd` event in the `ODManager`
|
||||
*/
|
||||
export type ODManagerAddCallback<DataType extends ODManagerData> = (data:DataType, overwritten:boolean) => void
|
||||
|
||||
/**## ODManager `class`
|
||||
* This is an Open Ticket manager.
|
||||
*
|
||||
* It can be used to store & manage classes based on their `ODId`.
|
||||
* It is somewhat the same as the default JS `Map()`.
|
||||
* You can extend this class when creating your own classes & managers.
|
||||
*
|
||||
* This class has many useful functions based on `ODId` (add, get, remove, getAll, getFiltered, exists, loopAll, ...)
|
||||
*/
|
||||
export class ODManager<DataType extends ODManagerData> extends ODManagerChangeHelper {
|
||||
/**Alias to Open Ticket debugger. */
|
||||
#debug?: ODDebugger
|
||||
/**The message to send when debugging this manager. */
|
||||
#debugname?: string
|
||||
/**The map storing all data classes in this manager. */
|
||||
#data: Map<string,DataType> = new Map()
|
||||
/**An array storing all listeners when data is added. */
|
||||
#addListeners: ODManagerAddCallback<DataType>[] = []
|
||||
/**An array storing all listeners when data has changed. */
|
||||
#changeListeners: ODManagerCallback<DataType>[] = []
|
||||
/**An array storing all listeners when data is removed. */
|
||||
#removeListeners: ODManagerCallback<DataType>[] = []
|
||||
|
||||
constructor(debug?:ODDebugger, debugname?:string){
|
||||
super()
|
||||
this.#debug = debug
|
||||
this.#debugname = debugname
|
||||
}
|
||||
|
||||
/**Add data to the manager. The `ODId` in the data class will be used as identifier! You can optionally select to overwrite existing data!*/
|
||||
add(data:DataType|DataType[], overwrite?:boolean): boolean {
|
||||
//repeat same command when data is an array
|
||||
if (Array.isArray(data)){
|
||||
data.forEach((arrayData) => {
|
||||
this.add(arrayData,overwrite)
|
||||
})
|
||||
return false
|
||||
}
|
||||
|
||||
//add listener for data id change => transfer data within manager
|
||||
data.id.changed((oldId,newId) => {
|
||||
this.#data.delete(oldId)
|
||||
this.#data.set(newId,data)
|
||||
})
|
||||
|
||||
//add data
|
||||
let didOverwrite: boolean
|
||||
if (this.#data.has(data.id.value)){
|
||||
if (!overwrite) throw new ODSystemError("Id '"+data.id.value+"' already exists in "+this.#debugname+" manager. Use 'overwrite:true' to allow overwriting!")
|
||||
this.#data.set(data.id.value,data)
|
||||
didOverwrite = true
|
||||
if (this.#debug) this.#debug.debug("Added new "+this.#debugname+" to manager",[{key:"id",value:data.id.value},{key:"overwrite",value:"true"}])
|
||||
|
||||
}else{
|
||||
this.#data.set(data.id.value,data)
|
||||
didOverwrite = false
|
||||
if (this.#debug) this.#debug.debug("Added new "+this.#debugname+" to manager",[{key:"id",value:data.id.value},{key:"overwrite",value:"false"}])
|
||||
|
||||
}
|
||||
|
||||
//emit change listeners
|
||||
data.changed(() => {
|
||||
//notify change in upper-manager (because data in this manager changed)
|
||||
this._change()
|
||||
this.#changeListeners.forEach((cb) => {
|
||||
try{
|
||||
cb(data)
|
||||
}catch(err){
|
||||
throw new ODSystemError("Failed to run manager onChange() listener.\n"+err)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
//emit add listeners
|
||||
this.#addListeners.forEach((cb) => {
|
||||
try{
|
||||
cb(data,didOverwrite)
|
||||
}catch(err){
|
||||
throw new ODSystemError("Failed to run manager onAdd() listener.\n"+err)
|
||||
}
|
||||
})
|
||||
|
||||
//notify change in upper-manager (because data added)
|
||||
this._change()
|
||||
|
||||
return didOverwrite
|
||||
}
|
||||
/**Get data that matches the `ODId`. Returns the found data.*/
|
||||
get(id:ODValidId): DataType|null {
|
||||
const newId = new ODId(id)
|
||||
const data = this.#data.get(newId.value)
|
||||
if (data) return data
|
||||
else return null
|
||||
}
|
||||
/**Remove data that matches the `ODId`. Returns the removed data. */
|
||||
remove(id:ODValidId): DataType|null {
|
||||
const newId = new ODId(id)
|
||||
const data = this.#data.get(newId.value)
|
||||
|
||||
if (!data){
|
||||
if (this.#debug) this.#debug.debug("Removed "+this.#debugname+" from manager",[{key:"id",value:newId.value},{key:"found",value:"false"}])
|
||||
return null
|
||||
}else{
|
||||
this.#data.delete(newId.value)
|
||||
if (this.#debug) this.#debug.debug("Removed "+this.#debugname+" from manager",[{key:"id",value:newId.value},{key:"found",value:"true"}])
|
||||
}
|
||||
|
||||
//remove all listeners
|
||||
data.id.changed(null)
|
||||
data.changed(null)
|
||||
|
||||
//emit remove listeners
|
||||
this.#removeListeners.forEach((cb) => {
|
||||
try{
|
||||
cb(data)
|
||||
}catch(err){
|
||||
throw new ODSystemError("Failed to run manager onRemove() listener.\n"+err)
|
||||
}
|
||||
})
|
||||
|
||||
//notify change in upper-manager (because data removed)
|
||||
this._change()
|
||||
|
||||
return data
|
||||
}
|
||||
/**Check if data that matches the `ODId` exists. Returns a boolean. */
|
||||
exists(id:ODValidId): boolean {
|
||||
const newId = new ODId(id)
|
||||
if (this.#data.has(newId.value)) return true
|
||||
else return false
|
||||
}
|
||||
/**Get all data inside this manager*/
|
||||
getAll(): DataType[] {
|
||||
return Array.from(this.#data.values())
|
||||
}
|
||||
/**Get all data that matches inside the filter function*/
|
||||
getFiltered(predicate:(value:DataType, index:number, array:DataType[]) => unknown): DataType[] {
|
||||
return Array.from(this.#data.values()).filter(predicate)
|
||||
}
|
||||
/**Get all data where the `ODId` matches the provided RegExp. */
|
||||
getRegex(regex:RegExp): DataType[] {
|
||||
return Array.from(this.#data.values()).filter((data) => regex.test(data.id.value))
|
||||
}
|
||||
/**Get the length/size/amount of the data inside this manager. */
|
||||
getLength(){
|
||||
return this.#data.size
|
||||
}
|
||||
/**Get a list of all the ids inside this manager*/
|
||||
getIds(): ODId[] {
|
||||
const ids = Array.from(this.#data.keys())
|
||||
return ids.map((id) => new ODId(id))
|
||||
}
|
||||
/**Run an iterator over all data in this manager. This method also supports async-await behaviour!*/
|
||||
async loopAll(cb:(data:DataType,id:ODId) => ODPromiseVoid): Promise<void> {
|
||||
for (const data of this.getAll()){
|
||||
await cb(data,data.id)
|
||||
}
|
||||
}
|
||||
/**Use the Open Ticket debugger in this manager for logs*/
|
||||
useDebug(debug?:ODDebugger, debugname?:string){
|
||||
this.#debug = debug
|
||||
this.#debugname = debugname
|
||||
}
|
||||
/**Listen for when data is added to this manager. */
|
||||
onAdd(callback:ODManagerAddCallback<DataType>){
|
||||
this.#addListeners.push(callback)
|
||||
}
|
||||
/**Listen for when data is changed in this manager. */
|
||||
onChange(callback:ODManagerCallback<DataType>){
|
||||
this.#changeListeners.push(callback)
|
||||
}
|
||||
/**Listen for when data is removed from this manager. */
|
||||
onRemove(callback:ODManagerCallback<DataType>){
|
||||
this.#removeListeners.push(callback)
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODManagerWithSafety `class`
|
||||
* This is an Open Ticket safe manager.
|
||||
*
|
||||
* It functions exactly the same as a normal `ODManager`, but it has 1 function extra!
|
||||
* The `getSafe()` function will always return data, because when it doesn't find an id, it returns pre-configured backup data.
|
||||
*/
|
||||
export class ODManagerWithSafety<DataType extends ODManagerData> extends ODManager<DataType> {
|
||||
/**The function that creates backup data returned in `getSafe()` when an id is missing in this manager. */
|
||||
#backupCreator: () => DataType
|
||||
/** Temporary storage for manager debug name. */
|
||||
#debugname: string
|
||||
|
||||
constructor(backupCreator:() => DataType, debug?:ODDebugger, debugname?:string){
|
||||
super(debug,debugname)
|
||||
this.#backupCreator = backupCreator
|
||||
this.#debugname = debugname ?? "unknown"
|
||||
}
|
||||
|
||||
/**Get data that matches the `ODId`. Returns the backup data when not found.
|
||||
*
|
||||
* ### ⚠️ This should only be used when the data doesn't need to be written/edited
|
||||
*/
|
||||
getSafe(id:ODValidId): DataType {
|
||||
const data = super.get(id)
|
||||
if (!data){
|
||||
process.emit("uncaughtException",new ODSystemError("ODManagerWithSafety:getSafe(\""+id+"\") => Unknown Id => Used backup data ("+this.#debugname+" manager)"))
|
||||
return this.#backupCreator()
|
||||
}
|
||||
else return data
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODVersionManager `class`
|
||||
* A Open Ticket version manager.
|
||||
*
|
||||
* It is used to manage different `ODVersion`'s from the bot. You will use it to check which version of the bot is used.
|
||||
*/
|
||||
export class ODVersionManager extends ODManager<ODVersion> {
|
||||
constructor(){
|
||||
super()
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODVersion `class`
|
||||
* This is an Open Ticket version.
|
||||
*
|
||||
* It has many features like comparing versions & checking if they are compatible.
|
||||
*
|
||||
* You can use it in your own plugin, but most of the time you will use it to check the Open Ticket version!
|
||||
*/
|
||||
export class ODVersion extends ODManagerData {
|
||||
/**The first number of the version (example: `v1.2.3` => `1`) */
|
||||
primary: number
|
||||
/**The second number of the version (example: `v1.2.3` => `2`) */
|
||||
secondary: number
|
||||
/**The third number of the version (example: `v1.2.3` => `3`) */
|
||||
tertiary: number
|
||||
|
||||
constructor(id:ODValidId, primary:number, secondary:number, tertiary:number){
|
||||
super(id)
|
||||
if (typeof primary != "number") throw new ODSystemError("Invalid constructor parameter => primary:number")
|
||||
if (typeof secondary != "number") throw new ODSystemError("Invalid constructor parameter => secondary:number")
|
||||
if (typeof tertiary != "number") throw new ODSystemError("Invalid constructor parameter => tertiary:number")
|
||||
|
||||
this.primary = primary
|
||||
this.secondary = secondary
|
||||
this.tertiary = tertiary
|
||||
}
|
||||
|
||||
/**Get the version from a string (also possible with `v` prefix)
|
||||
* @example const version = api.ODVersion.fromString("id","v1.2.3") //creates version 1.2.3
|
||||
*/
|
||||
static fromString(id:ODValidId, version:string){
|
||||
if (typeof id != "string" && !(id instanceof ODId)) throw new ODSystemError("Invalid function parameter => id:ODValidId")
|
||||
if (typeof version != "string") throw new ODSystemError("Invalid function parameter => version:string")
|
||||
|
||||
const versionCheck = (version.startsWith("v")) ? version.substring(1) : version
|
||||
const splittedVersion = versionCheck.split(".")
|
||||
|
||||
return new this(id,Number(splittedVersion[0]),Number(splittedVersion[1]),Number(splittedVersion[2]))
|
||||
}
|
||||
/**Get the version as a string (`noprefix:true` => with `v` prefix)
|
||||
* @example
|
||||
* new api.ODVersion(1,0,0).toString(false) //returns "v1.0.0"
|
||||
* new api.ODVersion(1,0,0).toString(true) //returns "1.0.0"
|
||||
*/
|
||||
toString(noprefix?:boolean){
|
||||
const prefix = noprefix ? "" : "v"
|
||||
return prefix+[this.primary,this.secondary,this.tertiary].join(".")
|
||||
}
|
||||
/**Compare this version with another version and returns the result: `higher`, `lower` or `equal`
|
||||
* @example
|
||||
* new api.ODVersion(1,0,0).compare(new api.ODVersion(1,2,0)) //returns "lower"
|
||||
* new api.ODVersion(1,3,0).compare(new api.ODVersion(1,2,0)) //returns "higher"
|
||||
* new api.ODVersion(1,2,0).compare(new api.ODVersion(1,2,0)) //returns "equal"
|
||||
*/
|
||||
compare(comparator:ODVersion): "higher"|"lower"|"equal" {
|
||||
if (!(comparator instanceof ODVersion)) throw new ODSystemError("Invalid function parameter => comparator:ODVersion")
|
||||
|
||||
if (this.primary < comparator.primary) return "lower"
|
||||
else if (this.primary > comparator.primary) return "higher"
|
||||
else {
|
||||
if (this.secondary < comparator.secondary) return "lower"
|
||||
else if (this.secondary > comparator.secondary) return "higher"
|
||||
else {
|
||||
if (this.tertiary < comparator.tertiary) return "lower"
|
||||
else if (this.tertiary > comparator.tertiary) return "higher"
|
||||
else return "equal"
|
||||
}
|
||||
}
|
||||
}
|
||||
/**Check if this version is included in the list
|
||||
* @example
|
||||
* const list = [
|
||||
* new api.ODVersion(1,0,0),
|
||||
* new api.ODVersion(1,0,1),
|
||||
* new api.ODVersion(1,0,2)
|
||||
* ]
|
||||
* new api.ODVersion(1,0,0).compatible(list) //returns true
|
||||
* new api.ODVersion(1,0,1).compatible(list) //returns true
|
||||
* new api.ODVersion(1,0,3).compatible(list) //returns false
|
||||
*/
|
||||
compatible(list:ODVersion[]): boolean {
|
||||
if (!Array.isArray(list)) throw new ODSystemError("Invalid function parameter => list:ODVersion[]")
|
||||
if (!list.every((v) => (v instanceof ODVersion))) throw new ODSystemError("Invalid function parameter => list:ODVersion[]")
|
||||
|
||||
return list.some((v) => {
|
||||
return (v.toString() === this.toString())
|
||||
})
|
||||
}
|
||||
/**Check if this version is higher or equal to the provided `requirement`. */
|
||||
min(requirement:string|ODVersion){
|
||||
if (typeof requirement == "string") requirement = ODVersion.fromString("temp",requirement)
|
||||
|
||||
//skip when primary version is higher or lower than current one.
|
||||
if (this.primary < requirement.primary) return false
|
||||
else if (this.primary > requirement.primary) return true
|
||||
|
||||
//skip when secondary version is higher or lower than current one.
|
||||
if (this.secondary < requirement.secondary) return false
|
||||
else if (this.secondary > requirement.secondary) return true
|
||||
|
||||
//skip when tertiary version is higher or lower than current one.
|
||||
if (this.tertiary < requirement.tertiary) return false
|
||||
else if (this.tertiary > requirement.tertiary) return true
|
||||
|
||||
return true
|
||||
}
|
||||
/**Check if this version is lower or equal to the provided `requirement`. */
|
||||
max(requirement:string|ODVersion){
|
||||
if (typeof requirement == "string") requirement = ODVersion.fromString("temp",requirement)
|
||||
|
||||
//skip when primary version is higher or lower than current one.
|
||||
if (this.primary < requirement.primary) return true
|
||||
else if (this.primary > requirement.primary) return false
|
||||
|
||||
//skip when secondary version is higher or lower than current one.
|
||||
if (this.secondary < requirement.secondary) return true
|
||||
else if (this.secondary > requirement.secondary) return false
|
||||
|
||||
//skip when tertiary version is higher or lower than current one.
|
||||
if (this.tertiary < requirement.tertiary) return true
|
||||
else if (this.tertiary > requirement.tertiary) return false
|
||||
|
||||
return true
|
||||
}
|
||||
/**Check if this version is matches the major version (`vX.X`) of the provided `requirement`. */
|
||||
major(requirement:string|ODVersion){
|
||||
if (typeof requirement == "string") requirement = ODVersion.fromString("temp",requirement)
|
||||
return (this.primary == requirement.primary && this.secondary == requirement.secondary)
|
||||
}
|
||||
/**Check if this version is matches the minor version (`vX.X.X`) of the provided `requirement`. */
|
||||
minor(requirement:string|ODVersion){
|
||||
if (typeof requirement == "string") requirement = ODVersion.fromString("temp",requirement)
|
||||
return (this.primary == requirement.primary && this.secondary == requirement.secondary && this.tertiary == requirement.tertiary)
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODHTTPGetRequest `class`
|
||||
* This is a class that can help you with creating simple HTTP GET requests.
|
||||
*
|
||||
* It works using the native node.js fetch() method. You can configure all options in the constructor!
|
||||
* @example
|
||||
* const request = new api.ODHTTPGetRequest("https://www.example.com/abc.txt",false,{})
|
||||
*
|
||||
* const result = await request.run()
|
||||
* result.body //the response body (string)
|
||||
* result.status //the response code (number)
|
||||
* result.response //the full response (object)
|
||||
*/
|
||||
export class ODHTTPGetRequest {
|
||||
/**The url used in the request */
|
||||
url: string
|
||||
/**The request config for additional options */
|
||||
config: RequestInit
|
||||
/**Throw on error OR return http code 500 */
|
||||
throwOnError: boolean
|
||||
|
||||
constructor(url:string,throwOnError:boolean,config?:RequestInit){
|
||||
if (typeof url != "string") throw new ODSystemError("Invalid constructor parameter => url:string")
|
||||
if (typeof throwOnError != "boolean") throw new ODSystemError("Invalid constructor parameter => throwOnError:boolean")
|
||||
if (typeof config != "undefined" && typeof config != "object") throw new ODSystemError("Invalid constructor parameter => config?:RequestInit")
|
||||
|
||||
this.url = url
|
||||
this.throwOnError = throwOnError
|
||||
const newConfig = config ?? {}
|
||||
newConfig.method = "GET"
|
||||
if (newConfig.headers) Object.assign(newConfig.headers,{"User-Agent":"OpenDiscordBots-OpenTicket/4.1.3"})
|
||||
else newConfig.headers = {"User-Agent":"OpenDiscordBots-OpenTicket/4.1.3"}
|
||||
this.config = newConfig
|
||||
}
|
||||
|
||||
/**Execute the GET request.*/
|
||||
run(): Promise<{status:number, body:string, response?:Response}> {
|
||||
return new Promise(async (resolve,reject) => {
|
||||
try{
|
||||
const response = await fetch(this.url,this.config)
|
||||
resolve({
|
||||
status:response.status,
|
||||
body:(await response.text()),
|
||||
response:response
|
||||
})
|
||||
}catch(err){
|
||||
if (this.throwOnError) return reject("[OPENTICKET ERROR]: ODHTTPGetRequest => Unknown fetch() error: "+err)
|
||||
else return resolve({
|
||||
status:500,
|
||||
body:"Open Ticket Error: Unknown fetch() error: "+err,
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODHTTPPostRequest `class`
|
||||
* This is a class that can help you with creating simple HTTP POST requests.
|
||||
*
|
||||
* It works using the native node.js fetch() method. You can configure all options in the constructor!
|
||||
* @example
|
||||
* const request = new api.ODHTTPPostRequest("https://www.example.com/abc.txt",false,{})
|
||||
*
|
||||
* const result = await request.run()
|
||||
* result.body //the response body (string)
|
||||
* result.status //the response code (number)
|
||||
* result.response //the full response (object)
|
||||
*/
|
||||
export class ODHTTPPostRequest {
|
||||
/**The url used in the request */
|
||||
url: string
|
||||
/**The request config for additional options */
|
||||
config: RequestInit
|
||||
/**Throw on error OR return http code 500 */
|
||||
throwOnError: boolean
|
||||
|
||||
constructor(url:string,throwOnError:boolean,config?:RequestInit){
|
||||
if (typeof url != "string") throw new ODSystemError("Invalid constructor parameter => url:string")
|
||||
if (typeof throwOnError != "boolean") throw new ODSystemError("Invalid constructor parameter => throwOnError:boolean")
|
||||
if (typeof config != "undefined" && typeof config != "object") throw new ODSystemError("Invalid constructor parameter => config?:RequestInit")
|
||||
|
||||
this.url = url
|
||||
this.throwOnError = throwOnError
|
||||
const newConfig = config ?? {}
|
||||
newConfig.method = "POST"
|
||||
if (newConfig.headers) Object.assign(newConfig.headers,{"User-Agent":"OpenDiscordBots-OpenTicket/4.1.3"})
|
||||
else newConfig.headers = {"User-Agent":"OpenDiscordBots-OpenTicket/4.1.3"}
|
||||
this.config = newConfig
|
||||
}
|
||||
|
||||
/**Execute the POST request.*/
|
||||
run(): Promise<{status:number, body:string, response?:Response}> {
|
||||
return new Promise(async (resolve,reject) => {
|
||||
try{
|
||||
const response = await fetch(this.url,this.config)
|
||||
resolve({
|
||||
status:response.status,
|
||||
body:(await response.text()),
|
||||
response:response
|
||||
})
|
||||
}catch(err){
|
||||
if (this.throwOnError) return reject("[OPENTICKET ERROR]: ODHTTPPostRequest => Unknown fetch() error: "+err)
|
||||
else return resolve({
|
||||
status:500,
|
||||
body:"Open Ticket Error: Unknown fetch() error!",
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODEnvHelper `class`
|
||||
* This is a utility class that helps you with reading the ENV.
|
||||
*
|
||||
* It has support for the built-in `process.env` & `.env` file
|
||||
* @example
|
||||
* const envHelper = new api.ODEnvHelper()
|
||||
*
|
||||
* const variableA = envHelper.getVariable("value-a")
|
||||
* const variableB = envHelper.getVariable("value-b","dotenv") //only get from .env
|
||||
* const variableA = envHelper.getVariable("value-c","env") //only get from process.env
|
||||
*/
|
||||
export class ODEnvHelper {
|
||||
/**All variables found in the `.env` file */
|
||||
dotenv: object
|
||||
/**All variables found in `process.env` */
|
||||
env: object
|
||||
|
||||
constructor(customEnvPath?:string){
|
||||
if (typeof customEnvPath != "undefined" && typeof customEnvPath != "string") throw new ODSystemError("Invalid constructor parameter => customEnvPath?:string")
|
||||
|
||||
const path = customEnvPath ? customEnvPath : ".env"
|
||||
this.dotenv = fs.existsSync(path) ? this.#readDotEnv(fs.readFileSync(path)) : {}
|
||||
this.env = process.env
|
||||
}
|
||||
|
||||
/**Get a variable from the env */
|
||||
getVariable(name:string,source?:"dotenv"|"env"): any|undefined {
|
||||
if (typeof name != "string") throw new ODSystemError("Invalid function parameter => name:string")
|
||||
if ((typeof source != "undefined" && typeof source != "string") || (source && !["env","dotenv"].includes(source))) throw new ODSystemError("Invalid function parameter => source:'dotenv'|'env'")
|
||||
|
||||
if (source == "dotenv"){
|
||||
return this.dotenv[name]
|
||||
}else if (source == "env"){
|
||||
return this.env[name]
|
||||
}else{
|
||||
//when no source specified => .env has priority over process.env
|
||||
if (this.dotenv[name]) return this.dotenv[name]
|
||||
else return this.env[name]
|
||||
}
|
||||
}
|
||||
|
||||
//THIS CODE IS COPIED FROM THE DODENV-LIB
|
||||
//Repo: https://github.com/motdotla/dotenv
|
||||
//Source: https://github.com/motdotla/dotenv/blob/master/lib/main.js#L12
|
||||
#readDotEnv(src:Buffer){
|
||||
const LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg
|
||||
const obj = {}
|
||||
|
||||
// Convert buffer to string
|
||||
let lines = src.toString()
|
||||
|
||||
// Convert line breaks to same format
|
||||
lines = lines.replace(/\r\n?/mg, '\n')
|
||||
|
||||
let match
|
||||
while ((match = LINE.exec(lines)) != null) {
|
||||
const key = match[1]
|
||||
|
||||
// Default undefined or null to empty string
|
||||
let value = (match[2] || '')
|
||||
|
||||
// Remove whitespace
|
||||
value = value.trim()
|
||||
|
||||
// Check if double quoted
|
||||
const maybeQuote = value[0]
|
||||
|
||||
// Remove surrounding quotes
|
||||
value = value.replace(/^(['"`])([\s\S]*)\1$/mg, '$2')
|
||||
|
||||
// Expand newlines if double quoted
|
||||
if (maybeQuote === '"') {
|
||||
value = value.replace(/\\n/g, '\n')
|
||||
value = value.replace(/\\r/g, '\r')
|
||||
}
|
||||
|
||||
// Add to object
|
||||
obj[key] = value
|
||||
}
|
||||
return obj
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODSystemError `class`
|
||||
* A wrapper for the node.js `Error` class that makes the error look better in the console!
|
||||
*
|
||||
* This wrapper is made for Open Ticket system errors! **It can only be used by Open Ticket itself!**
|
||||
*/
|
||||
export class ODSystemError extends Error {
|
||||
/**This variable gets detected by the error handling system to know how to render it */
|
||||
_ODErrorType = "system"
|
||||
|
||||
/**Create an `ODSystemError` directly from an `Error` class */
|
||||
static fromError(err:Error){
|
||||
err["_ODErrorType"] = "system"
|
||||
return err as ODSystemError
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODPluginError `class`
|
||||
* A wrapper for the node.js `Error` class that makes the error look better in the console!
|
||||
*
|
||||
* This wrapper is made for Open Ticket plugin errors! **It can only be used by plugins!**
|
||||
*/
|
||||
export class ODPluginError extends Error {
|
||||
/**This variable gets detected by the error handling system to know how to render it */
|
||||
_ODErrorType = "plugin"
|
||||
|
||||
/**Create an `ODPluginError` directly from an `Error` class */
|
||||
static fromError(err:Error){
|
||||
err["_ODErrorType"] = "plugin"
|
||||
return err as ODPluginError
|
||||
}
|
||||
}
|
||||
|
||||
/**Oh, what could this be `¯\_(ツ)_/¯` */
|
||||
export interface ODEasterEggs {
|
||||
creator:string,
|
||||
translators:string[]
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,58 +0,0 @@
|
||||
///////////////////////////////////////
|
||||
//CODE MODULE
|
||||
///////////////////////////////////////
|
||||
import { ODId, ODManager, ODManagerData, ODValidId } from "./base"
|
||||
import { ODDebugger } from "./console"
|
||||
|
||||
|
||||
/**## ODCode `class`
|
||||
* This is an Open Ticket code runner.
|
||||
*
|
||||
* Using this, you're able to execute a function just before the startup screen. (90% of the code is already loaded)
|
||||
* You can also specify a priority to change the execution order.
|
||||
* In Open Ticket, this is used for the following processes:
|
||||
* - Autoclose/delete
|
||||
* - Database syncronisation (with tickets, stats & used options)
|
||||
* - Panel auto-update
|
||||
* - Database Garbage Collection (removing tickets that don't exist anymore)
|
||||
* - And more!
|
||||
*/
|
||||
export class ODCode extends ODManagerData {
|
||||
/**The priority of this code */
|
||||
priority: number
|
||||
/**The main function of this code */
|
||||
func: () => void|Promise<void>
|
||||
|
||||
constructor(id:ODValidId, priority:number, func:() => void|Promise<void>){
|
||||
super(id)
|
||||
this.priority = priority
|
||||
this.func = func
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODCodeManager `class`
|
||||
* This is an Open Ticket code manager.
|
||||
*
|
||||
* It manages & executes `ODCode`'s in the correct order.
|
||||
*
|
||||
* Use this to register a function/code which executes just before the startup screen. (90% is already loaded)
|
||||
*/
|
||||
export class ODCodeManager extends ODManager<ODCode> {
|
||||
constructor(debug:ODDebugger){
|
||||
super(debug,"code")
|
||||
}
|
||||
|
||||
/**Execute all `ODCode` functions in order of their priority (high to low). */
|
||||
async execute(){
|
||||
const derefArray = [...this.getAll()]
|
||||
const workers = derefArray.sort((a,b) => b.priority-a.priority)
|
||||
|
||||
for (const worker of workers){
|
||||
try {
|
||||
await worker.func()
|
||||
}catch(err){
|
||||
process.emit("uncaughtException",err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,159 +0,0 @@
|
||||
///////////////////////////////////////
|
||||
//CONFIG MODULE
|
||||
///////////////////////////////////////
|
||||
import { ODId, ODManager, ODManagerData, ODPromiseVoid, ODSystemError, ODValidId } from "./base"
|
||||
import nodepath from "path"
|
||||
import { ODDebugger } from "./console"
|
||||
import fs from "fs"
|
||||
import * as fjs from "formatted-json-stringify"
|
||||
|
||||
/**## ODConfigManager `class`
|
||||
* This is an Open Ticket config manager.
|
||||
*
|
||||
* It manages all config files in the bot and allows plugins to access config files from Open Ticket & other plugins!
|
||||
*
|
||||
* You can use this class to get/change/add a config file (`ODConfig`) in your plugin!
|
||||
*/
|
||||
export class ODConfigManager extends ODManager<ODConfig> {
|
||||
/**Alias to Open Ticket debugger. */
|
||||
#debug: ODDebugger
|
||||
|
||||
constructor(debug:ODDebugger){
|
||||
super(debug,"config")
|
||||
this.#debug = debug
|
||||
}
|
||||
add(data:ODConfig|ODConfig[],overwrite?:boolean): boolean {
|
||||
if (Array.isArray(data)) data.forEach((d) => d.useDebug(this.#debug))
|
||||
else data.useDebug(this.#debug)
|
||||
return super.add(data,overwrite)
|
||||
}
|
||||
/**Init all config files. */
|
||||
async init(){
|
||||
for (const config of this.getAll()){
|
||||
try{
|
||||
await config.init()
|
||||
}catch(err){
|
||||
process.emit("uncaughtException",new ODSystemError(err))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODConfig `class`
|
||||
* This is an Open Ticket config helper.
|
||||
* This class doesn't do anything at all, it just gives a template & basic methods for a config. Use `ODJsonConfig` instead!
|
||||
*
|
||||
* You can use this class if you want to create your own config implementation (e.g. `yml`, `xml`,...)!
|
||||
*/
|
||||
export class ODConfig extends ODManagerData {
|
||||
/**The name of the file with extension. */
|
||||
file: string = ""
|
||||
/**The path to the file relative to the main directory. */
|
||||
path: string = ""
|
||||
/**An object/array of the entire config file! Variables inside it can be edited while the bot is running! */
|
||||
data: any
|
||||
/**Is this config already initiated? */
|
||||
initiated: boolean = false
|
||||
/**An array of listeners to run when the config gets reloaded. These are not executed on the initial loading. */
|
||||
protected reloadListeners: Function[] = []
|
||||
/**Alias to Open Ticket debugger. */
|
||||
protected debug: ODDebugger|null = null
|
||||
|
||||
constructor(id:ODValidId, data:any){
|
||||
super(id)
|
||||
this.data = data
|
||||
}
|
||||
|
||||
/**Use the Open Ticket debugger for logs. */
|
||||
useDebug(debug:ODDebugger|null){
|
||||
this.debug = debug
|
||||
}
|
||||
/**Init the config. */
|
||||
init(): ODPromiseVoid {
|
||||
this.initiated = true
|
||||
if (this.debug) this.debug.debug("Initiated config '"+this.file+"' in ODConfigManager.",[{key:"id",value:this.id.value}])
|
||||
//please implement this feature in your own config extension & extend this function.
|
||||
}
|
||||
/**Reload the config. Be aware that this doesn't update the config data everywhere in the bot! */
|
||||
reload(): ODPromiseVoid {
|
||||
if (this.debug) this.debug.debug("Reloaded config '"+this.file+"' in ODConfigManager.",[{key:"id",value:this.id.value}])
|
||||
//please implement this feature in your own config extension & extend this function.
|
||||
}
|
||||
/**Save the edited config to the filesystem. This is used by the Interactive Setup CLI. It's not recommended to use this while the bot is running. */
|
||||
save(): ODPromiseVoid {
|
||||
if (this.debug) this.debug.debug("Saved config '"+this.file+"' in ODConfigManager.",[{key:"id",value:this.id.value}])
|
||||
//please implement this feature in your own config extension & extend this function.
|
||||
}
|
||||
/**Listen for a reload of this JSON file! */
|
||||
onReload(cb:Function){
|
||||
this.reloadListeners.push(cb)
|
||||
}
|
||||
/**Remove all reload listeners. Not recommended! */
|
||||
removeAllReloadListeners(){
|
||||
this.reloadListeners = []
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODJsonConfig `class`
|
||||
* This is an Open Ticket JSON config.
|
||||
* You can use this class to get & edit variables from the config files or to create your own JSON config!
|
||||
* @example
|
||||
* //create a config from: ./config/test.json with the id "some-config"
|
||||
* const config = new api.ODJsonConfig("some-config","test.json")
|
||||
*
|
||||
* //create a config with custom dir: ./plugins/testplugin/test.json
|
||||
* const config = new api.ODJsonConfig("plugin-config","test.json","./plugins/testplugin/")
|
||||
*/
|
||||
export class ODJsonConfig extends ODConfig {
|
||||
formatter: fjs.custom.BaseFormatter
|
||||
|
||||
constructor(id:ODValidId, file:string, customPath?:string, formatter?:fjs.custom.BaseFormatter){
|
||||
super(id,{})
|
||||
this.file = (file.endsWith(".json")) ? file : file+".json"
|
||||
this.path = customPath ? nodepath.join("./",customPath,this.file) : nodepath.join("./config/",this.file)
|
||||
this.formatter = formatter ?? new fjs.DefaultFormatter(null,true," ")
|
||||
}
|
||||
|
||||
/**Init the config. */
|
||||
init(): ODPromiseVoid {
|
||||
if (!fs.existsSync(this.path)) throw new ODSystemError("Unable to parse config \""+nodepath.join("./",this.path)+"\", the file doesn't exist!")
|
||||
try{
|
||||
this.data = JSON.parse(fs.readFileSync(this.path).toString())
|
||||
super.init()
|
||||
}catch(err){
|
||||
process.emit("uncaughtException",err)
|
||||
throw new ODSystemError("Unable to parse config \""+nodepath.join("./",this.path)+"\"!")
|
||||
}
|
||||
}
|
||||
/**Reload the config. Be aware that this doesn't update the config data everywhere in the bot! */
|
||||
reload(){
|
||||
if (!this.initiated) throw new ODSystemError("Unable to reload config \""+nodepath.join("./",this.path)+"\", the file hasn't been initiated yet!")
|
||||
if (!fs.existsSync(this.path)) throw new ODSystemError("Unable to reload config \""+nodepath.join("./",this.path)+"\", the file doesn't exist!")
|
||||
try{
|
||||
this.data = JSON.parse(fs.readFileSync(this.path).toString())
|
||||
super.reload()
|
||||
this.reloadListeners.forEach((cb) => {
|
||||
try{
|
||||
cb()
|
||||
}catch(err){
|
||||
process.emit("uncaughtException",err)
|
||||
}
|
||||
})
|
||||
}catch(err){
|
||||
process.emit("uncaughtException",err)
|
||||
throw new ODSystemError("Unable to reload config \""+nodepath.join("./",this.path)+"\"!")
|
||||
}
|
||||
}
|
||||
/**Save the edited config to the filesystem. This is used by the Interactive Setup CLI. It's not recommended to use this while the bot is running. */
|
||||
save(): ODPromiseVoid {
|
||||
if (!this.initiated) throw new ODSystemError("Unable to save config \""+nodepath.join("./",this.path)+"\", the file hasn't been initiated yet!")
|
||||
try{
|
||||
const contents = this.formatter.stringify(this.data)
|
||||
fs.writeFileSync(this.path,contents)
|
||||
super.save()
|
||||
}catch(err){
|
||||
process.emit("uncaughtException",err)
|
||||
throw new ODSystemError("Unable to save config \""+nodepath.join("./",this.path)+"\"!")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,665 +0,0 @@
|
||||
///////////////////////////////////////
|
||||
//CONSOLE MODULE
|
||||
///////////////////////////////////////
|
||||
import { ODHTTPGetRequest, ODVersion, ODSystemError, ODPluginError, ODManager, ODManagerData, ODValidId } from "./base"
|
||||
import { ODMain } from "../main"
|
||||
import nodepath from "path"
|
||||
import fs from "fs"
|
||||
import ansis from "ansis"
|
||||
|
||||
/**## ODValidConsoleColor `type`
|
||||
* This is a collection of all the supported console colors within Open Ticket.
|
||||
*/
|
||||
export type ODValidConsoleColor = "white"|"red"|"yellow"|"green"|"blue"|"gray"|"cyan"|"magenta"
|
||||
|
||||
/**## ODConsoleMessageParam `type`
|
||||
* This interface contains all data required for a console log parameter within Open Ticket.
|
||||
*/
|
||||
export interface ODConsoleMessageParam {
|
||||
/**The key of this parameter. */
|
||||
key:string,
|
||||
/**The value of this parameter. */
|
||||
value:string,
|
||||
/**When enabled, this parameter will only be shown in the debug file. */
|
||||
hidden?:boolean
|
||||
}
|
||||
|
||||
/**## ODConsoleMessage `class`
|
||||
* This is an Open Ticket console message.
|
||||
*
|
||||
* It is used to create beautiful & styled logs in the console with a prefix, message & parameters.
|
||||
* It also has full color support using `ansis` and parameters are parsed for you!
|
||||
*/
|
||||
export class ODConsoleMessage {
|
||||
/**The main message sent in the console */
|
||||
message: string
|
||||
/**An array of all the parameters in this message */
|
||||
params: ODConsoleMessageParam[]
|
||||
/**The prefix of this message (!uppercase recommended!) */
|
||||
prefix: string
|
||||
/**The color of the prefix of this message */
|
||||
color: ODValidConsoleColor
|
||||
|
||||
constructor(message:string, prefix:string, color:ODValidConsoleColor, params?:ODConsoleMessageParam[]){
|
||||
this.message = message
|
||||
this.params = params ? params : []
|
||||
this.prefix = prefix
|
||||
|
||||
if (["white","red","yellow","green","blue","gray","cyan","magenta"].includes(color)){
|
||||
this.color = color
|
||||
}else{
|
||||
this.color = "white"
|
||||
}
|
||||
}
|
||||
/**Render this message to the console using `console.log`! Returns `false` when something went wrong. */
|
||||
render(){
|
||||
try {
|
||||
const prefixcolor = ansis[this.color]
|
||||
|
||||
const paramsstring = " "+this.createParamsString("gray")
|
||||
const message = prefixcolor("["+this.prefix+"] ")+this.message
|
||||
|
||||
console.log(message+paramsstring)
|
||||
return true
|
||||
}catch{
|
||||
return false
|
||||
}
|
||||
}
|
||||
/**Create a more-detailed, non-colored version of this message to store it in the `otdebug.txt` file! */
|
||||
toDebugString(){
|
||||
const pstrings: string[] = []
|
||||
this.params.forEach((p) => {
|
||||
pstrings.push(p.key+": "+p.value)
|
||||
})
|
||||
const pstring = (pstrings.length > 0) ? " ("+pstrings.join(", ")+")" : ""
|
||||
const date = new Date()
|
||||
const dstring = `${date.getDate()}/${date.getMonth()+1}/${date.getFullYear()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`
|
||||
return `[${dstring} ${this.prefix}] ${this.message}${pstring}`
|
||||
}
|
||||
/**Render the parameters of this message in a specific color. */
|
||||
createParamsString(color:ODValidConsoleColor){
|
||||
let validcolor: ODValidConsoleColor = "white"
|
||||
if (["white","red","yellow","green","blue","gray","cyan","magenta"].includes(color)){
|
||||
validcolor = color
|
||||
}
|
||||
|
||||
const pstrings: string[] = []
|
||||
this.params.forEach((p) => {
|
||||
if (!p.hidden) pstrings.push(p.key+": "+p.value)
|
||||
})
|
||||
|
||||
return (pstrings.length > 0) ? ansis[validcolor](" ("+pstrings.join(", ")+")") : ""
|
||||
}
|
||||
/**Set the message */
|
||||
setMessage(message:string){
|
||||
this.message = message
|
||||
return this
|
||||
}
|
||||
/**Set the params */
|
||||
setParams(params:ODConsoleMessageParam[]){
|
||||
this.params = params
|
||||
return this
|
||||
}
|
||||
/**Set the prefix */
|
||||
setPrefix(prefix:string){
|
||||
this.prefix = prefix
|
||||
return this
|
||||
}
|
||||
/**Set the prefix color */
|
||||
setColor(color:ODValidConsoleColor){
|
||||
if (["white","red","yellow","green","blue","gray","cyan","magenta"].includes(color)){
|
||||
this.color = color
|
||||
}else{
|
||||
this.color = "white"
|
||||
}
|
||||
return this
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODConsoleInfoMessage `class`
|
||||
* This is an Open Ticket console info message.
|
||||
*
|
||||
* It is the same as a normal `ODConsoleMessage`, but it has a predefined prefix & color scheme for the "INFO" messages!
|
||||
*/
|
||||
export class ODConsoleInfoMessage extends ODConsoleMessage {
|
||||
constructor(message:string,params?:ODConsoleMessageParam[]){
|
||||
super(message,"INFO","blue",params)
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODConsoleSystemMessage `class`
|
||||
* This is an Open Ticket console system message.
|
||||
*
|
||||
* It is the same as a normal `ODConsoleMessage`, but it has a predefined prefix & color scheme for the "SYSTEM" messages!
|
||||
*/
|
||||
export class ODConsoleSystemMessage extends ODConsoleMessage {
|
||||
constructor(message:string,params?:ODConsoleMessageParam[]){
|
||||
super(message,"SYSTEM","green",params)
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODConsolePluginMessage `class`
|
||||
* This is an Open Ticket console plugin message.
|
||||
*
|
||||
* It is the same as a normal `ODConsoleMessage`, but it has a predefined prefix & color scheme for the "PLUGIN" messages!
|
||||
*/
|
||||
export class ODConsolePluginMessage extends ODConsoleMessage {
|
||||
constructor(message:string,params?:ODConsoleMessageParam[]){
|
||||
super(message,"PLUGIN","magenta",params)
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODConsoleDebugMessage `class`
|
||||
* This is an Open Ticket console debug message.
|
||||
*
|
||||
* It is the same as a normal `ODConsoleMessage`, but it has a predefined prefix & color scheme for the "DEBUG" messages!
|
||||
*/
|
||||
export class ODConsoleDebugMessage extends ODConsoleMessage {
|
||||
constructor(message:string,params?:ODConsoleMessageParam[]){
|
||||
super(message,"DEBUG","cyan",params)
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODConsoleWarningMessage `class`
|
||||
* This is an Open Ticket console warning message.
|
||||
*
|
||||
* It is the same as a normal `ODConsoleMessage`, but it has a predefined prefix & color scheme for the "WARNING" messages!
|
||||
*/
|
||||
export class ODConsoleWarningMessage extends ODConsoleMessage {
|
||||
constructor(message:string,params?:ODConsoleMessageParam[]){
|
||||
super(message,"WARNING","yellow",params)
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODConsoleErrorMessage `class`
|
||||
* This is an Open Ticket console error message.
|
||||
*
|
||||
* It is the same as a normal `ODConsoleMessage`, but it has a predefined prefix & color scheme for the "ERROR" messages!
|
||||
*/
|
||||
export class ODConsoleErrorMessage extends ODConsoleMessage {
|
||||
constructor(message:string,params?:ODConsoleMessageParam[]){
|
||||
super(message,"ERROR","red",params)
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODError `class`
|
||||
* This is an Open Ticket error.
|
||||
*
|
||||
* It is used to render and log Node.js errors & crashes in a styled way to the console & `otdebug.txt` file!
|
||||
*/
|
||||
export class ODError {
|
||||
/**The original error that this class wraps around */
|
||||
error: Error|ODSystemError|ODPluginError
|
||||
/**The origin of the original error */
|
||||
origin: NodeJS.UncaughtExceptionOrigin
|
||||
|
||||
constructor(error:Error|ODSystemError|ODPluginError, origin:NodeJS.UncaughtExceptionOrigin){
|
||||
this.error = error
|
||||
this.origin = origin
|
||||
}
|
||||
|
||||
/**Render this error to the console using `console.log`! Returns `false` when something went wrong. */
|
||||
render(){
|
||||
try {
|
||||
let prefix = (this.error["_ODErrorType"] == "plugin") ? "PLUGIN ERROR" : ((this.error["_ODErrorType"] == "system") ? "OPENTICKET ERROR" : "UNKNOWN ERROR")
|
||||
//title
|
||||
console.log(ansis.red("["+prefix+"]: ")+this.error.message+" | origin: "+this.origin)
|
||||
//stack trace
|
||||
if (this.error.stack) console.log(ansis.gray(this.error.stack))
|
||||
//additional message
|
||||
if (this.error["_ODErrorType"] == "plugin") console.log(ansis.red.bold("\nPlease report this error to the plugin developer and help us create a more stable plugin!"))
|
||||
else console.log(ansis.red.bold("\nPlease report this error to our discord server and help us create a more stable ticket bot!"))
|
||||
console.log(ansis.red("Also send the "+ansis.cyan.bold("otdebug.txt")+" file! It would help a lot!\n"))
|
||||
return true
|
||||
}catch{
|
||||
return false
|
||||
}
|
||||
}
|
||||
/**Create a more-detailed, non-colored version of this error to store it in the `otdebug.txt` file! */
|
||||
toDebugString(){
|
||||
return "[UNKNOWN OD ERROR]: "+this.error.message+" | origin: "+this.origin+"\n"+this.error.stack
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODConsoleMessageTypes `type`
|
||||
* This is a collection of all the default console message types within Open Ticket.
|
||||
*/
|
||||
export type ODConsoleMessageTypes = "info"|"system"|"plugin"|"debug"|"warning"|"error"
|
||||
|
||||
/**## ODConsoleManager `class`
|
||||
* This is the Open Ticket console manager.
|
||||
*
|
||||
* It handles the entire console system of Open Ticket. It's also the place where you need to log `ODConsoleMessage`'s.
|
||||
* This manager keeps a short history of messages sent to the console which is configurable by plugins.
|
||||
*
|
||||
* The debug file (`otdebug.txt`) is handled in a sub-manager!
|
||||
*/
|
||||
export class ODConsoleManager {
|
||||
/**The history of `ODConsoleMessage`'s and `ODError`'s since startup */
|
||||
history: (ODConsoleMessage|ODError)[] = []
|
||||
/**The max length of the history. The oldest messages will be removed when over the limit */
|
||||
historylength = 100
|
||||
/**An alias to the debugfile manager. (`otdebug.txt`) */
|
||||
debugfile: ODDebugFileManager
|
||||
/**Is silent mode enabled? */
|
||||
silent: boolean = false
|
||||
|
||||
constructor(historylength:number, debugfile:ODDebugFileManager){
|
||||
this.historylength = historylength
|
||||
this.debugfile = debugfile
|
||||
}
|
||||
|
||||
/**Log a message to the console ... But in the Open Ticket way :) */
|
||||
log(message:ODConsoleMessage): void
|
||||
log(message:ODError): void
|
||||
log(message:string, type?:ODConsoleMessageTypes, params?:ODConsoleMessageParam[]): void
|
||||
log(message:ODConsoleMessage|ODError|string, type?:ODConsoleMessageTypes, params?:ODConsoleMessageParam[]){
|
||||
if (message instanceof ODConsoleMessage){
|
||||
if (!this.silent) message.render()
|
||||
if (this.debugfile) this.debugfile.writeConsoleMessage(message)
|
||||
this.history.push(message)
|
||||
|
||||
}else if (message instanceof ODError){
|
||||
if (!this.silent) message.render()
|
||||
if (this.debugfile) this.debugfile.writeErrorMessage(message)
|
||||
this.history.push(message)
|
||||
|
||||
}else if (["string","number","boolean","object"].includes(typeof message)){
|
||||
let newMessage: ODConsoleMessage
|
||||
if (type == "info") newMessage = new ODConsoleInfoMessage(message,params)
|
||||
else if (type == "system") newMessage = new ODConsoleSystemMessage(message,params)
|
||||
else if (type == "plugin") newMessage = new ODConsolePluginMessage(message,params)
|
||||
else if (type == "debug") newMessage = new ODConsoleDebugMessage(message,params)
|
||||
else if (type == "warning") newMessage = new ODConsoleWarningMessage(message,params)
|
||||
else if (type == "error") newMessage = new ODConsoleErrorMessage(message,params)
|
||||
else newMessage = new ODConsoleSystemMessage(message,params)
|
||||
|
||||
if (!this.silent) newMessage.render()
|
||||
if (this.debugfile) this.debugfile.writeConsoleMessage(newMessage)
|
||||
this.history.push(newMessage)
|
||||
}
|
||||
this.#purgeHistory()
|
||||
}
|
||||
/**Shorten the history when it exceeds the max history length! */
|
||||
#purgeHistory(){
|
||||
if (this.history.length > this.historylength) this.history.shift()
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODDebugFileManager `class`
|
||||
* This is the Open Ticket debug file manager.
|
||||
*
|
||||
* It manages the Open Ticket debug file (`otdebug.txt`) which keeps a history of all system logs.
|
||||
* There are even internal logs that aren't logged to the console which are available in this file!
|
||||
*
|
||||
* Using this class, you can change the max length of this file and some other cool things!
|
||||
*/
|
||||
export class ODDebugFileManager {
|
||||
/**The path to the debugfile (`./otdebug.txt` by default) */
|
||||
path: string
|
||||
/**The filename of the debugfile (`otdebug.txt` by default) */
|
||||
filename: string
|
||||
/**The current version of the bot used in the debug file. */
|
||||
version: ODVersion
|
||||
/**The max length of the debug file. */
|
||||
maxlines: number
|
||||
|
||||
constructor(path:string, filename:string, maxlines:number, version:ODVersion){
|
||||
this.path = nodepath.join(path,filename)
|
||||
this.filename = filename
|
||||
this.version = version
|
||||
this.maxlines = maxlines
|
||||
|
||||
this.#writeStartupStats()
|
||||
}
|
||||
|
||||
/**Check if the debug file exists */
|
||||
#existsDebugFile(){
|
||||
return fs.existsSync(this.path)
|
||||
}
|
||||
/**Read from the debug file */
|
||||
#readDebugFile(){
|
||||
if (this.#existsDebugFile()){
|
||||
try {
|
||||
return fs.readFileSync(this.path).toString()
|
||||
}catch{
|
||||
return false
|
||||
}
|
||||
}else{
|
||||
return false
|
||||
}
|
||||
}
|
||||
/**Write to the debug file and shorten it when needed. */
|
||||
#writeDebugFile(text:string){
|
||||
const currenttext = this.#readDebugFile()
|
||||
if (currenttext){
|
||||
const splitted = currenttext.split("\n")
|
||||
|
||||
if (splitted.length+text.split("\n").length > this.maxlines){
|
||||
splitted.splice(7,(text.split("\n").length))
|
||||
}
|
||||
|
||||
splitted.push(text)
|
||||
fs.writeFileSync(this.path,splitted.join("\n"))
|
||||
}else{
|
||||
//write new file:
|
||||
const newtext = this.#createStatsText()+text
|
||||
fs.writeFileSync(this.path,newtext)
|
||||
}
|
||||
}
|
||||
/**Generate the stats/header of the debug file (containing the version) */
|
||||
#createStatsText(){
|
||||
const date = new Date()
|
||||
const dstring = `${date.getDate()}/${date.getMonth()+1}/${date.getFullYear()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`
|
||||
return [
|
||||
"=========================",
|
||||
"OPEN TICKET DEBUG FILE:",
|
||||
"version: "+this.version.toString(),
|
||||
"last startup: "+dstring,
|
||||
"=========================\n\n"
|
||||
].join("\n")
|
||||
}
|
||||
/**Write the stats/header to the debug file on startup */
|
||||
#writeStartupStats(){
|
||||
const currenttext = this.#readDebugFile()
|
||||
if (currenttext){
|
||||
//edit previous file:
|
||||
const splitted = currenttext.split("\n")
|
||||
splitted.splice(0,7)
|
||||
|
||||
if (splitted.length+11 > this.maxlines){
|
||||
splitted.splice(0,((splitted.length+11) - this.maxlines))
|
||||
}
|
||||
|
||||
splitted.unshift(this.#createStatsText())
|
||||
splitted.push("\n---------------------------------------------------------------------\n---------------------------------------------------------------------\n")
|
||||
|
||||
fs.writeFileSync(this.path,splitted.join("\n"))
|
||||
}else{
|
||||
//write new file:
|
||||
const newtext = this.#createStatsText()
|
||||
fs.writeFileSync(this.path,newtext)
|
||||
}
|
||||
}
|
||||
/**Write an `ODConsoleMessage` to the debug file */
|
||||
writeConsoleMessage(message:ODConsoleMessage){
|
||||
this.#writeDebugFile(message.toDebugString())
|
||||
}
|
||||
/**Write an `ODError` to the debug file */
|
||||
writeErrorMessage(error:ODError){
|
||||
this.#writeDebugFile(error.toDebugString())
|
||||
}
|
||||
/**Write custom text to the debug file */
|
||||
writeText(text:string){
|
||||
this.#writeDebugFile(text)
|
||||
}
|
||||
/**Write a custom note to the debug file (starting with `[NOTE]:`) */
|
||||
writeNote(text:string){
|
||||
this.#writeDebugFile("[NOTE]: "+text)
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODDebugger `class`
|
||||
* This is the Open Ticket debugger.
|
||||
*
|
||||
* It is a simple wrapper around the `ODConsoleManager` to handle debugging (primarily for `ODManagers`).
|
||||
* Messages created using this debugger are only logged to the debug file unless specified otherwise.
|
||||
*
|
||||
* You will probably notice this class being used in the `ODManager` constructor.
|
||||
*
|
||||
* Using this system, all additions & removals inside a manager are logged to the debug file. This makes searching for errors a lot easier!
|
||||
*/
|
||||
export class ODDebugger {
|
||||
/**An alias to the Open Ticket console manager. */
|
||||
console: ODConsoleManager
|
||||
/**When enabled, debug logs are also shown in the console. */
|
||||
visible: boolean = false
|
||||
|
||||
constructor(console:ODConsoleManager){
|
||||
this.console = console
|
||||
}
|
||||
|
||||
/**Create a debug message. This will always be logged to `otdebug.txt` & sometimes to the console (when enabled). Returns `true` when visible */
|
||||
debug(message:string, params?:{key:string,value:string}[]): boolean {
|
||||
if (this.visible){
|
||||
this.console.log(new ODConsoleDebugMessage(message,params))
|
||||
return true
|
||||
}else{
|
||||
this.console.debugfile.writeConsoleMessage(new ODConsoleDebugMessage(message,params))
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODLivestatusColor `type`
|
||||
* This is a collection of all the colors available within the LiveStatus system.
|
||||
*/
|
||||
export type ODLiveStatusColor = "normal"|"red"|"green"|"blue"|"yellow"|"white"|"gray"|"magenta"|"cyan"
|
||||
|
||||
/**## ODLiveStatusSourceData `interface`
|
||||
* This is an interface containing all raw data received from the LiveStatus system.
|
||||
*/
|
||||
export interface ODLiveStatusSourceData {
|
||||
/**The message to display */
|
||||
message:{
|
||||
/**The title of the message to display */
|
||||
title:string,
|
||||
/**The title color of the message to display */
|
||||
titleColor:ODLiveStatusColor,
|
||||
/**The description of the message to display */
|
||||
description:string,
|
||||
/**The description color of the message to display */
|
||||
descriptionColor:ODLiveStatusColor
|
||||
},
|
||||
/**The message will only be shown when the bot matches all statements */
|
||||
active:{
|
||||
/**A list of versions to match */
|
||||
versions:string[],
|
||||
/**A list of languages to match */
|
||||
languages:string[],
|
||||
/**All languages should match */
|
||||
allLanguages:boolean,
|
||||
/**Match when the bot is using plugins */
|
||||
usingPlugins:boolean,
|
||||
/**Match when the bot is not using plugins */
|
||||
notUsingPlugins:boolean,
|
||||
/**Match when the bot is using slash commands */
|
||||
usingSlashCommands:boolean,
|
||||
/**Match when the bot is not using slash commands */
|
||||
notUsingSlashCommands:boolean,
|
||||
/**Match when the bot is not using transcripts */
|
||||
notUsingTranscripts:boolean,
|
||||
/**Match when the bot is using text transcripts */
|
||||
usingTextTranscripts:boolean,
|
||||
/**Match when the bot is using html transcripts */
|
||||
usingHtmlTranscripts:boolean
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODLiveStatusSource `class`
|
||||
* This is the Open Ticket livestatus source.
|
||||
*
|
||||
* It is an empty template for a livestatus source.
|
||||
* By default, you should use `ODLiveStatusUrlSource` or `ODLiveStatusFileSource`,
|
||||
* unless you want to create one on your own!
|
||||
*
|
||||
* This class doesn't do anything on it's own! It's just a template!
|
||||
*/
|
||||
export class ODLiveStatusSource extends ODManagerData {
|
||||
/**The raw data of this source */
|
||||
data: ODLiveStatusSourceData[]
|
||||
|
||||
constructor(id:ODValidId, data:ODLiveStatusSourceData[]){
|
||||
super(id)
|
||||
this.data = data
|
||||
}
|
||||
|
||||
/**Change the current data using this method! */
|
||||
setData(data:ODLiveStatusSourceData[]){
|
||||
this.data = data
|
||||
}
|
||||
/**Get all messages relevant to the bot based on some parameters. */
|
||||
async getMessages(main:ODMain): Promise<ODLiveStatusSourceData[]> {
|
||||
const validMessages: ODLiveStatusSourceData[] = []
|
||||
|
||||
//parse data from ODMain
|
||||
const currentVersion: string = main.versions.get("opendiscord:version").toString(true)
|
||||
const usingSlashCommands: boolean = main.configs.get("opendiscord:general").data.slashCommands
|
||||
const usingTranscripts: false|"text"|"html" = false as false|"text"|"html" //TODO
|
||||
const currentLanguage: string = main.languages.getCurrentLanguageId()
|
||||
const usingPlugins: boolean = (main.plugins.getLength() > 0)
|
||||
|
||||
//check data for each message
|
||||
this.data.forEach((msg) => {
|
||||
const {active} = msg
|
||||
|
||||
const correctVersion = active.versions.includes(currentVersion)
|
||||
const correctSlashMode = (usingSlashCommands && active.usingSlashCommands) || (!usingSlashCommands && active.notUsingSlashCommands)
|
||||
const correctTranscriptMode = (usingTranscripts == "text" && active.usingTextTranscripts) || (usingTranscripts == "html" && active.usingHtmlTranscripts) || (!usingTranscripts && active.notUsingTranscripts)
|
||||
const correctLanguage = active.languages.includes(currentLanguage) || active.allLanguages
|
||||
const correctPlugins = (usingPlugins && active.usingPlugins) || (!usingPlugins && active.notUsingPlugins)
|
||||
|
||||
if (correctVersion && correctLanguage && correctPlugins && correctSlashMode && correctTranscriptMode) validMessages.push(msg)
|
||||
})
|
||||
|
||||
//return the valid messages
|
||||
return validMessages
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODLiveStatusFileSource `class`
|
||||
* This is the Open Ticket livestatus file source.
|
||||
*
|
||||
* It is a LiveStatus source that will read the data from a local file.
|
||||
*
|
||||
* This can be used for testing/extending the LiveStatus system!
|
||||
*/
|
||||
export class ODLiveStatusFileSource extends ODLiveStatusSource {
|
||||
/**The path to the source file */
|
||||
path: string
|
||||
|
||||
constructor(id:ODValidId, path:string){
|
||||
if (fs.existsSync(path)){
|
||||
super(id,JSON.parse(fs.readFileSync(path).toString()))
|
||||
}else throw new ODSystemError("LiveStatus source file doesn't exist!")
|
||||
this.path = path
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODLiveStatusUrlSource `class`
|
||||
* This is the Open Ticket livestatus url source.
|
||||
*
|
||||
* It is a LiveStatus source that will read the data from a http URL (json file).
|
||||
*
|
||||
* This is the default way of receiving LiveStatus messages!
|
||||
*/
|
||||
export class ODLiveStatusUrlSource extends ODLiveStatusSource {
|
||||
/**The url used in the request */
|
||||
url: string
|
||||
/**The `ODHTTPGetRequest` helper to fetch the url! */
|
||||
request: ODHTTPGetRequest
|
||||
|
||||
constructor(id:ODValidId, url:string){
|
||||
super(id,[])
|
||||
this.url = url
|
||||
this.request = new ODHTTPGetRequest(url,false)
|
||||
}
|
||||
async getMessages(main:ODMain): Promise<ODLiveStatusSourceData[]> {
|
||||
//additional setup
|
||||
this.request.url = this.url
|
||||
const rawRes = await this.request.run()
|
||||
if (rawRes.status != 200) throw new ODSystemError("ODLiveStatusUrlSource => Request Failed!")
|
||||
try{
|
||||
this.setData(JSON.parse(rawRes.body))
|
||||
}catch{
|
||||
throw new ODSystemError("ODLiveStatusUrlSource => Request Failed!")
|
||||
}
|
||||
|
||||
//default
|
||||
return super.getMessages(main)
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODLiveStatusManager `class`
|
||||
* This is the Open Ticket livestatus manager.
|
||||
*
|
||||
* It manages all LiveStatus sources and has the renderer for all LiveStatus messages.
|
||||
*
|
||||
* You can use this to customise or add stuff to the LiveStatus system.
|
||||
* Access it in the global `opendiscord.startscreen.livestatus` variable!
|
||||
*/
|
||||
export class ODLiveStatusManager extends ODManager<ODLiveStatusSource> {
|
||||
/**The class responsible for rendering the livestatus messages. */
|
||||
renderer: ODLiveStatusRenderer
|
||||
/**A reference to the ODMain or "openticket" global variable */
|
||||
#main: ODMain
|
||||
|
||||
constructor(debug:ODDebugger, main:ODMain){
|
||||
super(debug,"livestatus source")
|
||||
this.renderer = new ODLiveStatusRenderer(main.console)
|
||||
this.#main = main
|
||||
}
|
||||
|
||||
/**Get the messages from all sources combined! */
|
||||
async getAllMessages(): Promise<ODLiveStatusSourceData[]> {
|
||||
const messages: ODLiveStatusSourceData[] = []
|
||||
for (const source of this.getAll()){
|
||||
try {
|
||||
messages.push(...(await source.getMessages(this.#main)))
|
||||
}catch{}
|
||||
}
|
||||
return messages
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODLiveStatusRenderer `class`
|
||||
* This is the Open Ticket livestatus renderer.
|
||||
*
|
||||
* It's responsible for rendering all LiveStatus messages to the console.
|
||||
*/
|
||||
export class ODLiveStatusRenderer {
|
||||
/**A reference to the ODConsoleManager or "opendiscord.console" global variable */
|
||||
#console: ODConsoleManager
|
||||
|
||||
constructor(console:ODConsoleManager){
|
||||
this.#console = console
|
||||
}
|
||||
|
||||
/**Render all messages */
|
||||
render(messages:ODLiveStatusSourceData[]): string {
|
||||
try {
|
||||
//process data
|
||||
const final: string[] = []
|
||||
messages.forEach((msg) => {
|
||||
const titleColor = msg.message.titleColor
|
||||
const title = "["+msg.message.title+"] "
|
||||
|
||||
const descriptionColor = msg.message.descriptionColor
|
||||
const description = msg.message.description.split("\n").map((text,row) => {
|
||||
//first row row doesn't need prefix
|
||||
if (row < 1) return text
|
||||
//other rows do need a prefix
|
||||
let text2 = text
|
||||
for (const i of title){
|
||||
text2 = " "+text2
|
||||
}
|
||||
return text2
|
||||
}).join("\n")
|
||||
|
||||
|
||||
if (!["red","yellow","green","blue","gray","magenta","cyan"].includes(titleColor)) var finalTitle = ansis.white(title)
|
||||
else var finalTitle = ansis[titleColor](title)
|
||||
if (!["red","yellow","green","blue","gray","magenta","cyan"].includes(descriptionColor)) var finalDescription = ansis.white(description)
|
||||
else var finalDescription = ansis[descriptionColor](description)
|
||||
|
||||
final.push(finalTitle+finalDescription)
|
||||
})
|
||||
|
||||
//return all messages
|
||||
return final.join("\n")
|
||||
}catch{
|
||||
this.#console.log("Failed to render LiveStatus messages!","error")
|
||||
return ""
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,348 +0,0 @@
|
||||
///////////////////////////////////////
|
||||
//COOLDOWN MODULE
|
||||
///////////////////////////////////////
|
||||
import { ODId, ODValidId, ODManager, ODSystemError, ODManagerData } from "./base"
|
||||
import { ODDebugger } from "./console"
|
||||
|
||||
/**## ODCooldownManager `class`
|
||||
* This is an Open Ticket cooldown manager.
|
||||
*
|
||||
* It is responsible for managing all cooldowns in Open Ticket. An example of this is the ticket creation cooldown.
|
||||
*
|
||||
* There are many types of cooldowns available, but you can also create your own!
|
||||
*/
|
||||
export class ODCooldownManager extends ODManager<ODCooldown<object>> {
|
||||
constructor(debug:ODDebugger){
|
||||
super(debug,"cooldown")
|
||||
}
|
||||
/**Initiate all cooldowns in this manager. */
|
||||
async init(){
|
||||
for (const cooldown of this.getAll()){
|
||||
await cooldown.init()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODCooldownData `class`
|
||||
* This is Open Ticket cooldown data.
|
||||
*
|
||||
* It contains the instance of an active cooldown (e.g. for a user). It is handled by the cooldown itself.
|
||||
*/
|
||||
export class ODCooldownData<Data extends object> extends ODManagerData {
|
||||
/**Is this cooldown active? */
|
||||
active: boolean
|
||||
/**Additional data of this cooldown instance. (different for each cooldown type) */
|
||||
data: Data
|
||||
|
||||
constructor(id:ODValidId,active:boolean,data:Data){
|
||||
super(id)
|
||||
this.active = active
|
||||
this.data = data
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODCooldown `class`
|
||||
* This is an Open Ticket cooldown.
|
||||
*
|
||||
* It doesn't do anything on it's own, but it provides the methods that are used to interact with a cooldown.
|
||||
* This class can be extended from to create a working cooldown.
|
||||
*
|
||||
* There are also premade cooldowns available in the bot!
|
||||
*/
|
||||
export class ODCooldown<Data extends object> extends ODManagerData {
|
||||
data: ODManager<ODCooldownData<Data>> = new ODManager()
|
||||
/**Is this cooldown already initialized? */
|
||||
ready: boolean = false
|
||||
|
||||
constructor(id:ODValidId){
|
||||
super(id)
|
||||
}
|
||||
|
||||
/**Check this id and start cooldown when it exeeds the limit! Returns `true` when on cooldown! */
|
||||
use(id:string): boolean {
|
||||
throw new ODSystemError("Tried to use an unimplemented ODCooldown!")
|
||||
}
|
||||
/**Check this id without starting or updating the cooldown. Returns `true` when on cooldown! */
|
||||
check(id:string): boolean {
|
||||
throw new ODSystemError("Tried to use an unimplemented ODCooldown!")
|
||||
}
|
||||
/**Remove the cooldown for an id when available.*/
|
||||
delete(id:string){
|
||||
throw new ODSystemError("Tried to use an unimplemented ODCooldown!")
|
||||
}
|
||||
/**Initialize the internal systems of this cooldown. */
|
||||
async init(){
|
||||
throw new ODSystemError("Tried to use an unimplemented ODCooldown!")
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODCounterCooldown `class`
|
||||
* This is an Open Ticket counter cooldown.
|
||||
*
|
||||
* It is is a cooldown based on a counter. When the number exceeds the limit, the cooldown is activated.
|
||||
* The number will automatically be decreased with a set amount & interval.
|
||||
*/
|
||||
export class ODCounterCooldown extends ODCooldown<{value:number}> {
|
||||
/**The cooldown will activate when exceeding this limit. */
|
||||
activeLimit: number
|
||||
/**The cooldown will deactivate when below this limit. */
|
||||
cancelLimit: number
|
||||
/**The amount to increase the counter with everytime the cooldown is triggered/updated. */
|
||||
increment: number
|
||||
/**The amount to decrease the counter over time. */
|
||||
decrement: number
|
||||
/**The interval between decrements in milliseconds. */
|
||||
invervalMs: number
|
||||
|
||||
constructor(id:ODValidId, activeLimit:number, cancelLimit:number, increment:number, decrement:number, intervalMs:number){
|
||||
super(id)
|
||||
this.activeLimit = activeLimit
|
||||
this.cancelLimit = cancelLimit
|
||||
this.increment = increment
|
||||
this.decrement = decrement
|
||||
this.invervalMs = intervalMs
|
||||
}
|
||||
|
||||
use(id:string): boolean {
|
||||
const cooldown = this.data.get(id)
|
||||
if (cooldown){
|
||||
//cooldown for this id already exists
|
||||
if (cooldown.active){
|
||||
return true
|
||||
|
||||
}else if (cooldown.data.value < this.activeLimit){
|
||||
cooldown.data.value = cooldown.data.value + this.increment
|
||||
return false
|
||||
|
||||
}else{
|
||||
cooldown.active = true
|
||||
return false
|
||||
}
|
||||
}else{
|
||||
//cooldown for this id doesn't exist
|
||||
this.data.add(new ODCooldownData(id,(this.increment >= this.activeLimit),{
|
||||
value:this.increment
|
||||
}))
|
||||
return false
|
||||
}
|
||||
}
|
||||
check(id:string): boolean {
|
||||
const cooldown = this.data.get(id)
|
||||
if (cooldown){
|
||||
//cooldown for this id already exists
|
||||
return cooldown.active
|
||||
}else return false
|
||||
}
|
||||
delete(id:string): void {
|
||||
this.data.remove(id)
|
||||
}
|
||||
async init(){
|
||||
if (this.ready) return
|
||||
setInterval(async () => {
|
||||
await this.data.loopAll((cooldown) => {
|
||||
cooldown.data.value = cooldown.data.value - this.decrement
|
||||
if (cooldown.data.value <= this.cancelLimit){
|
||||
cooldown.active = false
|
||||
}
|
||||
if (cooldown.data.value <= 0){
|
||||
this.data.remove(cooldown.id)
|
||||
}
|
||||
})
|
||||
},this.invervalMs)
|
||||
this.ready = true
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODIncrementalCounterCooldown `class`
|
||||
* This is an Open Ticket incremental counter cooldown.
|
||||
*
|
||||
* It is is a cooldown based on an incremental counter. It is exactly the same as the normal counter,
|
||||
* with the only difference being that it still increments when the limit is already exeeded.
|
||||
*/
|
||||
export class ODIncrementalCounterCooldown extends ODCooldown<{value:number}> {
|
||||
/**The cooldown will activate when exceeding this limit. */
|
||||
activeLimit: number
|
||||
/**The cooldown will deactivate when below this limit. */
|
||||
cancelLimit: number
|
||||
/**The amount to increase the counter with everytime the cooldown is triggered/updated. */
|
||||
increment: number
|
||||
/**The amount to decrease the counter over time. */
|
||||
decrement: number
|
||||
/**The interval between decrements in milliseconds. */
|
||||
invervalMs: number
|
||||
|
||||
constructor(id:ODValidId, activeLimit:number, cancelLimit:number, increment:number, decrement:number, intervalMs:number){
|
||||
super(id)
|
||||
this.activeLimit = activeLimit
|
||||
this.cancelLimit = cancelLimit
|
||||
this.increment = increment
|
||||
this.decrement = decrement
|
||||
this.invervalMs = intervalMs
|
||||
}
|
||||
|
||||
use(id:string): boolean {
|
||||
const cooldown = this.data.get(id)
|
||||
if (cooldown){
|
||||
//cooldown for this id already exists
|
||||
if (cooldown.active){
|
||||
cooldown.data.value = cooldown.data.value + this.increment
|
||||
return true
|
||||
|
||||
}else if (cooldown.data.value < this.activeLimit){
|
||||
cooldown.data.value = cooldown.data.value + this.increment
|
||||
return false
|
||||
|
||||
}else{
|
||||
cooldown.active = true
|
||||
return false
|
||||
}
|
||||
}else{
|
||||
//cooldown for this id doesn't exist
|
||||
this.data.add(new ODCooldownData(id,(this.increment >= this.activeLimit),{
|
||||
value:this.increment
|
||||
}))
|
||||
return false
|
||||
}
|
||||
}
|
||||
check(id:string): boolean {
|
||||
const cooldown = this.data.get(id)
|
||||
if (cooldown){
|
||||
//cooldown for this id already exists
|
||||
return cooldown.active
|
||||
}else return false
|
||||
}
|
||||
delete(id:string): void {
|
||||
this.data.remove(id)
|
||||
}
|
||||
async init(){
|
||||
if (this.ready) return
|
||||
setInterval(async () => {
|
||||
await this.data.loopAll((cooldown) => {
|
||||
cooldown.data.value = cooldown.data.value - this.decrement
|
||||
if (cooldown.data.value <= this.cancelLimit){
|
||||
cooldown.active = false
|
||||
}
|
||||
if (cooldown.data.value <= 0){
|
||||
this.data.remove(cooldown.id)
|
||||
}
|
||||
})
|
||||
},this.invervalMs)
|
||||
this.ready = true
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODTimeoutCooldown `class`
|
||||
* This is an Open Ticket timeout cooldown.
|
||||
*
|
||||
* It is a cooldown based on a timer. When triggered/updated, the cooldown is activated for the set amount of time.
|
||||
* After the timer has timed out, the cooldown will be deleted.
|
||||
*/
|
||||
export class ODTimeoutCooldown extends ODCooldown<{date:number}> {
|
||||
/**The amount of milliseconds before the cooldown times-out */
|
||||
timeoutMs: number
|
||||
|
||||
constructor(id:ODValidId, timeoutMs:number){
|
||||
super(id)
|
||||
this.timeoutMs = timeoutMs
|
||||
}
|
||||
|
||||
use(id:string): boolean {
|
||||
const cooldown = this.data.get(id)
|
||||
if (cooldown){
|
||||
//cooldown for this id already exists
|
||||
if ((new Date().getTime() - cooldown.data.date) > this.timeoutMs){
|
||||
this.data.remove(id)
|
||||
return false
|
||||
}else{
|
||||
return true
|
||||
}
|
||||
}else{
|
||||
//cooldown for this id doesn't exist
|
||||
this.data.add(new ODCooldownData(id,true,{
|
||||
date:new Date().getTime()
|
||||
}))
|
||||
return false
|
||||
}
|
||||
}
|
||||
check(id:string): boolean {
|
||||
const cooldown = this.data.get(id)
|
||||
if (cooldown){
|
||||
//cooldown for this id already exists
|
||||
return true
|
||||
}else return false
|
||||
}
|
||||
delete(id:string): void {
|
||||
this.data.remove(id)
|
||||
}
|
||||
/**Get the remaining amount of milliseconds before the timeout stops. */
|
||||
remaining(id:string): number|null {
|
||||
const cooldown = this.data.get(id)
|
||||
if (!cooldown) return null
|
||||
const rawResult = this.timeoutMs - (new Date().getTime() - cooldown.data.date)
|
||||
return (rawResult > 0) ? rawResult : 0
|
||||
}
|
||||
async init(){
|
||||
if (this.ready) return
|
||||
this.ready = true
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODIncrementalTimeoutCooldown `class`
|
||||
* This is an Open Ticket incremental timeout cooldown.
|
||||
*
|
||||
* It is is a cooldown based on an incremental timer. It is exactly the same as the normal timer,
|
||||
* with the only difference being that it adds additional time when triggered/updated while the cooldown is already active.
|
||||
*/
|
||||
export class ODIncrementalTimeoutCooldown extends ODCooldown<{date:number}> {
|
||||
/**The amount of milliseconds before the cooldown times-out */
|
||||
timeoutMs: number
|
||||
/**The amount of milliseconds to add when triggered/updated while the cooldown is already active. */
|
||||
incrementMs: number
|
||||
|
||||
constructor(id:ODValidId, timeoutMs:number, incrementMs:number){
|
||||
super(id)
|
||||
this.timeoutMs = timeoutMs
|
||||
this.incrementMs = incrementMs
|
||||
}
|
||||
|
||||
use(id:string): boolean {
|
||||
const cooldown = this.data.get(id)
|
||||
if (cooldown){
|
||||
//cooldown for this id already exists
|
||||
if ((new Date().getTime() - cooldown.data.date) > this.timeoutMs){
|
||||
this.data.remove(id)
|
||||
return false
|
||||
}else{
|
||||
cooldown.data.date = cooldown.data.date + this.incrementMs
|
||||
return true
|
||||
}
|
||||
}else{
|
||||
//cooldown for this id doesn't exist
|
||||
this.data.add(new ODCooldownData(id,true,{
|
||||
date:new Date().getTime()
|
||||
}))
|
||||
return false
|
||||
}
|
||||
}
|
||||
check(id:string): boolean {
|
||||
const cooldown = this.data.get(id)
|
||||
if (cooldown){
|
||||
//cooldown for this id already exists
|
||||
return true
|
||||
}else return false
|
||||
}
|
||||
delete(id:string): void {
|
||||
this.data.remove(id)
|
||||
}
|
||||
/**Get the remaining amount of milliseconds before the timeout stops. */
|
||||
remaining(id:string): number|null {
|
||||
const cooldown = this.data.get(id)
|
||||
if (!cooldown) return null
|
||||
const rawResult = this.timeoutMs - (new Date().getTime() - cooldown.data.date)
|
||||
return (rawResult > 0) ? rawResult : 0
|
||||
}
|
||||
async init(){
|
||||
if (this.ready) return
|
||||
this.ready = true
|
||||
}
|
||||
}
|
||||
@@ -1,278 +0,0 @@
|
||||
///////////////////////////////////////
|
||||
//DATABASE MODULE
|
||||
///////////////////////////////////////
|
||||
import { ODId, ODManager, ODManagerData, ODOptionalPromise, ODPromiseVoid, ODSystemError, ODValidId, ODValidJsonType } from "./base"
|
||||
import fs from "fs"
|
||||
import nodepath from "path"
|
||||
import { ODDebugger } from "./console"
|
||||
import * as fjs from "formatted-json-stringify"
|
||||
|
||||
/**## ODDatabaseManager `class`
|
||||
* This is an Open Ticket database manager.
|
||||
*
|
||||
* It manages all databases in the bot and allows to permanently store data from the bot!
|
||||
*
|
||||
* You can use this class to get/add a database (`ODDatabase`) in your plugin!
|
||||
*/
|
||||
export class ODDatabaseManager extends ODManager<ODDatabase> {
|
||||
constructor(debug:ODDebugger){
|
||||
super(debug,"database")
|
||||
}
|
||||
|
||||
/**Init all database files. */
|
||||
async init(){
|
||||
for (const database of this.getAll()){
|
||||
try{
|
||||
await database.init()
|
||||
}catch(err){
|
||||
process.emit("uncaughtException",new ODSystemError(err))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODDatabase `class`
|
||||
* This is an Open Ticket database template.
|
||||
* This class doesn't do anything at all, it just gives a template & basic methods for a database. Use `ODJsonDatabase` instead!
|
||||
*
|
||||
* You can use this class if you want to create your own database implementation (e.g. `mongodb`, `mysql`,...)!
|
||||
*/
|
||||
export class ODDatabase extends ODManagerData {
|
||||
/**The name of the file with extension. */
|
||||
file: string = ""
|
||||
/**The path to the file relative to the main directory. */
|
||||
path: string = ""
|
||||
|
||||
/**Init the database. */
|
||||
init(): ODPromiseVoid {
|
||||
//nothing
|
||||
}
|
||||
/**Add/Overwrite a specific category & key in the database. Returns `true` when overwritten. */
|
||||
set(category:string, key:string, value:ODValidJsonType): ODOptionalPromise<boolean> {
|
||||
return false
|
||||
}
|
||||
/**Get a specific category & key in the database */
|
||||
get(category:string, key:string): ODOptionalPromise<ODValidJsonType|undefined> {
|
||||
return undefined
|
||||
}
|
||||
/**Delete a specific category & key in the database */
|
||||
delete(category:string, key:string): ODOptionalPromise<boolean> {
|
||||
return false
|
||||
}
|
||||
/**Check if a specific category & key exists in the database */
|
||||
exists(category:string, key:string): ODOptionalPromise<boolean> {
|
||||
return false
|
||||
}
|
||||
/**Get a specific category in the database */
|
||||
getCategory(category:string): ODOptionalPromise<{key:string, value:ODValidJsonType}[]|undefined> {
|
||||
return undefined
|
||||
}
|
||||
/**Get all values in the database */
|
||||
getAll(): ODOptionalPromise<ODJsonDatabaseStructure> {
|
||||
return []
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODJsonDatabaseStructure `type`
|
||||
* This is the structure of how a JSON database file!
|
||||
*/
|
||||
export type ODJsonDatabaseStructure = {category:string, key:string, value:ODValidJsonType}[]
|
||||
|
||||
/**## ODJsonDatabase `class`
|
||||
* This is an Open Ticket JSON database.
|
||||
* It stores data in a `json` file as a large `Array` using the `category`, `key`, `value` strategy.
|
||||
* You can store the following types: `string`, `number`, `boolean`, `array`, `object` & `null`!
|
||||
*
|
||||
* You can use this class if you want to add your own database or to use an existing one!
|
||||
*/
|
||||
export class ODJsonDatabase extends ODDatabase {
|
||||
constructor(id:ODValidId, file:string, customPath?:string){
|
||||
super(id)
|
||||
this.file = (file.endsWith(".json")) ? file : file+".json"
|
||||
this.path = customPath ? nodepath.join("./",customPath,this.file) : nodepath.join("./database/",this.file)
|
||||
}
|
||||
|
||||
/**Init the database. */
|
||||
init(): ODPromiseVoid {
|
||||
this.#system.getData()
|
||||
}
|
||||
/**Set/overwrite the value of `category` & `key`. Returns `true` when overwritten!
|
||||
* @example
|
||||
* const didOverwrite = database.setData("category","key","value") //value can be any of the valid types
|
||||
* //You need an ODJsonDatabase class named "database" for this example to work!
|
||||
*/
|
||||
set(category:string, key:string, value:ODValidJsonType): ODOptionalPromise<boolean> {
|
||||
const currentList = this.#system.getData()
|
||||
const currentData = currentList.find((d) => (d.category === category) && (d.key === key))
|
||||
|
||||
//overwrite when already present
|
||||
if (currentData){
|
||||
currentList[currentList.indexOf(currentData)].value = value
|
||||
}else{
|
||||
currentList.push({category,key,value})
|
||||
}
|
||||
|
||||
this.#system.setData(currentList)
|
||||
return currentData ? true : false
|
||||
}
|
||||
/**Get the value of `category` & `key`. Returns `undefined` when non-existent!
|
||||
* @example
|
||||
* const data = database.getData("category","key") //data will be the value
|
||||
* //You need an ODJsonDatabase class named "database" for this example to work!
|
||||
*/
|
||||
get(category:string, key:string): ODOptionalPromise<ODValidJsonType|undefined> {
|
||||
const currentList = this.#system.getData()
|
||||
const tempresult = currentList.find((d) => (d.category === category) && (d.key === key))
|
||||
return tempresult ? tempresult.value : undefined
|
||||
}
|
||||
/**Remove the value of `category` & `key`. Returns `undefined` when non-existent!
|
||||
* @example
|
||||
* const didExist = database.deleteData("category","key") //delete this value
|
||||
* //You need an ODJsonDatabase class named "database" for this example to work!
|
||||
*/
|
||||
delete(category:string, key:string): ODOptionalPromise<boolean> {
|
||||
const currentList = this.#system.getData()
|
||||
const currentData = currentList.find((d) => (d.category === category) && (d.key === key))
|
||||
if (currentData) currentList.splice(currentList.indexOf(currentData),1)
|
||||
|
||||
this.#system.setData(currentList)
|
||||
return currentData ? true : false
|
||||
}
|
||||
/**Check if a value of `category` & `key` exists. Returns `false` when non-existent! */
|
||||
exists(category:string, key:string): ODOptionalPromise<boolean> {
|
||||
const currentList = this.#system.getData()
|
||||
const tempresult = currentList.find((d) => (d.category === category) && (d.key === key))
|
||||
return tempresult ? true : false
|
||||
}
|
||||
/**Get all values in `category`. Returns `undefined` when non-existent! */
|
||||
getCategory(category:string): ODOptionalPromise<{key:string, value:ODValidJsonType}[]|undefined> {
|
||||
const currentList = this.#system.getData()
|
||||
const tempresult = currentList.filter((d) => (d.category === category))
|
||||
return tempresult ? tempresult.map((data) => {return {key:data.key,value:data.value}}) : undefined
|
||||
}
|
||||
/**Get all values in `category`. */
|
||||
getAll(): ODOptionalPromise<ODJsonDatabaseStructure> {
|
||||
return this.#system.getData()
|
||||
}
|
||||
|
||||
#system = {
|
||||
/**Read parsed data from the json file */
|
||||
getData: (): ODJsonDatabaseStructure => {
|
||||
if (fs.existsSync(this.path)){
|
||||
try{
|
||||
return JSON.parse(fs.readFileSync(this.path).toString())
|
||||
}catch(err){
|
||||
process.emit("uncaughtException",err)
|
||||
throw new ODSystemError("Unable to read database "+this.path+"! getData() read error. (see error above)")
|
||||
}
|
||||
}else{
|
||||
fs.writeFileSync(this.path,"[]")
|
||||
return []
|
||||
}
|
||||
},
|
||||
/**Write parsed data to the json file */
|
||||
setData: (data:ODJsonDatabaseStructure) => {
|
||||
fs.writeFileSync(this.path,JSON.stringify(data,null,"\t"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**## ODFormattedJsonDatabase `class`
|
||||
* This is an Open Ticket Formatted JSON database.
|
||||
* It stores data in a `json` file as a large `Array` using the `category`, `key`, `value` strategy.
|
||||
* You can store the following types: `string`, `number`, `boolean`, `array`, `object` & `null`!
|
||||
*
|
||||
* This one is exactly the same as `ODJsonDatabase`, but it has a formatter from the `formatted-json-stringify` package.
|
||||
* This can help you organise it a little bit better!
|
||||
*/
|
||||
export class ODFormattedJsonDatabase extends ODDatabase {
|
||||
/**The formatter to use on the database array */
|
||||
formatter: fjs.ArrayFormatter
|
||||
|
||||
constructor(id:ODValidId, file:string, formatter:fjs.ArrayFormatter, customPath?:string){
|
||||
super(id)
|
||||
this.file = (file.endsWith(".json")) ? file : file+".json"
|
||||
this.path = customPath ? nodepath.join("./",customPath,this.file) : nodepath.join("./database/",this.file)
|
||||
this.formatter = formatter
|
||||
}
|
||||
|
||||
/**Init the database. */
|
||||
init(): ODPromiseVoid {
|
||||
this.#system.getData()
|
||||
}
|
||||
/**Set/overwrite the value of `category` & `key`. Returns `true` when overwritten!
|
||||
* @example
|
||||
* const didOverwrite = database.setData("category","key","value") //value can be any of the valid types
|
||||
* //You need an ODFormattedJsonDatabase class named "database" for this example to work!
|
||||
*/
|
||||
set(category:string, key:string, value:ODValidJsonType): ODOptionalPromise<boolean> {
|
||||
const currentList = this.#system.getData()
|
||||
const currentData = currentList.find((d) => (d.category === category) && (d.key === key))
|
||||
|
||||
//overwrite when already present
|
||||
if (currentData){
|
||||
currentList[currentList.indexOf(currentData)].value = value
|
||||
}else{
|
||||
currentList.push({category,key,value})
|
||||
}
|
||||
|
||||
this.#system.setData(currentList)
|
||||
return currentData ? true : false
|
||||
}
|
||||
/**Get the value of `category` & `key`. Returns `undefined` when non-existent!
|
||||
* @example
|
||||
* const data = database.getData("category","key") //data will be the value
|
||||
* //You need an ODFormattedJsonDatabase class named "database" for this example to work!
|
||||
*/
|
||||
get(category:string, key:string): ODOptionalPromise<ODValidJsonType|undefined> {
|
||||
const currentList = this.#system.getData()
|
||||
const tempresult = currentList.find((d) => (d.category === category) && (d.key === key))
|
||||
return tempresult ? tempresult.value : undefined
|
||||
}
|
||||
/**Remove the value of `category` & `key`. Returns `undefined` when non-existent!
|
||||
* @example
|
||||
* const didExist = database.deleteData("category","key") //delete this value
|
||||
* //You need an ODFormattedJsonDatabase class named "database" for this example to work!
|
||||
*/
|
||||
delete(category:string, key:string): ODOptionalPromise<boolean> {
|
||||
const currentList = this.#system.getData()
|
||||
const currentData = currentList.find((d) => (d.category === category) && (d.key === key))
|
||||
if (currentData) currentList.splice(currentList.indexOf(currentData),1)
|
||||
|
||||
this.#system.setData(currentList)
|
||||
return currentData ? true : false
|
||||
}
|
||||
/**Check if a value of `category` & `key` exists. Returns `false` when non-existent! */
|
||||
exists(category:string, key:string): ODOptionalPromise<boolean> {
|
||||
const currentList = this.#system.getData()
|
||||
const tempresult = currentList.find((d) => (d.category === category) && (d.key === key))
|
||||
return tempresult ? true : false
|
||||
}
|
||||
/**Get all values in `category`. Returns `undefined` when non-existent! */
|
||||
getCategory(category:string): ODOptionalPromise<{key:string, value:ODValidJsonType}[]|undefined> {
|
||||
const currentList = this.#system.getData()
|
||||
const tempresult = currentList.filter((d) => (d.category === category))
|
||||
return tempresult ? tempresult.map((data) => {return {key:data.key,value:data.value}}) : undefined
|
||||
}
|
||||
/**Get all values in `category`. */
|
||||
getAll(): ODOptionalPromise<ODJsonDatabaseStructure> {
|
||||
return this.#system.getData()
|
||||
}
|
||||
|
||||
#system = {
|
||||
/**Read parsed data from the json file */
|
||||
getData: (): ODJsonDatabaseStructure => {
|
||||
if (fs.existsSync(this.path)){
|
||||
return JSON.parse(fs.readFileSync(this.path).toString())
|
||||
}else{
|
||||
fs.writeFileSync(this.path,"[]")
|
||||
return []
|
||||
}
|
||||
},
|
||||
/**Write parsed data to the json file */
|
||||
setData: (data:ODJsonDatabaseStructure) => {
|
||||
fs.writeFileSync(this.path,this.formatter.stringify(data))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,366 +0,0 @@
|
||||
///////////////////////////////////////
|
||||
//DEFAULTS MODULE
|
||||
///////////////////////////////////////
|
||||
|
||||
/**## ODDefaults `interface`
|
||||
* This type is a list of all defaults available in the `ODDefaultsManager` class.
|
||||
* It's used to generate typescript declarations for this class.
|
||||
*/
|
||||
export interface ODDefaults {
|
||||
/**Enable the default error handling system. */
|
||||
errorHandling:boolean,
|
||||
/**Crash when there is an unknown bot error. */
|
||||
crashOnError:boolean,
|
||||
/**Enable the system responsible for the `--debug` flag. */
|
||||
debugLoading:boolean,
|
||||
/**Enable the system responsible for the `--silent` flag. */
|
||||
silentLoading:boolean,
|
||||
/**When enabled, you're able to use the "!OPENTICKET:dump" command to send the OT debug file. This is only possible when you're the owner of the bot. */
|
||||
allowDumpCommand:boolean,
|
||||
/**Enable loading all Open Ticket plugins, sadly enough is only useful for the system :) */
|
||||
pluginLoading:boolean,
|
||||
/**Don't crash the bot when a plugin crashes! */
|
||||
softPluginLoading:boolean,
|
||||
|
||||
/**Load the default Open Ticket plugin classes. */
|
||||
pluginClassLoading:boolean,
|
||||
|
||||
/**Load the default Open Ticket flags. */
|
||||
flagLoading:boolean,
|
||||
/**Enable the default initializer for Open Ticket flags. */
|
||||
flagInitiating:boolean,
|
||||
/**Load the default Open Ticket progress bar renderers. */
|
||||
progressBarRendererLoading:boolean,
|
||||
/**Load the default Open Ticket progress bars. */
|
||||
progressBarLoading:boolean,
|
||||
/**Load the default Open Ticket configs. */
|
||||
configLoading:boolean,
|
||||
/**Enable the default initializer for Open Ticket config. */
|
||||
configInitiating:boolean,
|
||||
/**Load the default Open Ticket databases. */
|
||||
databaseLoading:boolean,
|
||||
/**Enable the default initializer for Open Ticket database. */
|
||||
databaseInitiating:boolean,
|
||||
/**Load the default Open Ticket sessions. */
|
||||
sessionLoading:boolean,
|
||||
|
||||
/**Load the default Open Ticket languages. */
|
||||
languageLoading:boolean,
|
||||
/**Enable the default initializer for Open Ticket languages. */
|
||||
languageInitiating:boolean,
|
||||
/**Enable selecting the current language from `config/general.json`. */
|
||||
languageSelection:boolean,
|
||||
/**Set the backup language when the primary language is missing a property. */
|
||||
backupLanguage:string,
|
||||
/****[NOT FOR PLUGIN TRANSLATIONS]** The full list of available languages (used in the default config checker). */
|
||||
languageList:string[],
|
||||
|
||||
/**Load the default Open Ticket config checker. */
|
||||
checkerLoading:boolean,
|
||||
/**Load the default Open Ticket config checker functions. */
|
||||
checkerFunctionLoading:boolean,
|
||||
/**Enable the default execution of the config checkers. */
|
||||
checkerExecution:boolean,
|
||||
/**Load the default Open Ticket config checker translations. */
|
||||
checkerTranslationLoading:boolean,
|
||||
/**Enable the default rendering of the config checkers. */
|
||||
checkerRendering:boolean,
|
||||
/**Enable the default quit action when there is an error in the config checker. */
|
||||
checkerQuit:boolean,
|
||||
/**Render the checker even when there are no errors & warnings. */
|
||||
checkerRenderEmpty:boolean,
|
||||
|
||||
/**Load the default Open Ticket client configuration. */
|
||||
clientLoading:boolean,
|
||||
/**Load the default Open Ticket client initialization. */
|
||||
clientInitiating:boolean,
|
||||
/**Load the default Open Ticket client ready actions (status, commands, permissions, ...). */
|
||||
clientReady:boolean,
|
||||
/**Create a warning when the bot is present in multiple guilds. */
|
||||
clientMultiGuildWarning:boolean,
|
||||
/**Load the default Open Ticket client activity (from `config/general.json`). */
|
||||
clientActivityLoading:boolean,
|
||||
/**Load the default Open Ticket client activity initialization (& status refresh). */
|
||||
clientActivityInitiating:boolean,
|
||||
|
||||
/**Load the default Open Ticket priority levels. */
|
||||
priorityLoading:boolean,
|
||||
|
||||
/**Load the default Open Ticket slash commands. */
|
||||
slashCommandLoading:boolean,
|
||||
/**Load the default Open Ticket slash command registerer (register slash cmds in discord). */
|
||||
slashCommandRegistering:boolean,
|
||||
/**When enabled, the bot is forced to re-register all slash commands in the server. This can be used in case of a auto-update malfunction. */
|
||||
forceSlashCommandRegistration:boolean,
|
||||
/**When enabled, the bot is allowed to unregister all slash commands which aren't used in Open Ticket. Disable this if you don't want to use the Open Ticket `ODSlashCommand` classes. */
|
||||
allowSlashCommandRemoval:boolean,
|
||||
/**Load the default Open Ticket context menus. */
|
||||
contextMenuLoading:boolean,
|
||||
/**Load the default Open Ticket context menu registerer (register menus in discord). */
|
||||
contextMenuRegistering:boolean,
|
||||
/**When enabled, the bot is forced to re-register all context menus in the server. This can be used in case of a auto-update malfunction. */
|
||||
forceContextMenuRegistration:boolean,
|
||||
/**When enabled, the bot is allowed to unregister all context menus which aren't used in Open Ticket. Disable this if you don't want to use the Open Ticket `ODContextMenu` classes. */
|
||||
allowContextMenuRemoval:boolean,
|
||||
/**Load the default Open Ticket text commands. */
|
||||
textCommandLoading:boolean,
|
||||
|
||||
/**Load the default Open Ticket questions (from `config/questions.json`) */
|
||||
questionLoading:boolean,
|
||||
/**Load the default Open Ticket options (from `config/options.json`) */
|
||||
optionLoading:boolean,
|
||||
/**Load the default Open Ticket panels (from `config/panels.json`) */
|
||||
panelLoading:boolean,
|
||||
/**Load the default Open Ticket tickets (from `database/tickets.json`) */
|
||||
ticketLoading:boolean,
|
||||
/**Load the default Open Ticket reaction roles (from `config/options.json`) */
|
||||
roleLoading:boolean,
|
||||
/**Load the default Open Ticket blacklist (from `database/users.json`) */
|
||||
blacklistLoading:boolean,
|
||||
/**Load the default Open Ticket transcript compilers. */
|
||||
transcriptCompilerLoading:boolean,
|
||||
/**Load the default Open Ticket transcript history (from `database/transcripts.json`) */
|
||||
transcriptHistoryLoading:boolean,
|
||||
|
||||
/**Load the default Open Ticket button builders. */
|
||||
buttonBuildersLoading:boolean,
|
||||
/**Load the default Open Ticket dropdown builders. */
|
||||
dropdownBuildersLoading:boolean,
|
||||
/**Load the default Open Ticket file builders. */
|
||||
fileBuildersLoading:boolean,
|
||||
/**Load the default Open Ticket embed builders. */
|
||||
embedBuildersLoading:boolean,
|
||||
/**Load the default Open Ticket message builders. */
|
||||
messageBuildersLoading:boolean,
|
||||
/**Load the default Open Ticket modal builders. */
|
||||
modalBuildersLoading:boolean,
|
||||
|
||||
/**Load the default Open Ticket command responders. */
|
||||
commandRespondersLoading:boolean,
|
||||
/**Load the default Open Ticket button responders. */
|
||||
buttonRespondersLoading:boolean,
|
||||
/**Load the default Open Ticket dropdown responders. */
|
||||
dropdownRespondersLoading:boolean,
|
||||
/**Load the default Open Ticket modal responders. */
|
||||
modalRespondersLoading:boolean,
|
||||
/**Load the default Open Ticket context menu responders. */
|
||||
contextMenuRespondersLoading:boolean,
|
||||
/**Load the default Open Ticket autocomplete responders. */
|
||||
autocompleteRespondersLoading:boolean,
|
||||
/**Set the time (in ms) before Open Ticket sends an error message when no reply is sent in a responder. */
|
||||
responderTimeoutMs:number,
|
||||
|
||||
/**Load the default Open Ticket actions. */
|
||||
actionsLoading:boolean,
|
||||
|
||||
/**Load the default Open Ticket verify bars. */
|
||||
verifyBarsLoading:boolean,
|
||||
/**Load the default Open Ticket permissions. */
|
||||
permissionsLoading:boolean,
|
||||
/**Load the default Open Ticket posts. */
|
||||
postsLoading:boolean,
|
||||
/**Initiate the default Open Ticket posts. */
|
||||
postsInitiating:boolean,
|
||||
/**Load the default Open Ticket cooldowns. */
|
||||
cooldownsLoading:boolean,
|
||||
/**Initiate the default Open Ticket cooldowns. */
|
||||
cooldownsInitiating:boolean,
|
||||
/**Load the default Open Ticket help menu categories. */
|
||||
helpMenuCategoryLoading:boolean,
|
||||
/**Load the default Open Ticket help menu components. */
|
||||
helpMenuComponentLoading:boolean,
|
||||
|
||||
/**Load the default Open Ticket stat scopes. */
|
||||
statScopesLoading:boolean,
|
||||
/**Load the default Open Ticket stats. */
|
||||
statLoading:boolean,
|
||||
/**Initiate the default Open Ticket stats. */
|
||||
statInitiating:boolean,
|
||||
|
||||
/**Load the default Open Ticket code/functions. */
|
||||
codeLoading:boolean,
|
||||
/**Execute the default Open Ticket code/functions. */
|
||||
codeExecution:boolean,
|
||||
|
||||
/**Load the default Open Ticket livestatus. */
|
||||
liveStatusLoading:boolean,
|
||||
/**Load the default Open Ticket startscreen. */
|
||||
startScreenLoading:boolean,
|
||||
/**Render the default Open Ticket startscreen. */
|
||||
startScreenRendering:boolean,
|
||||
|
||||
/**Load the emoji style from the Open Ticket general config. */
|
||||
emojiTitleStyleLoading:boolean,
|
||||
/**The emoji style to use in embed & message titles using `utilities.emoijTitle()` */
|
||||
emojiTitleStyle:"disabled"|"before"|"after"|"double",
|
||||
/**The emoji divider to use in embed & message titles using `utilities.emoijTitle()` */
|
||||
emojiTitleDivider:string
|
||||
/**The interval in milliseconds that are between autoclose timeout checkers. */
|
||||
autocloseCheckInterval:number
|
||||
/**The interval in milliseconds that are between autodelete timeout checkers. */
|
||||
autodeleteCheckInterval:number
|
||||
}
|
||||
|
||||
/**## ODDefaultsBooleans `type`
|
||||
* This type is a list of boolean defaults available in the `ODDefaultsManager` class.
|
||||
* It's used to generate typescript declarations for this class.
|
||||
*/
|
||||
export type ODDefaultsBooleans = {
|
||||
[Key in keyof ODDefaults]: ODDefaults[Key] extends boolean ? Key : never
|
||||
}[keyof ODDefaults]
|
||||
|
||||
/**## ODDefaultsStrings `type`
|
||||
* This type is a list of string defaults available in the `ODDefaultsManager` class.
|
||||
* It's used to generate typescript declarations for this class.
|
||||
*/
|
||||
export type ODDefaultsStrings = {
|
||||
[Key in keyof ODDefaults]: ODDefaults[Key] extends string ? Key : never
|
||||
}[keyof ODDefaults]
|
||||
|
||||
/**## ODDefaultsNumbers `type`
|
||||
* This type is a list of number defaults available in the `ODDefaultsManager` class.
|
||||
* It's used to generate typescript declarations for this class.
|
||||
*/
|
||||
export type ODDefaultsNumbers = {
|
||||
[Key in keyof ODDefaults]: ODDefaults[Key] extends number ? Key : never
|
||||
}[keyof ODDefaults]
|
||||
|
||||
/**## ODDefaultsStringArray `type`
|
||||
* This type is a list of string[] defaults available in the `ODDefaultsManager` class.
|
||||
* It's used to generate typescript declarations for this class.
|
||||
*/
|
||||
export type ODDefaultsStringArray = {
|
||||
[Key in keyof ODDefaults]: ODDefaults[Key] extends string[] ? Key : never
|
||||
}[keyof ODDefaults]
|
||||
|
||||
/**## ODDefaultsManager `class`
|
||||
* This is an Open Ticket defaults manager.
|
||||
*
|
||||
* It manages all settings in Open Ticket that are not meant to be in the config.
|
||||
* Here you can disable certain default features to replace them or to specifically enable them!
|
||||
*
|
||||
* You are unable to add your own defaults, you can only edit Open Ticket defaults!
|
||||
*/
|
||||
export class ODDefaultsManager {
|
||||
/**A list of all the defaults */
|
||||
#defaults: ODDefaults
|
||||
|
||||
constructor(){
|
||||
this.#defaults = {
|
||||
errorHandling:true,
|
||||
crashOnError:false,
|
||||
debugLoading:true,
|
||||
silentLoading:true,
|
||||
allowDumpCommand:true,
|
||||
pluginLoading:true,
|
||||
softPluginLoading:false,
|
||||
|
||||
pluginClassLoading:true,
|
||||
|
||||
flagLoading:true,
|
||||
flagInitiating:true,
|
||||
progressBarRendererLoading:true,
|
||||
progressBarLoading:true,
|
||||
configLoading:true,
|
||||
configInitiating:true,
|
||||
databaseLoading:true,
|
||||
databaseInitiating:true,
|
||||
sessionLoading:true,
|
||||
|
||||
languageLoading:true,
|
||||
languageInitiating:true,
|
||||
languageSelection:true,
|
||||
backupLanguage:"opendiscord:english",
|
||||
languageList:[],
|
||||
|
||||
checkerLoading:true,
|
||||
checkerFunctionLoading:true,
|
||||
checkerExecution:true,
|
||||
checkerTranslationLoading:true,
|
||||
checkerRendering:true,
|
||||
checkerQuit:true,
|
||||
checkerRenderEmpty:false,
|
||||
|
||||
clientLoading:true,
|
||||
clientInitiating:true,
|
||||
clientReady:true,
|
||||
clientMultiGuildWarning:true,
|
||||
clientActivityLoading:true,
|
||||
clientActivityInitiating:true,
|
||||
|
||||
priorityLoading:true,
|
||||
|
||||
slashCommandLoading:true,
|
||||
slashCommandRegistering:true,
|
||||
forceSlashCommandRegistration:false,
|
||||
allowSlashCommandRemoval:true,
|
||||
contextMenuLoading:true,
|
||||
contextMenuRegistering:true,
|
||||
forceContextMenuRegistration:false,
|
||||
allowContextMenuRemoval:true,
|
||||
textCommandLoading:true,
|
||||
|
||||
questionLoading:true,
|
||||
optionLoading:true,
|
||||
panelLoading:true,
|
||||
ticketLoading:true,
|
||||
roleLoading:true,
|
||||
blacklistLoading:true,
|
||||
transcriptCompilerLoading:true,
|
||||
transcriptHistoryLoading:true,
|
||||
|
||||
buttonBuildersLoading:true,
|
||||
dropdownBuildersLoading:true,
|
||||
fileBuildersLoading:true,
|
||||
embedBuildersLoading:true,
|
||||
messageBuildersLoading:true,
|
||||
modalBuildersLoading:true,
|
||||
|
||||
commandRespondersLoading:true,
|
||||
buttonRespondersLoading:true,
|
||||
dropdownRespondersLoading:true,
|
||||
modalRespondersLoading:true,
|
||||
contextMenuRespondersLoading:true,
|
||||
autocompleteRespondersLoading:true,
|
||||
responderTimeoutMs:2500,
|
||||
|
||||
actionsLoading:true,
|
||||
|
||||
verifyBarsLoading:true,
|
||||
permissionsLoading:true,
|
||||
postsLoading:true,
|
||||
postsInitiating:true,
|
||||
cooldownsLoading:true,
|
||||
cooldownsInitiating:true,
|
||||
helpMenuCategoryLoading:true,
|
||||
helpMenuComponentLoading:true,
|
||||
|
||||
statScopesLoading:true,
|
||||
statLoading:true,
|
||||
statInitiating:true,
|
||||
|
||||
codeLoading:true,
|
||||
codeExecution:true,
|
||||
|
||||
liveStatusLoading:true,
|
||||
startScreenLoading:true,
|
||||
startScreenRendering:true,
|
||||
|
||||
emojiTitleStyleLoading:true,
|
||||
emojiTitleStyle:"before",
|
||||
emojiTitleDivider:" ",
|
||||
autocloseCheckInterval:300000, //5 minutes
|
||||
autodeleteCheckInterval:300000 //5 minutes
|
||||
}
|
||||
}
|
||||
|
||||
/**Set a default to a specific value. Remember! All plugins can edit these values, so your value could be overwritten! */
|
||||
setDefault<DefaultName extends keyof ODDefaults>(key:DefaultName, value:ODDefaults[DefaultName]): void {
|
||||
this.#defaults[key] = value
|
||||
}
|
||||
|
||||
/**Get a default. Remember! All plugins can edit these values, so this value could be overwritten! */
|
||||
getDefault<DefaultName extends keyof ODDefaults>(key:DefaultName): ODDefaults[DefaultName] {
|
||||
return this.#defaults[key]
|
||||
}
|
||||
}
|
||||
@@ -1,99 +0,0 @@
|
||||
///////////////////////////////////////
|
||||
//EVENT MODULE
|
||||
///////////////////////////////////////
|
||||
import { ODManagerData, ODManager, ODValidId } from "./base"
|
||||
import { ODConsoleWarningMessage, ODDebugger } from "./console"
|
||||
|
||||
/**## ODEvent `class`
|
||||
* This is an Open Ticket event.
|
||||
*
|
||||
* This class is made to work with the `ODEventManager` to handle events.
|
||||
* The function of this specific class is to manage all listeners for a specifc event!
|
||||
*/
|
||||
export class ODEvent extends ODManagerData {
|
||||
/**Alias to Open Ticket debugger. */
|
||||
#debug?: ODDebugger
|
||||
/**The list of permanent listeners. */
|
||||
listeners: Function[] = []
|
||||
/**The list of one-time listeners. List is cleared every time the event is emitted. */
|
||||
oncelisteners: Function[] = []
|
||||
/**The max listener limit before a possible memory leak will be announced */
|
||||
listenerLimit: number = 25
|
||||
|
||||
/**Use the Open Ticket debugger in this manager for logs*/
|
||||
useDebug(debug:ODDebugger|null){
|
||||
this.#debug = debug ?? undefined
|
||||
}
|
||||
/**Get a collection of listeners combined from both types. Also clears the one-time listeners array! */
|
||||
#getCurrentListeners(){
|
||||
const final: Function[] = []
|
||||
this.oncelisteners.forEach((l) => final.push(l))
|
||||
this.listeners.forEach((l) => final.push(l))
|
||||
|
||||
this.oncelisteners = []
|
||||
return final
|
||||
}
|
||||
/**Edit the listener limit */
|
||||
setListenerLimit(limit:number){
|
||||
this.listenerLimit = limit
|
||||
}
|
||||
/**Add a permanent callback to this event. This will stay as long as the bot is running! */
|
||||
listen(callback:Function){
|
||||
this.listeners.push(callback)
|
||||
|
||||
if (this.listeners.length > this.listenerLimit){
|
||||
if (this.#debug) this.#debug.console.log(new ODConsoleWarningMessage("Possible event memory leak detected!",[
|
||||
{key:"event",value:this.id.value},
|
||||
{key:"listeners",value:this.listeners.length.toString()}
|
||||
]))
|
||||
}
|
||||
}
|
||||
/**Add a one-time-only callback to this event. This will only trigger the callback once! */
|
||||
listenOnce(callback:Function){
|
||||
this.oncelisteners.push(callback)
|
||||
}
|
||||
/**Wait until this event is fired! Be carefull with it, because it could block the entire bot when wrongly used! */
|
||||
async wait(): Promise<any[]> {
|
||||
return new Promise((resolve,reject) => {
|
||||
this.oncelisteners.push((...args:any) => {resolve(args)})
|
||||
})
|
||||
}
|
||||
/**Emit this event to all listeners. You are required to provide all parameters of the event! */
|
||||
async emit(params:any[]): Promise<void> {
|
||||
for (const listener of this.#getCurrentListeners()){
|
||||
try{
|
||||
await listener(...params)
|
||||
}catch(err){
|
||||
process.emit("uncaughtException",err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODEventManager `class`
|
||||
* This is an Open Ticket event manager.
|
||||
*
|
||||
* This class is made to manage all events in the bot. You can compare it with the built-in node.js `EventEmitter`
|
||||
*
|
||||
* It's not recommended to create this class yourself. Plugin events should be registered in their `plugin.json` file instead.
|
||||
* All events are available in the `opendiscord.events` global!
|
||||
*/
|
||||
export class ODEventManager extends ODManager<ODEvent> {
|
||||
/**Reference to the Open Ticket debugger */
|
||||
#debug: ODDebugger
|
||||
|
||||
constructor(debug:ODDebugger){
|
||||
super(debug,"event")
|
||||
this.#debug = debug
|
||||
}
|
||||
|
||||
add(data:ODEvent, overwrite?:boolean): boolean {
|
||||
data.useDebug(this.#debug)
|
||||
return super.add(data,overwrite)
|
||||
}
|
||||
remove(id:ODValidId): ODEvent|null {
|
||||
const data = super.remove(id)
|
||||
if (data) data.useDebug(null)
|
||||
return data
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
///////////////////////////////////////
|
||||
//FLAG MODULE
|
||||
///////////////////////////////////////
|
||||
import { ODId, ODValidId, ODManager, ODManagerData } from "./base"
|
||||
import { ODDebugger } from "./console"
|
||||
|
||||
/**## ODFlag `class`
|
||||
* This is an Open Ticket flag.
|
||||
*
|
||||
* A flag is a boolean that can be specified by a parameter in the console.
|
||||
* It's useful for small settings that are only required once in a while.
|
||||
*
|
||||
* Flags can also be enabled manually by plugins!
|
||||
*/
|
||||
export class ODFlag extends ODManagerData {
|
||||
/**The method that has been used to set the value of this flag. (`null` when not set) */
|
||||
method: "param"|"manual"|null = null
|
||||
/**The name of this flag. Visible to the user. */
|
||||
name: string
|
||||
/**The description of this flag. Visible to the user. */
|
||||
description: string
|
||||
/**The name of the parameter in the console. (e.g. `--test`) */
|
||||
param: string
|
||||
/**A list of aliases for the parameter in the console. */
|
||||
aliases: string[]
|
||||
/**The value of this flag. */
|
||||
value: boolean = false
|
||||
|
||||
constructor(id:ODValidId, name:string, description:string, param:string, aliases?:string[], initialValue?:boolean){
|
||||
super(id)
|
||||
this.name = name
|
||||
this.description = description
|
||||
this.param = param
|
||||
this.aliases = aliases ?? []
|
||||
this.value = initialValue ?? false
|
||||
}
|
||||
|
||||
/**Set the value of this flag. */
|
||||
setValue(value:boolean,method?:"param"|"manual"){
|
||||
this.value = value
|
||||
this.method = method ?? "manual"
|
||||
}
|
||||
/**Detect if the process contains the param or aliases & set the value. Use `force` to overwrite a manually set value. */
|
||||
detectProcessParams(force?:boolean){
|
||||
if (force){
|
||||
const params = [this.param,...this.aliases]
|
||||
this.setValue(params.some((p) => process.argv.includes(p)),"param")
|
||||
|
||||
}else if (this.method != "manual"){
|
||||
const params = [this.param,...this.aliases]
|
||||
this.setValue(params.some((p) => process.argv.includes(p)),"param")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODFlagManager `class`
|
||||
* This is an Open Ticket flag manager.
|
||||
*
|
||||
* This class is responsible for managing & initiating all flags of the bot.
|
||||
* It also contains a shortcut for initiating all flags.
|
||||
*/
|
||||
export class ODFlagManager extends ODManager<ODFlag> {
|
||||
constructor(debug:ODDebugger){
|
||||
super(debug,"flag")
|
||||
}
|
||||
|
||||
/**Set all flags to their `process.argv` value. */
|
||||
async init(){
|
||||
await this.loopAll((flag) => {
|
||||
flag.detectProcessParams(false)
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -1,216 +0,0 @@
|
||||
///////////////////////////////////////
|
||||
//HELP MODULE
|
||||
///////////////////////////////////////
|
||||
import { ODId, ODManager, ODManagerData, ODValidId } from "./base"
|
||||
import { ODDebugger } from "./console"
|
||||
|
||||
/**## ODHelpMenuComponentRenderer `type`
|
||||
* This is the callback of the help menu component renderer. It also contains information about how & where it is rendered.
|
||||
*/
|
||||
export type ODHelpMenuComponentRenderer = (page:number, category:number, location:number, mode:"slash"|"text") => string|Promise<string>
|
||||
|
||||
/**## ODHelpMenuComponent `class`
|
||||
* This is an Open Ticket help menu component.
|
||||
*
|
||||
* It can render something on the Open Ticket help menu.
|
||||
*/
|
||||
export class ODHelpMenuComponent extends ODManagerData {
|
||||
/**The priority of this component. The higher, the earlier it will appear in the help menu. */
|
||||
priority: number
|
||||
/**The render function for this component. */
|
||||
render: ODHelpMenuComponentRenderer
|
||||
|
||||
constructor(id:ODValidId, priority:number, render:ODHelpMenuComponentRenderer){
|
||||
super(id)
|
||||
this.priority = priority
|
||||
this.render = render
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODHelpMenuTextComponent `class`
|
||||
* This is an Open Ticket help menu text component.
|
||||
*
|
||||
* It can render a static piece of text on the Open Ticket help menu.
|
||||
*/
|
||||
export class ODHelpMenuTextComponent extends ODHelpMenuComponent {
|
||||
constructor(id:ODValidId, priority:number, text:string){
|
||||
super(id,priority,() => {
|
||||
return text
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODHelpMenuCommandComponentOption `interface`
|
||||
* This interface contains a command option for the `ODHelpMenuCommandComponent`.
|
||||
*/
|
||||
export interface ODHelpMenuCommandComponentOption {
|
||||
/**The name of this option. */
|
||||
name:string,
|
||||
/**Is this option optional? */
|
||||
optional:boolean
|
||||
}
|
||||
|
||||
/**## ODHelpMenuCommandComponentSettings `interface`
|
||||
* This interface contains the settings for the `ODHelpMenuCommandComponent`.
|
||||
*/
|
||||
export interface ODHelpMenuCommandComponentSettings {
|
||||
/**The name of this text command. */
|
||||
textName?:string,
|
||||
/**The name of this slash command. */
|
||||
slashName?:string,
|
||||
/**Options available in the text command. */
|
||||
textOptions?:ODHelpMenuCommandComponentOption[],
|
||||
/**Options available in the slash command. */
|
||||
slashOptions?:ODHelpMenuCommandComponentOption[],
|
||||
/**The description for the text command. */
|
||||
textDescription?:string,
|
||||
/**The description for the slash command. */
|
||||
slashDescription?:string
|
||||
}
|
||||
|
||||
/**## ODHelpMenuCommandComponent `class`
|
||||
* This is an Open Ticket help menu command component.
|
||||
*
|
||||
* It contains a useful helper to render a command in the Open Ticket help menu.
|
||||
*/
|
||||
export class ODHelpMenuCommandComponent extends ODHelpMenuComponent {
|
||||
constructor(id:ODValidId, priority:number, settings:ODHelpMenuCommandComponentSettings){
|
||||
super(id,priority,(page,category,location,mode) => {
|
||||
if (mode == "slash" && settings.slashName){
|
||||
return `\`${settings.slashName}${(settings.slashOptions) ? this.#renderOptions(settings.slashOptions) : ""}\` ➜ ${settings.slashDescription ?? ""}`
|
||||
|
||||
}else if (mode == "text" && settings.textName){
|
||||
return `\`${settings.textName}${(settings.textOptions) ? this.#renderOptions(settings.textOptions) : ""}\` ➜ ${settings.textDescription ?? ""}`
|
||||
|
||||
}else return ""
|
||||
})
|
||||
}
|
||||
|
||||
/**Utility function to render all command options. */
|
||||
#renderOptions(options:ODHelpMenuCommandComponentOption[]){
|
||||
return " "+options.map((opt) => (opt.optional) ? `[${opt.name}]` : `<${opt.name}>`).join(" ")
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODHelpMenuCategory `class`
|
||||
* This is an Open Ticket help menu category.
|
||||
*
|
||||
* Every category in the help menu is an embed field by default.
|
||||
* Try to limit the amount of components per category.
|
||||
*/
|
||||
export class ODHelpMenuCategory extends ODManager<ODHelpMenuComponent> {
|
||||
/**The id of this category. */
|
||||
id: ODId
|
||||
/**The priority of this category. The higher, the earlier it will appear in the menu. */
|
||||
priority: number
|
||||
/**The name of this category. (can include emoji's) */
|
||||
name: string
|
||||
/**When enabled, it automatically starts this category on a new page. */
|
||||
newPage: boolean
|
||||
|
||||
constructor(id:ODValidId, priority:number, name:string, newPage?:boolean){
|
||||
super()
|
||||
this.id = new ODId(id)
|
||||
this.priority = priority
|
||||
this.name = name
|
||||
this.newPage = newPage ?? false
|
||||
}
|
||||
|
||||
/**Render this category and it's components. */
|
||||
async render(page:number, category:number, mode:"slash"|"text"){
|
||||
//sort from high priority to low
|
||||
const derefArray = [...this.getAll()]
|
||||
derefArray.sort((a,b) => {
|
||||
return b.priority-a.priority
|
||||
})
|
||||
const result: string[] = []
|
||||
|
||||
let i = 0
|
||||
for (const component of derefArray){
|
||||
try {
|
||||
result.push(await component.render(page,category,i,mode))
|
||||
}catch(err){
|
||||
process.emit("uncaughtException",err)
|
||||
}
|
||||
i++
|
||||
}
|
||||
|
||||
//only return the non-empty components
|
||||
return result.filter((component) => component !== "").join("\n\n")
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODHelpMenuRenderResult `type`
|
||||
* This is the array returned when the help menu has been rendered successfully.
|
||||
*
|
||||
* It contains a list of pages, which contain categories by name & value (content).
|
||||
*/
|
||||
export type ODHelpMenuRenderResult = {name:string, value:string}[][]
|
||||
|
||||
/**## ODHelpMenuManager `class`
|
||||
* This is an Open Ticket help menu manager.
|
||||
*
|
||||
* It is responsible for rendering the entire help menu content.
|
||||
* You are also able to configure the amount of categories per page here.
|
||||
*
|
||||
* Fewer Categories == More Clean Menu
|
||||
*/
|
||||
export class ODHelpMenuManager extends ODManager<ODHelpMenuCategory> {
|
||||
/**Alias to Open Ticket debugger. */
|
||||
#debug: ODDebugger
|
||||
/**The amount of categories per-page. */
|
||||
categoriesPerPage: number = 3
|
||||
|
||||
constructor(debug:ODDebugger){
|
||||
super(debug,"help menu category")
|
||||
this.#debug = debug
|
||||
}
|
||||
|
||||
add(data:ODHelpMenuCategory, overwrite?:boolean): boolean {
|
||||
data.useDebug(this.#debug,"help menu component")
|
||||
return super.add(data,overwrite)
|
||||
}
|
||||
|
||||
/**Render this entire help menu & return a `ODHelpMenuRenderResult`. */
|
||||
async render(mode:"slash"|"text"): Promise<ODHelpMenuRenderResult> {
|
||||
//sort from high priority to low
|
||||
const derefArray = [...this.getAll()]
|
||||
derefArray.sort((a,b) => {
|
||||
return b.priority-a.priority
|
||||
})
|
||||
const result: {name:string, value:string}[][] = []
|
||||
let currentPage: {name:string, value:string}[] = []
|
||||
|
||||
for (const category of derefArray){
|
||||
try {
|
||||
const renderedCategory = await category.render(result.length,currentPage.length,mode)
|
||||
|
||||
if (renderedCategory !== ""){
|
||||
//create new page when category wants to
|
||||
if (currentPage.length > 0 && category.newPage){
|
||||
result.push(currentPage)
|
||||
currentPage = []
|
||||
}
|
||||
|
||||
currentPage.push({
|
||||
name:category.name,
|
||||
value:renderedCategory
|
||||
})
|
||||
|
||||
//create new page when page is full
|
||||
if (currentPage.length >= this.categoriesPerPage){
|
||||
result.push(currentPage)
|
||||
currentPage = []
|
||||
}
|
||||
}
|
||||
}catch(err){
|
||||
process.emit("uncaughtException",err)
|
||||
}
|
||||
}
|
||||
|
||||
//push current page when not-empty
|
||||
if (currentPage.length > 0) result.push(currentPage)
|
||||
|
||||
return result
|
||||
}
|
||||
}
|
||||
@@ -1,201 +0,0 @@
|
||||
///////////////////////////////////////
|
||||
//LANGUAGE MODULE
|
||||
///////////////////////////////////////
|
||||
import { ODId, ODManager, ODManagerData, ODPromiseVoid, ODSystemError, ODValidId } from "./base"
|
||||
import nodepath from "path"
|
||||
import { ODDebugger } from "./console"
|
||||
import fs from "fs"
|
||||
|
||||
/**## ODLanguageMetadata `interface`
|
||||
* This interface contains all metadata available in the language files.
|
||||
*/
|
||||
export interface ODLanguageMetadata {
|
||||
/**The version of Open Ticket this translation is made for. */
|
||||
otversion:string,
|
||||
/**The name of the language in english (with capital letter). */
|
||||
language:string,
|
||||
/**A list of translators (discord/github username) who've contributed to this language. */
|
||||
translators:string[],
|
||||
/**The last date that this translation has been modified (format: DD/MM/YYYY) */
|
||||
lastedited:string,
|
||||
/**When `true`, the translator made use of some sort of automation while creating the translation. (e.g. ChatGPT, Google Translate, DeepL, ...) */
|
||||
automated:boolean
|
||||
}
|
||||
|
||||
/**## ODLanguageManager `class`
|
||||
* This is an Open Ticket language manager.
|
||||
*
|
||||
* It manages all languages in the bot and manages translation for you!
|
||||
* Get a translation via the `getTranslation()` or `getTranslationWithParams()` methods.
|
||||
*
|
||||
* Add new languages using the `ODlanguage` class in your plugin!
|
||||
*/
|
||||
export class ODLanguageManager extends ODManager<ODLanguage> {
|
||||
/**The currently selected language. */
|
||||
current: ODLanguage|null = null
|
||||
/**The currently selected backup language. (used when translation missing in current language) */
|
||||
backup: ODLanguage|null = null
|
||||
/**An alias to Open Ticket debugger. */
|
||||
#debug: ODDebugger
|
||||
|
||||
constructor(debug:ODDebugger, presets:boolean){
|
||||
super(debug,"language")
|
||||
if (presets) this.add(new ODLanguage("english","english.json"))
|
||||
this.current = presets ? new ODLanguage("english","english.json") : null
|
||||
this.backup = presets ? new ODLanguage("english","english.json") : null
|
||||
this.#debug = debug
|
||||
}
|
||||
|
||||
/**Set the current language by providing the ID of a language which is registered in this manager. */
|
||||
setCurrentLanguage(id:ODValidId){
|
||||
this.current = this.get(id)
|
||||
const languageId = this.current?.id.value ?? "<unknown-id>"
|
||||
const languageAutomated = this.current?.metadata?.automated.toString() ?? "<unknown-metadata>"
|
||||
this.#debug.debug("Selected current language",[
|
||||
{key:"id",value:languageId},
|
||||
{key:"automated",value:languageAutomated},
|
||||
])
|
||||
}
|
||||
/**Get the current language (same as `this.current`) */
|
||||
getCurrentLanguage(){
|
||||
return (this.current) ? this.current : null
|
||||
}
|
||||
/**Set the backup language by providing the ID of a language which is registered in this manager. */
|
||||
setBackupLanguage(id:ODValidId){
|
||||
this.backup = this.get(id)
|
||||
const languageId = this.backup?.id.value ?? "<unknown-id>"
|
||||
const languageAutomated = this.backup?.metadata?.automated.toString() ?? "<unknown-metadata>"
|
||||
this.#debug.debug("Selected backup language",[
|
||||
{key:"id",value:languageId},
|
||||
{key:"automated",value:languageAutomated},
|
||||
])
|
||||
}
|
||||
/**Get the backup language (same as `this.backup`) */
|
||||
getBackupLanguage(){
|
||||
return (this.backup) ? this.backup : null
|
||||
}
|
||||
/**Get the metadata of the current/backup language. */
|
||||
getLanguageMetadata(frombackup?:boolean): ODLanguageMetadata|null {
|
||||
if (frombackup) return (this.backup) ? this.backup.metadata : null
|
||||
return (this.current) ? this.current.metadata : null
|
||||
}
|
||||
/**Get the ID (string) of the current language. (Not backup language) */
|
||||
getCurrentLanguageId(){
|
||||
return (this.current) ? this.current.id.value : ""
|
||||
}
|
||||
/**Get a translation string by JSON location. (e.g. `"checker.system.typeError"`) */
|
||||
getTranslation(id:string): string|null {
|
||||
if (!this.current) return this.#getBackupTranslation(id)
|
||||
|
||||
const splitted = id.split(".")
|
||||
let currentObject = this.current.data
|
||||
let result: string|false = false
|
||||
splitted.forEach((id) => {
|
||||
if (typeof currentObject[id] == "object"){
|
||||
currentObject = currentObject[id]
|
||||
}else if (typeof currentObject[id] == "string"){
|
||||
result = currentObject[id]
|
||||
}
|
||||
})
|
||||
|
||||
if (typeof result == "string") return result
|
||||
else return this.#getBackupTranslation(id)
|
||||
}
|
||||
/**Get a backup translation string by JSON location. (system only) */
|
||||
#getBackupTranslation(id:string): string|null {
|
||||
if (!this.backup) return null
|
||||
|
||||
const splitted = id.split(".")
|
||||
let currentObject = this.backup.data
|
||||
let result: string|false = false
|
||||
splitted.forEach((id) => {
|
||||
if (typeof currentObject[id] == "object"){
|
||||
currentObject = currentObject[id]
|
||||
}else if (typeof currentObject[id] == "string"){
|
||||
result = currentObject[id]
|
||||
}
|
||||
})
|
||||
|
||||
if (typeof result == "string") return result
|
||||
else return null
|
||||
}
|
||||
/**Get a backup translation string by JSON location and replace `{0}`,`{1}`,`{2}`,... with the provided parameters. */
|
||||
getTranslationWithParams(id:string, params:string[]): string|null {
|
||||
let translation = this.getTranslation(id)
|
||||
if (!translation) return translation
|
||||
|
||||
params.forEach((value,index) => {
|
||||
if (!translation) return
|
||||
translation = translation.replace(`{${index}}`,value)
|
||||
})
|
||||
return translation
|
||||
}
|
||||
|
||||
/**Init all language files. */
|
||||
async init(){
|
||||
for (const language of this.getAll()){
|
||||
try{
|
||||
await language.init()
|
||||
}catch(err){
|
||||
process.emit("uncaughtException",new ODSystemError(err))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODLanguage `class`
|
||||
* This is an Open Ticket language file.
|
||||
*
|
||||
* It contains metadata and all translation strings available in this language.
|
||||
* Register this class to an `ODLanguageManager` to use it!
|
||||
*
|
||||
* JSON languages should be created using the `ODJsonLanguage` class instead!
|
||||
*/
|
||||
export class ODLanguage extends ODManagerData {
|
||||
/**The name of the file with extension. */
|
||||
file: string = ""
|
||||
/**The path to the file relative to the main directory. */
|
||||
path: string = ""
|
||||
/**The raw object data of the translation. */
|
||||
data: any
|
||||
/**The metadata of the language if available. */
|
||||
metadata: ODLanguageMetadata|null = null
|
||||
|
||||
constructor(id:ODValidId, data:any){
|
||||
super(id)
|
||||
this.data = data
|
||||
}
|
||||
|
||||
/**Init the language. */
|
||||
init(): ODPromiseVoid {
|
||||
//nothing
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODJsonLanguage `class`
|
||||
* This is an Open Ticket JSON language file.
|
||||
*
|
||||
* It contains metadata and all translation strings from a certain JSON file (in `./languages/`).
|
||||
* Register this class to an `ODLanguageManager` to use it!
|
||||
*
|
||||
* Use the `ODLanguage` class to use translations from non-JSON files!
|
||||
*/
|
||||
export class ODJsonLanguage extends ODLanguage {
|
||||
constructor(id:ODValidId, file:string, customPath?:string){
|
||||
super(id,{})
|
||||
this.file = (file.endsWith(".json")) ? file : file+".json"
|
||||
this.path = customPath ? nodepath.join("./",customPath,this.file) : nodepath.join("./languages/",this.file)
|
||||
}
|
||||
|
||||
/**Init the langauge. */
|
||||
init(): ODPromiseVoid {
|
||||
if (!fs.existsSync(this.path)) throw new ODSystemError("Unable to parse language \""+nodepath.join("./",this.path)+"\", the file doesn't exist!")
|
||||
try{
|
||||
this.data = JSON.parse(fs.readFileSync(this.path).toString())
|
||||
}catch(err){
|
||||
process.emit("uncaughtException",err)
|
||||
throw new ODSystemError("Unable to parse language \""+nodepath.join("./",this.path)+"\"!")
|
||||
}
|
||||
if (this.data["_TRANSLATION"]) this.metadata = this.data["_TRANSLATION"]
|
||||
}
|
||||
}
|
||||
@@ -1,340 +0,0 @@
|
||||
///////////////////////////////////////
|
||||
//PERMISSION MODULE
|
||||
///////////////////////////////////////
|
||||
import { ODId, ODValidId, ODManager, ODSystemError, ODManagerData } from "./base"
|
||||
import * as discord from "discord.js"
|
||||
import { ODDebugger } from "./console"
|
||||
import { ODClientManager } from "./client"
|
||||
|
||||
/**## ODPermissionType `type`
|
||||
* All available permission types/levels. Can be used in the `ODPermission` class.
|
||||
*/
|
||||
export type ODPermissionType = "member"|"support"|"moderator"|"admin"|"owner"|"developer"
|
||||
|
||||
/**## ODPermissionScope `type`
|
||||
* The scope in which a certain permission is active.
|
||||
*/
|
||||
export type ODPermissionScope = "global-user"|"channel-user"|"global-role"|"channel-role"
|
||||
|
||||
/**## ODPermissionResult `interface`
|
||||
* The result returned by `ODPermissionManager.getPermissions()`.
|
||||
*/
|
||||
export interface ODPermissionResult {
|
||||
/**The permission type. */
|
||||
type:ODPermissionType
|
||||
/**The permission scope. */
|
||||
scope:ODPermissionScope|"default"
|
||||
/**The highest level available for this scope. */
|
||||
level:ODPermissionLevel,
|
||||
/**The permission which returned this level. */
|
||||
source:ODPermission|null
|
||||
}
|
||||
|
||||
/**## ODPermissionLevel `enum`
|
||||
* All available permission types/levels. But as `enum` instead of `type`. Used to calculate the level.
|
||||
*/
|
||||
export enum ODPermissionLevel {
|
||||
/**A normal member. (Default for everyone) */
|
||||
member,
|
||||
/**Support team. Higher than a normal member. (Used for ticket-admins) */
|
||||
support,
|
||||
/**Moderator. Higher than the support team. (Unused) */
|
||||
moderator,
|
||||
/**Admin. Higher than a moderator. (Used for global-admins) */
|
||||
admin,
|
||||
/**Server owner. (Able to use all commands including `/stats reset`) */
|
||||
owner,
|
||||
/**Bot owner or all users from dev team. (Able to use all commands including `/stats reset`) */
|
||||
developer
|
||||
}
|
||||
|
||||
/**## ODPermission `class`
|
||||
* This is an Open Ticket permission.
|
||||
*
|
||||
* It defines a single permission level for a specific scope (global/channel & user/role)
|
||||
* These permissions only apply to commands & interactions.
|
||||
* They are not related to channel permissions in the ticket system.
|
||||
*
|
||||
* Register this class to an `ODPermissionManager` to use it!
|
||||
*/
|
||||
export class ODPermission extends ODManagerData {
|
||||
/**The scope of this permission. */
|
||||
readonly scope: ODPermissionScope
|
||||
/**The type/level of this permission. */
|
||||
readonly permission: ODPermissionType
|
||||
/**The user/role of this permission. */
|
||||
readonly value: discord.Role|discord.User
|
||||
/**The channel that this permission applies to. (`null` when global) */
|
||||
readonly channel: discord.Channel|null
|
||||
|
||||
constructor(id:ODValidId, scope:"global-user", permission:ODPermissionType, value:discord.User)
|
||||
constructor(id:ODValidId, scope:"global-role", permission:ODPermissionType, value:discord.Role)
|
||||
constructor(id:ODValidId, scope:"channel-user", permission:ODPermissionType, value:discord.User, channel:discord.Channel)
|
||||
constructor(id:ODValidId, scope:"channel-role", permission:ODPermissionType, value:discord.Role, channel:discord.Channel)
|
||||
constructor(id:ODValidId, scope:ODPermissionScope, permission:ODPermissionType, value:discord.Role|discord.User, channel?:discord.Channel){
|
||||
super(id)
|
||||
this.scope = scope
|
||||
this.permission = permission
|
||||
this.value = value
|
||||
this.channel = channel ?? null
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODPermissionSettings `interface`
|
||||
* Optional settings for the `getPermissions()` method in the `ODPermissionManager`.
|
||||
*/
|
||||
export interface ODPermissionSettings {
|
||||
/**Include permissions from the global user scope. */
|
||||
allowGlobalUserScope?:boolean,
|
||||
/**Include permissions from the global role scope. */
|
||||
allowGlobalRoleScope?:boolean,
|
||||
/**Include permissions from the channel user scope. */
|
||||
allowChannelUserScope?:boolean,
|
||||
/**Include permissions from the channel role scope. */
|
||||
allowChannelRoleScope?:boolean,
|
||||
/**Only include permissions of which the id matches this regex. */
|
||||
idRegex?:RegExp
|
||||
}
|
||||
|
||||
/**## ODPermissionCalculationCallback `type`
|
||||
* The callback of the permission calculation. (Used in `ODPermissionManager`)
|
||||
*/
|
||||
export type ODPermissionCalculationCallback = (user:discord.User, channel?:discord.Channel|null, guild?:discord.Guild|null, settings?:ODPermissionSettings|null) => Promise<ODPermissionResult>
|
||||
|
||||
/**## ODPermissionCommandResult `type`
|
||||
* The result of calculating permissions for a command.
|
||||
*/
|
||||
export type ODPermissionCommandResult = {
|
||||
/**Returns `true` when the user has valid permissions. */
|
||||
hasPerms:false,
|
||||
reason:"no-perms"|"disabled"|"not-in-server"
|
||||
}|{
|
||||
/**Returns `true` when the user has valid permissions. */
|
||||
hasPerms:true,
|
||||
/**Is the user a server admin or a normal member? This does not decide if the user has permissions or not. */
|
||||
isAdmin:boolean
|
||||
}
|
||||
|
||||
/**## ODPermissionManager `class`
|
||||
* This is an Open Ticket permission manager.
|
||||
*
|
||||
* It manages all permissions in the bot!
|
||||
* Use the `getPermissions()` and `hasPermissions()` methods to get user perms.
|
||||
*
|
||||
* Add new permissions using the `ODPermission` class in your plugin!
|
||||
*/
|
||||
export class ODPermissionManager extends ODManager<ODPermission> {
|
||||
/**Alias for Open Ticket debugger. */
|
||||
#debug: ODDebugger
|
||||
/**The function for calculating permissions in this manager. */
|
||||
#calculation: ODPermissionCalculationCallback|null
|
||||
/**An alias to the Open Discord client manager. */
|
||||
#client: ODClientManager
|
||||
/**The result which is returned when no other permissions match. (`member` by default) */
|
||||
defaultResult: ODPermissionResult = {
|
||||
level:ODPermissionLevel["member"],
|
||||
scope:"default",
|
||||
type:"member",
|
||||
source:null
|
||||
}
|
||||
|
||||
constructor(debug:ODDebugger, client:ODClientManager, useDefaultCalculation?:boolean){
|
||||
super(debug,"permission")
|
||||
this.#debug = debug
|
||||
this.#calculation = useDefaultCalculation ? this.#defaultCalculation : null
|
||||
this.#client = client
|
||||
}
|
||||
|
||||
/**Edit the permission calculation function in this manager. */
|
||||
setCalculation(calculation:ODPermissionCalculationCallback){
|
||||
this.#calculation = calculation
|
||||
}
|
||||
/**Edit the result which is returned when no other permissions match. (`member` by default) */
|
||||
setDefaultResult(result:ODPermissionResult){
|
||||
this.defaultResult = result
|
||||
}
|
||||
/**Get an `ODPermissionResult` based on a few context factors. Use `hasPermissions()` to simplify the result. */
|
||||
getPermissions(user:discord.User, channel?:discord.Channel|null, guild?:discord.Guild|null, settings?:ODPermissionSettings|null): Promise<ODPermissionResult> {
|
||||
try{
|
||||
if (!this.#calculation) throw new ODSystemError("ODPermissionManager:getPermissions() => missing perms calculation")
|
||||
return this.#calculation(user,channel,guild,settings)
|
||||
}catch(err){
|
||||
process.emit("uncaughtException",err)
|
||||
throw new ODSystemError("ODPermissionManager:getPermissions() => failed perms calculation")
|
||||
}
|
||||
}
|
||||
/**Simplifies the `ODPermissionResult` returned from `getPermissions()` and returns a boolean to check if the user matches the required permissions. */
|
||||
hasPermissions(minimum:ODPermissionType, data:ODPermissionResult){
|
||||
if (minimum == "member") return true
|
||||
else if (minimum == "support") return (data.level >= ODPermissionLevel["support"])
|
||||
else if (minimum == "moderator") return (data.level >= ODPermissionLevel["moderator"])
|
||||
else if (minimum == "admin") return (data.level >= ODPermissionLevel["admin"])
|
||||
else if (minimum == "owner") return (data.level >= ODPermissionLevel["owner"])
|
||||
else if (minimum == "developer") return (data.level >= ODPermissionLevel["developer"])
|
||||
else throw new ODSystemError("Invalid minimum permission type at ODPermissionManager.hasPermissions()")
|
||||
}
|
||||
/**Check for permissions. (default calculation) */
|
||||
async #defaultCalculation(user:discord.User,channel?:discord.Channel|null,guild?:discord.Guild|null, settings?:ODPermissionSettings|null): Promise<ODPermissionResult> {
|
||||
const globalCalc = await this.#defaultGlobalCalculation(user,channel,guild,settings)
|
||||
const channelCalc = await this.#defaultChannelCalculation(user,channel,guild,settings)
|
||||
|
||||
if (globalCalc.level > channelCalc.level) return globalCalc
|
||||
else return channelCalc
|
||||
}
|
||||
/**Check for global permissions. Result will be compared with the channel perms in `#defaultCalculation()`. */
|
||||
async #defaultGlobalCalculation(user:discord.User,channel?:discord.Channel|null,guild?:discord.Guild|null, settings?:ODPermissionSettings|null): Promise<ODPermissionResult> {
|
||||
const idRegex = (settings && typeof settings.idRegex != "undefined") ? settings.idRegex : null
|
||||
const allowGlobalUserScope = (settings && typeof settings.allowGlobalUserScope != "undefined") ? settings.allowGlobalUserScope : true
|
||||
const allowGlobalRoleScope = (settings && typeof settings.allowGlobalRoleScope != "undefined") ? settings.allowGlobalRoleScope : true
|
||||
|
||||
//check for global user permissions
|
||||
if (allowGlobalUserScope){
|
||||
const users = this.getFiltered((permission) => (!idRegex || (idRegex && idRegex.test(permission.id.value))) && permission.scope == "global-user" && (permission.value instanceof discord.User) && permission.value.id == user.id)
|
||||
|
||||
if (users.length > 0){
|
||||
//sort all permisions from highest to lowest
|
||||
users.sort((a,b) => {
|
||||
const levelA = ODPermissionLevel[a.permission]
|
||||
const levelB = ODPermissionLevel[b.permission]
|
||||
|
||||
if (levelB > levelA) return 1
|
||||
else if (levelA > levelB) return -1
|
||||
else return 0
|
||||
})
|
||||
|
||||
return {
|
||||
type:users[0].permission,
|
||||
scope:"global-user",
|
||||
level:ODPermissionLevel[users[0].permission],
|
||||
source:users[0] ?? null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//check for global role permissions
|
||||
if (allowGlobalRoleScope){
|
||||
if (guild){
|
||||
const member = await this.#client.fetchGuildMember(guild,user.id)
|
||||
if (member){
|
||||
const memberRoles = member.roles.cache.map((role) => role.id)
|
||||
const roles = this.getFiltered((permission) => (!idRegex || (idRegex && idRegex.test(permission.id.value))) && permission.scope == "global-role" && (permission.value instanceof discord.Role) && memberRoles.includes(permission.value.id) && permission.value.guild.id == guild.id)
|
||||
|
||||
if (roles.length > 0){
|
||||
//sort all permisions from highest to lowest
|
||||
roles.sort((a,b) => {
|
||||
const levelA = ODPermissionLevel[a.permission]
|
||||
const levelB = ODPermissionLevel[b.permission]
|
||||
|
||||
if (levelB > levelA) return 1
|
||||
else if (levelA > levelB) return -1
|
||||
else return 0
|
||||
})
|
||||
|
||||
return {
|
||||
type:roles[0].permission,
|
||||
scope:"global-role",
|
||||
level:ODPermissionLevel[roles[0].permission],
|
||||
source:roles[0] ?? null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//spread result to prevent accidental referencing
|
||||
return {...this.defaultResult}
|
||||
}
|
||||
/**Check for channel permissions. Result will be compared with the global perms in `#defaultCalculation()`. */
|
||||
async #defaultChannelCalculation(user:discord.User,channel?:discord.Channel|null,guild?:discord.Guild|null, settings?:ODPermissionSettings|null): Promise<ODPermissionResult> {
|
||||
const idRegex = (settings && typeof settings.idRegex != "undefined") ? settings.idRegex : null
|
||||
const allowChannelUserScope = (settings && typeof settings.allowChannelUserScope != "undefined") ? settings.allowChannelUserScope : true
|
||||
const allowChannelRoleScope = (settings && typeof settings.allowChannelRoleScope != "undefined") ? settings.allowChannelRoleScope : true
|
||||
|
||||
if (guild && channel && !channel.isDMBased()){
|
||||
//check for channel user permissions
|
||||
if (allowChannelUserScope){
|
||||
const users = this.getFiltered((permission) => (!idRegex || (idRegex && idRegex.test(permission.id.value))) && permission.scope == "channel-user" && permission.channel && (permission.channel.id == channel.id) && (permission.value instanceof discord.User) && permission.value.id == user.id)
|
||||
|
||||
if (users.length > 0){
|
||||
//sort all permisions from highest to lowest
|
||||
users.sort((a,b) => {
|
||||
const levelA = ODPermissionLevel[a.permission]
|
||||
const levelB = ODPermissionLevel[b.permission]
|
||||
|
||||
if (levelB > levelA) return 1
|
||||
else if (levelA > levelB) return -1
|
||||
else return 0
|
||||
})
|
||||
|
||||
return {
|
||||
type:users[0].permission,
|
||||
scope:"channel-user",
|
||||
level:ODPermissionLevel[users[0].permission],
|
||||
source:users[0] ?? null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//check for channel role permissions
|
||||
if (allowChannelRoleScope){
|
||||
const member = await this.#client.fetchGuildMember(guild,user.id)
|
||||
if (member){
|
||||
const memberRoles = member.roles.cache.map((role) => role.id)
|
||||
const roles = this.getFiltered((permission) => (!idRegex || (idRegex && idRegex.test(permission.id.value))) && permission.scope == "channel-role" && permission.channel && (permission.channel.id == channel.id) && (permission.value instanceof discord.Role) && memberRoles.includes(permission.value.id) && permission.value.guild.id == guild.id)
|
||||
|
||||
if (roles.length > 0){
|
||||
//sort all permisions from highest to lowest
|
||||
roles.sort((a,b) => {
|
||||
const levelA = ODPermissionLevel[a.permission]
|
||||
const levelB = ODPermissionLevel[b.permission]
|
||||
|
||||
if (levelB > levelA) return 1
|
||||
else if (levelA > levelB) return -1
|
||||
else return 0
|
||||
})
|
||||
|
||||
return {
|
||||
type:roles[0].permission,
|
||||
scope:"channel-role",
|
||||
level:ODPermissionLevel[roles[0].permission],
|
||||
source:roles[0] ?? null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//spread result to prevent accidental modification because of referencing
|
||||
return {...this.defaultResult}
|
||||
}
|
||||
|
||||
/**Check the permissions for a certain command of the bot. */
|
||||
async checkCommandPerms(permissionMode:string,requiredLevel:ODPermissionType,user:discord.User,member?:discord.GuildMember|null,channel?:discord.Channel|null,guild?:discord.Guild|null,settings?:ODPermissionSettings): Promise<ODPermissionCommandResult> {
|
||||
if (permissionMode === "none"){
|
||||
return {hasPerms:false,reason:"disabled"}
|
||||
|
||||
}else if (permissionMode === "everyone"){
|
||||
const isAdmin = this.hasPermissions(requiredLevel,await this.getPermissions(user,channel,guild,settings))
|
||||
return {hasPerms:true,isAdmin}
|
||||
|
||||
}else if (permissionMode === "admin"){
|
||||
const isAdmin = this.hasPermissions(requiredLevel,await this.getPermissions(user,channel,guild,settings))
|
||||
if (!isAdmin) return {hasPerms:false,reason:"no-perms"}
|
||||
else return {hasPerms:true,isAdmin}
|
||||
}else{
|
||||
if (!guild || !member){
|
||||
this.#debug.debug("ODPermissionManager.checkCommandPerms(): Permission Error, Not in server! (#1)")
|
||||
return {hasPerms:false,reason:"not-in-server"}
|
||||
}
|
||||
const role = await this.#client.fetchGuildRole(guild,permissionMode)
|
||||
if (!role){
|
||||
this.#debug.debug("ODPermissionManager.checkCommandPerms(): Permission Error, Not in server! (#2)")
|
||||
return {hasPerms:false,reason:"not-in-server"}
|
||||
}
|
||||
if (!role.members.has(member.id)) return {hasPerms:false,reason:"no-perms"}
|
||||
|
||||
const isAdmin = this.hasPermissions(requiredLevel,await this.getPermissions(user,channel,guild,settings))
|
||||
return {hasPerms:true,isAdmin}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,242 +0,0 @@
|
||||
///////////////////////////////////////
|
||||
//PLUGIN MODULE
|
||||
///////////////////////////////////////
|
||||
import { ODId, ODManager, ODManagerData, ODSystemError, ODValidId, ODVersion } from "./base"
|
||||
import nodepath from "path"
|
||||
import { ODConsolePluginMessage, ODConsoleWarningMessage, ODDebugger } from "./console"
|
||||
|
||||
/**## ODUnknownCrashedPlugin `interface`
|
||||
* Basic details for a plugin that crashed while loading the `plugin.json` file.
|
||||
*/
|
||||
export interface ODUnknownCrashedPlugin {
|
||||
/**The name of the plugin. (path when plugin crashed before `name` was loaded) */
|
||||
name:string,
|
||||
/**The description of the plugin. (when found before crashing) */
|
||||
description:string
|
||||
}
|
||||
|
||||
/**## ODPluginManager `class`
|
||||
* This is an Open Ticket plugin manager.
|
||||
*
|
||||
* It manages all active plugins in the bot!
|
||||
* It also contains all "plugin classes" which are managers registered by plugins.
|
||||
* These are accessible via the `opendiscord.plugins.classes` global.
|
||||
*
|
||||
* Use `isPluginLoaded()` to check if a plugin has been loaded.
|
||||
*/
|
||||
export class ODPluginManager extends ODManager<ODPlugin> {
|
||||
/**A manager for all custom managers registered by plugins. */
|
||||
classes: ODPluginClassManager
|
||||
/**A list of basic details from all plugins that crashed while loading the `plugin.json` file. */
|
||||
unknownCrashedPlugins: ODUnknownCrashedPlugin[] = []
|
||||
|
||||
constructor(debug:ODDebugger){
|
||||
super(debug,"plugin")
|
||||
this.classes = new ODPluginClassManager(debug)
|
||||
}
|
||||
|
||||
/**Check if a plugin has been loaded successfully and is available for usage.*/
|
||||
isPluginLoaded(id:ODValidId): boolean {
|
||||
const newId = new ODId(id)
|
||||
const plugin = this.get(newId)
|
||||
return (plugin !== null && plugin.executed)
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODPluginData `interface`
|
||||
* Parsed data from the `plugin.json` file in a plugin.
|
||||
*/
|
||||
export interface ODPluginData {
|
||||
/**The name of this plugin (shown on startup) */
|
||||
name:string,
|
||||
/**The id of this plugin. (Must be identical to directory name) */
|
||||
id:string,
|
||||
/**The version of this plugin. */
|
||||
version:string,
|
||||
/**The location of the start file of the plugin relative to the rootDir of the plugin */
|
||||
startFile:string,
|
||||
/**A list of compatible versions. (e.g. `["OTv4.0.x", "OMv1.x.x"]`) (optional, will be required in future version)
|
||||
* - `OT` --> Open Ticket support
|
||||
* - `OM` --> Open Moderation support
|
||||
*/
|
||||
supportedVersions?:string[],
|
||||
|
||||
/**Is this plugin enabled? */
|
||||
enabled:boolean,
|
||||
/**The priority of this plugin. Higher priority will load before lower priority. */
|
||||
priority:number,
|
||||
/**A list of events to register to the `opendiscord.events` global before loading any plugins. This way, plugins with a higher priority are able to use events from this plugin as well! */
|
||||
events:string[]
|
||||
|
||||
/**Npm dependencies which are required for this plugin to work. */
|
||||
npmDependencies:string[],
|
||||
/**Plugins which are required for this plugin to work. */
|
||||
requiredPlugins:string[],
|
||||
/**Plugins which are incompatible with this plugin. */
|
||||
incompatiblePlugins:string[],
|
||||
|
||||
/**Additional details about this plugin. */
|
||||
details:ODPluginDetails
|
||||
}
|
||||
|
||||
/**## ODPluginDetails `interface`
|
||||
* Additional details in the `plugin.json` file from a plugin.
|
||||
*/
|
||||
export interface ODPluginDetails {
|
||||
/**The main author of the plugin. Additional contributors can be specified in `contributors`. */
|
||||
author:string,
|
||||
/**A list of plugin contributors. (optional, will be required in future version) */
|
||||
contributors?:string[],
|
||||
/**A short description of this plugin. */
|
||||
shortDescription:string,
|
||||
/**A large description of this plugin. */
|
||||
longDescription:string,
|
||||
/**A URL to a cover image of this plugin. (currently unused) */
|
||||
imageUrl:string,
|
||||
/**A URL to the website/project page of this plugin. (currently unused) */
|
||||
projectUrl:string,
|
||||
/**A list of tags/categories that this plugin affects. */
|
||||
tags:string[]
|
||||
}
|
||||
|
||||
/**## ODPlugin `class`
|
||||
* This is an Open Ticket plugin.
|
||||
*
|
||||
* It represents a single plugin in the `./plugins/` directory.
|
||||
* All plugins are accessible via the `opendiscord.plugins` global.
|
||||
*
|
||||
* Don't re-execute plugins which are already enabled! It might break the bot or plugin.
|
||||
*/
|
||||
export class ODPlugin extends ODManagerData {
|
||||
/**The name of the directory of this plugin. (same as id) */
|
||||
dir: string
|
||||
/**All plugin data found in the `plugin.json` file. */
|
||||
data: ODPluginData
|
||||
/**The name of this plugin. */
|
||||
name: string
|
||||
/**The priority of this plugin. */
|
||||
priority: number
|
||||
/**The version of this plugin. */
|
||||
version: ODVersion
|
||||
/**The additional details of this plugin. */
|
||||
details: ODPluginDetails
|
||||
|
||||
/**Is this plugin enabled? */
|
||||
enabled: boolean
|
||||
/**Did this plugin execute successfully?. */
|
||||
executed: boolean
|
||||
/**Did this plugin crash? (A reason is available in the `crashReason`) */
|
||||
crashed: boolean
|
||||
/**The reason which caused this plugin to crash. */
|
||||
crashReason: null|"incompatible.plugin"|"missing.plugin"|"missing.dependency"|"incompatible.version"|"executed" = null
|
||||
|
||||
constructor(dir:string, jsondata:ODPluginData){
|
||||
super(jsondata.id)
|
||||
this.dir = dir
|
||||
this.data = jsondata
|
||||
this.name = jsondata.name
|
||||
this.priority = jsondata.priority
|
||||
this.version = ODVersion.fromString("plugin",jsondata.version)
|
||||
this.details = jsondata.details
|
||||
|
||||
this.enabled = jsondata.enabled
|
||||
this.executed = false
|
||||
this.crashed = false
|
||||
}
|
||||
|
||||
/**Get the startfile location relative to the `./plugins/` directory. (`./dist/plugins/`) when compiled) */
|
||||
getStartFile(){
|
||||
const newFile = this.data.startFile.replace(/\.ts$/,".js")
|
||||
return nodepath.join(this.dir,newFile)
|
||||
}
|
||||
/**Execute this plugin. Returns `false` on crash. */
|
||||
async execute(debug:ODDebugger,force?:boolean): Promise<boolean> {
|
||||
if ((this.enabled && !this.crashed) || force){
|
||||
try{
|
||||
//import relative plugin directory path (works on windows & unix based systems)
|
||||
const pluginPath = nodepath.join("../../../../plugins/",this.getStartFile()).replaceAll("\\","/")
|
||||
await import(pluginPath)
|
||||
debug.console.log("Plugin \""+this.id.value+"\" loaded successfully!","plugin")
|
||||
this.executed = true
|
||||
return true
|
||||
}catch(error){
|
||||
this.crashed = true
|
||||
this.crashReason = "executed"
|
||||
|
||||
debug.console.log(error.message+", canceling plugin execution...","plugin",[
|
||||
{key:"path",value:"./plugins/"+this.dir}
|
||||
])
|
||||
debug.console.log("You can see more about this error in the ./otdebug.txt file!","info")
|
||||
debug.console.debugfile.writeText(error.stack)
|
||||
|
||||
return false
|
||||
}
|
||||
}else return true
|
||||
}
|
||||
|
||||
/**Check if a npm dependency exists. */
|
||||
#checkDependency(id:string){
|
||||
try{
|
||||
require.resolve(id)
|
||||
return true
|
||||
}catch{
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
/**Get a list of all missing npm dependencies that are required for this plugin. */
|
||||
dependenciesInstalled(){
|
||||
const missing: string[] = []
|
||||
this.data.npmDependencies.forEach((d) => {
|
||||
if (!this.#checkDependency(d)){
|
||||
missing.push(d)
|
||||
}
|
||||
})
|
||||
|
||||
return missing
|
||||
}
|
||||
/**Get a list of all missing plugins that are required for this plugin. */
|
||||
pluginsInstalled(manager:ODPluginManager){
|
||||
const missing: string[] = []
|
||||
this.data.requiredPlugins.forEach((p) => {
|
||||
const plugin = manager.get(p)
|
||||
if (!plugin || !plugin.enabled){
|
||||
missing.push(p)
|
||||
}
|
||||
})
|
||||
|
||||
return missing
|
||||
}
|
||||
/**Get a list of all enabled incompatible plugins that interfere with this plugin. */
|
||||
pluginsIncompatible(manager:ODPluginManager){
|
||||
const incompatible: string[] = []
|
||||
this.data.incompatiblePlugins.forEach((p) => {
|
||||
const plugin = manager.get(p)
|
||||
if (plugin && plugin.enabled){
|
||||
incompatible.push(p)
|
||||
}
|
||||
})
|
||||
|
||||
return incompatible
|
||||
}
|
||||
/**Get a list of all authors & contributors of this plugin. */
|
||||
getAuthors(): string[] {
|
||||
return [this.details.author,...(this.details.contributors ?? [])]
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODPluginClassManager `class`
|
||||
* This is an Open Ticket plugin class manager.
|
||||
*
|
||||
* It manages all managers registered by plugins!
|
||||
* Plugins are able to register their own managers, handlers, functions, classes, ... here.
|
||||
* By doing this, other plugins are also able to make use of it.
|
||||
* This can be useful for plugins that want to extend other plugins.
|
||||
*
|
||||
* Use `isPluginLoaded()` to check if a plugin has been loaded before trying to access the manager.
|
||||
*/
|
||||
export class ODPluginClassManager extends ODManager<ODManagerData> {
|
||||
constructor(debug:ODDebugger){
|
||||
super(debug,"plugin class")
|
||||
}
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
///////////////////////////////////////
|
||||
//POST MODULE
|
||||
///////////////////////////////////////
|
||||
import { ODId, ODManager, ODManagerData, ODValidId } from "./base"
|
||||
import { ODMessageBuildResult, ODMessageBuildSentResult } from "./builder"
|
||||
import { ODDebugger } from "./console"
|
||||
import * as discord from "discord.js"
|
||||
|
||||
/**## ODPostManager `class`
|
||||
* This is an Open Ticket post manager.
|
||||
*
|
||||
* It manages `ODPosts`'s for you.
|
||||
*
|
||||
* You can use this to get the logs channel of the bot (or some other static channel/category).
|
||||
*/
|
||||
export class ODPostManager extends ODManager<ODPost<discord.GuildBasedChannel>> {
|
||||
/**A reference to the main server of the bot */
|
||||
#guild: discord.Guild|null = null
|
||||
|
||||
constructor(debug:ODDebugger){
|
||||
super(debug,"post")
|
||||
}
|
||||
|
||||
add(data:ODPost<discord.GuildBasedChannel>, overwrite?:boolean): boolean {
|
||||
if (this.#guild) data.useGuild(this.#guild)
|
||||
return super.add(data,overwrite)
|
||||
}
|
||||
/**Initialize the post manager & all posts. */
|
||||
async init(guild:discord.Guild){
|
||||
this.#guild = guild
|
||||
for (const post of this.getAll()){
|
||||
post.useGuild(guild)
|
||||
await post.init()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODPost `class`
|
||||
* This is an Open Ticket post class.
|
||||
*
|
||||
* A post is just a shortcut to a static discord channel or category.
|
||||
* This can be used to get a specific channel over and over again!
|
||||
*
|
||||
* This class also contains utilities for sending messages via the Open Ticket builders.
|
||||
*/
|
||||
export class ODPost<ChannelType extends discord.GuildBasedChannel> extends ODManagerData {
|
||||
/**A reference to the main server of the bot */
|
||||
#guild: discord.Guild|null = null
|
||||
/**Is this post already initialized? */
|
||||
ready: boolean = false
|
||||
/**The discord.js channel */
|
||||
channel: ChannelType|null = null
|
||||
/**The discord channel id */
|
||||
channelId: string
|
||||
|
||||
constructor(id:ODValidId, channelId:string){
|
||||
super(id)
|
||||
this.channelId = channelId
|
||||
}
|
||||
|
||||
/**Use a specific guild in this class for fetching the channel*/
|
||||
useGuild(guild:discord.Guild|null){
|
||||
this.#guild = guild
|
||||
}
|
||||
/**Change the channel id to another channel! */
|
||||
setChannelId(id:string){
|
||||
this.channelId = id
|
||||
}
|
||||
/**Initialize the discord.js channel of this post. */
|
||||
async init(){
|
||||
if (this.ready) return
|
||||
if (!this.#guild) return this.channel = null
|
||||
try{
|
||||
this.channel = await this.#guild.channels.fetch(this.channelId) as ChannelType
|
||||
}catch{
|
||||
this.channel = null
|
||||
}
|
||||
this.ready = true
|
||||
}
|
||||
/**Send a message to this channel using the Open Ticket builder system */
|
||||
async send(msg:ODMessageBuildResult): Promise<ODMessageBuildSentResult<true>> {
|
||||
if (!this.channel || !this.channel.isTextBased()) return {success:false,message:null}
|
||||
try{
|
||||
const sent = await this.channel.send(msg.message)
|
||||
return {success:true,message:sent}
|
||||
}catch{
|
||||
return {success:false,message:null}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,232 +0,0 @@
|
||||
///////////////////////////////////////
|
||||
//PROGRESS BAR MODULE
|
||||
///////////////////////////////////////
|
||||
import { ODSystemError, ODManager, ODManagerData, ODValidId } from "./base"
|
||||
import { ODDebugger } from "./console"
|
||||
import readline from "readline"
|
||||
|
||||
/**## ODProgressBarRendererManager `class`
|
||||
* This is an Open Ticket progress bar renderer manager.
|
||||
*
|
||||
* It is responsible for managing all console progress bar renderers in Open Ticket.
|
||||
*
|
||||
* A renderer is a function which will try to visualize the progress bar in the console.
|
||||
*/
|
||||
export class ODProgressBarRendererManager extends ODManager<ODProgressBarRenderer<{}>> {
|
||||
constructor(debug:ODDebugger){
|
||||
super(debug,"progress bar renderer")
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODProgressBarManager `class`
|
||||
* This is an Open Ticket progress bar manager.
|
||||
*
|
||||
* It is responsible for managing all console progress bars in Open Ticket. An example of this is the slash command registration progress bar.
|
||||
*
|
||||
* There are many types of progress bars available, but you can also create your own!
|
||||
*/
|
||||
export class ODProgressBarManager extends ODManager<ODProgressBar> {
|
||||
renderers: ODProgressBarRendererManager
|
||||
|
||||
constructor(debug:ODDebugger){
|
||||
super(debug,"progress bar")
|
||||
this.renderers = new ODProgressBarRendererManager(debug)
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODProgressBarRenderFunc `type`
|
||||
* This is the render function for an Open Ticket console progress bar.
|
||||
*/
|
||||
export type ODProgressBarRenderFunc<Settings extends {}> = (settings:Settings,min:number,max:number,value:number,prefix:string|null,suffix:string|null) => string
|
||||
|
||||
/**## ODProgressBarRenderer `class`
|
||||
* This is an Open Ticket console progress bar renderer.
|
||||
*
|
||||
* It is used to render a progress bar in the console of the bot.
|
||||
*
|
||||
* There are already a lot of default options available if you just want an easy progress bar!
|
||||
*/
|
||||
export class ODProgressBarRenderer<Settings extends {}> extends ODManagerData {
|
||||
settings: Settings
|
||||
#render: ODProgressBarRenderFunc<Settings>
|
||||
|
||||
constructor(id:ODValidId,render:ODProgressBarRenderFunc<Settings>,settings:Settings){
|
||||
super(id)
|
||||
this.#render = render
|
||||
this.settings = settings
|
||||
}
|
||||
|
||||
/**Render a progress bar using this renderer. */
|
||||
render(min:number,max:number,value:number,prefix:string|null,suffix:string|null){
|
||||
try {
|
||||
return this.#render(this.settings,min,max,value,prefix,suffix)
|
||||
}catch(err){
|
||||
process.emit("uncaughtException",err)
|
||||
return "<PROGRESS-BAR-ERROR>"
|
||||
}
|
||||
}
|
||||
|
||||
withAdditionalSettings(settings:Partial<Settings>): ODProgressBarRenderer<Settings> {
|
||||
const newSettings: Settings = {...this.settings}
|
||||
for (const key of Object.keys(settings)){
|
||||
if (typeof settings[key] != "undefined") newSettings[key] = settings[key]
|
||||
}
|
||||
return new ODProgressBarRenderer(this.id,this.#render,newSettings)
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODProgressBar `class`
|
||||
* This is an Open Ticket console progress bar.
|
||||
*
|
||||
* It is used to create a simple or advanced progress bar in the console of the bot.
|
||||
* These progress bars are not visible in the `otdebug.txt` file and should only be used as extra visuals.
|
||||
*
|
||||
* Use other classes as existing templates or create your own progress bar from scratch using this class.
|
||||
*/
|
||||
export class ODProgressBar extends ODManagerData {
|
||||
/**The renderer of this progress bar. */
|
||||
renderer: ODProgressBarRenderer<{}>
|
||||
/**Is this progress bar currently active? */
|
||||
#active: boolean = false
|
||||
/**A list of listeners when the progress bar stops. */
|
||||
#stopListeners: Function[] = []
|
||||
/**The current value of the progress bar. */
|
||||
protected value: number
|
||||
/**The minimum value of the progress bar. */
|
||||
min: number
|
||||
/**The maximum value of the progress bar. */
|
||||
max: number
|
||||
/**The initial value of the progress bar. */
|
||||
initialValue: number
|
||||
/**The prefix displayed in the progress bar. */
|
||||
prefix:string|null
|
||||
/**The prefix displayed in the progress bar. */
|
||||
suffix:string|null
|
||||
|
||||
/**Enable automatic stopping when reaching `min` or `max`. */
|
||||
autoStop: null|"min"|"max"
|
||||
|
||||
constructor(id:ODValidId,renderer:ODProgressBarRenderer<{}>,min:number,max:number,value:number,autoStop:null|"min"|"max",prefix:string|null,suffix:string|null){
|
||||
super(id)
|
||||
this.renderer = renderer
|
||||
this.min = min
|
||||
this.max = max
|
||||
this.initialValue = this.#parseValue(value)
|
||||
this.value = this.#parseValue(value)
|
||||
this.autoStop = autoStop
|
||||
this.prefix = prefix
|
||||
this.suffix = suffix
|
||||
}
|
||||
/**Parse a value in such a way that it doesn't go below/above the min/max limits. */
|
||||
#parseValue(value:number){
|
||||
if (value > this.max) return this.max
|
||||
else if (value < this.min) return this.min
|
||||
else return value
|
||||
}
|
||||
/**Render progress bar to the console. */
|
||||
#renderStdout(){
|
||||
if (!this.#active) return
|
||||
readline.clearLine(process.stdout,0)
|
||||
readline.cursorTo(process.stdout,0)
|
||||
process.stdout.write(this.renderer.render(this.min,this.max,this.value,this.prefix,this.suffix))
|
||||
}
|
||||
/**Start showing this progress bar in the console. */
|
||||
start(): boolean {
|
||||
if (this.#active) return false
|
||||
this.value = this.#parseValue(this.initialValue)
|
||||
this.#active = true
|
||||
this.#renderStdout()
|
||||
return true
|
||||
}
|
||||
/**Update this progress bar while active. (will automatically update the progress bar in the console) */
|
||||
protected update(value:number,stop?:boolean): boolean {
|
||||
if (!this.#active) return false
|
||||
this.value = this.#parseValue(value)
|
||||
this.#renderStdout()
|
||||
if (stop || (this.autoStop == "max" && this.value == this.max) || (this.autoStop == "min" && this.value == this.min)){
|
||||
process.stdout.write("\n")
|
||||
this.#active = false
|
||||
this.#stopListeners.forEach((cb) => cb())
|
||||
this.#stopListeners = []
|
||||
}
|
||||
return true
|
||||
}
|
||||
/**Wait for the progress bar to finish. */
|
||||
finished(): Promise<void> {
|
||||
return new Promise((resolve) => {
|
||||
this.#stopListeners.push(resolve)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODTimedProgressBar `class`
|
||||
* This is an Open Ticket timed console progress bar.
|
||||
*
|
||||
* It is used to create a simple timed progress bar in the console.
|
||||
* You can set a fixed duration (milliseconds) in the constructor.
|
||||
*/
|
||||
export class ODTimedProgressBar extends ODProgressBar {
|
||||
/**The time in milliseconds. */
|
||||
time: number
|
||||
/**The mode of the timer. */
|
||||
mode: "increasing"|"decreasing"
|
||||
|
||||
constructor(id:ODValidId,renderer:ODProgressBarRenderer<{}>,time:number,mode:"increasing"|"decreasing",prefix:string|null,suffix:string|null){
|
||||
super(id,renderer,0,time,0,(mode == "increasing") ? "max" : "min",prefix,suffix)
|
||||
this.time = time
|
||||
this.mode = mode
|
||||
}
|
||||
|
||||
/**The timer which is used. */
|
||||
async #timer(ms:number): Promise<void> {
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(() => {
|
||||
resolve()
|
||||
},ms)
|
||||
})
|
||||
}
|
||||
/**Run the timed progress bar. */
|
||||
async #execute(){
|
||||
let i = 0
|
||||
const fragment = this.time/100
|
||||
while (i < 100){
|
||||
await this.#timer(fragment)
|
||||
i++
|
||||
super.update((this.mode == "increasing") ? (i*fragment) : this.time-(i*fragment))
|
||||
}
|
||||
}
|
||||
start(){
|
||||
const res = super.start()
|
||||
if (!res) return false
|
||||
this.#execute()
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODManualProgressBar `class`
|
||||
* This is an Open Ticket manual console progress bar.
|
||||
*
|
||||
* It is used to create a simple manual progress bar in the console.
|
||||
* You can update the progress manually using `update()`.
|
||||
*/
|
||||
export class ODManualProgressBar extends ODProgressBar {
|
||||
constructor(id:ODValidId,renderer:ODProgressBarRenderer<{}>,amount:number,autoStop:null|"min"|"max",prefix:string|null,suffix:string|null){
|
||||
super(id,renderer,0,amount,0,autoStop,prefix,suffix)
|
||||
}
|
||||
/**Set the value of the progress bar. */
|
||||
set(value:number,stop?:boolean){
|
||||
super.update(value,stop)
|
||||
}
|
||||
/**Get the current value of the progress bar. */
|
||||
get(){
|
||||
return this.value
|
||||
}
|
||||
/**Increase the value of the progress bar. */
|
||||
increase(amount:number,stop?:boolean){
|
||||
super.update(this.value+amount,stop)
|
||||
}
|
||||
/**Decrease the value of the progress bar. */
|
||||
decrease(amount:number,stop?:boolean){
|
||||
super.update(this.value-amount,stop)
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,155 +0,0 @@
|
||||
///////////////////////////////////////
|
||||
//SESSION MODULE
|
||||
///////////////////////////////////////
|
||||
import { ODId, ODManager, ODManagerData, ODValidId } from "./base"
|
||||
import { ODDebugger } from "./console"
|
||||
import * as crypto from "crypto"
|
||||
|
||||
/**## ODSessionManager `class`
|
||||
* This is an Open Ticket session manager.
|
||||
*
|
||||
* It contains all sessions in Open Ticket. Sessions are a sort of temporary storage which will be cleared when the bot stops.
|
||||
* Data in sessions have a randomly generated key which will always be unique.
|
||||
*
|
||||
* Visit the `ODSession` class for more info
|
||||
*/
|
||||
export class ODSessionManager extends ODManager<ODSession> {
|
||||
constructor(debug:ODDebugger){
|
||||
super(debug,"session")
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODSessionInstance `interface`
|
||||
* This interface represents a single session instance. It contains an id, data & some dates.
|
||||
*/
|
||||
export interface ODSessionInstance {
|
||||
/**The id of this session instance. */
|
||||
id:string,
|
||||
/**The creation date of this session instance. */
|
||||
creation:number,
|
||||
/**The custom amount of minutes before this session expires. */
|
||||
timeout:number|null,
|
||||
/**This is the data from this session instance */
|
||||
data:any
|
||||
}
|
||||
|
||||
/**## ODSessionTimeoutCallback `type`
|
||||
* This is the callback used for session timeout listeners.
|
||||
*/
|
||||
export type ODSessionTimeoutCallback = (id:string, timeout:"default"|"custom", data:any, creation:Date) => void
|
||||
|
||||
/**## ODSession `class`
|
||||
* This is an Open Ticket session.
|
||||
*
|
||||
* It can be used to create 100% unique id's for usage in the bot. An id can also store additional data which isn't saved to the filesystem.
|
||||
* You can almost compare it to the PHP session system.
|
||||
*/
|
||||
export class ODSession extends ODManagerData {
|
||||
/**The history of previously generated instance ids. Used to reduce the risk of generating the same id twice. */
|
||||
#idHistory: string[] = []
|
||||
/**The max length of the instance id history. */
|
||||
#maxIdHistoryLength: number = 500
|
||||
/**An array of all the currently active session instances. */
|
||||
sessions: ODSessionInstance[] = []
|
||||
/**The default amount of minutes before a session automatically stops. */
|
||||
timeoutMinutes: number = 30
|
||||
/**The id of the auto-timeout session checker interval */
|
||||
#intervalId: NodeJS.Timeout
|
||||
/**Listeners for when a session times-out. */
|
||||
#timeoutListeners: ODSessionTimeoutCallback[] = []
|
||||
|
||||
constructor(id:ODValidId, intervalSeconds?:number){
|
||||
super(id)
|
||||
|
||||
//create the auto-timeout session checker
|
||||
this.#intervalId = setInterval(() => {
|
||||
const deletableSessions: {instance:ODSessionInstance,reason:"default"|"custom"}[] = []
|
||||
|
||||
//collect all deletable sessions
|
||||
this.sessions.forEach((session) => {
|
||||
if (session.timeout && (new Date().getTime() - session.creation) > session.timeout*60000){
|
||||
//stop session => custom timeout
|
||||
deletableSessions.push({instance:session,reason:"custom"})
|
||||
}else if (!session.timeout && (new Date().getTime() - session.creation) > this.timeoutMinutes*60000){
|
||||
//stop session => default timeout
|
||||
deletableSessions.push({instance:session,reason:"default"})
|
||||
}
|
||||
})
|
||||
|
||||
//permanently delete sessions
|
||||
deletableSessions.forEach((session) => {
|
||||
const index = this.sessions.findIndex((s) => s.id === session.instance.id)
|
||||
this.sessions.splice(index,1)
|
||||
|
||||
//emit timeout listeners
|
||||
this.#timeoutListeners.forEach((cb) => cb(session.instance.id,session.reason,session.instance.data,new Date(session.instance.creation)))
|
||||
})
|
||||
|
||||
},((intervalSeconds) ? (intervalSeconds * 1000) : 60000))
|
||||
}
|
||||
|
||||
/**Create a unique hex id of 8 characters and add it to the instance id history */
|
||||
#createUniqueId(): string {
|
||||
const hex = crypto.randomBytes(4).toString("hex")
|
||||
if (this.#idHistory.includes(hex)){
|
||||
return this.#createUniqueId()
|
||||
}else{
|
||||
this.#idHistory.push(hex)
|
||||
if (this.#idHistory.length > this.#maxIdHistoryLength) this.#idHistory.shift()
|
||||
return hex
|
||||
}
|
||||
}
|
||||
/**Stop the global interval that automatically deletes timed-out sessions. (This action can't be reverted!) */
|
||||
stopAutoTimeout(){
|
||||
clearInterval(this.#intervalId)
|
||||
}
|
||||
|
||||
/**Start a session instance with data. Returns the unique id required to access the session. */
|
||||
start(data?:any): string {
|
||||
const id = this.#createUniqueId()
|
||||
this.sessions.push({
|
||||
id,data,
|
||||
creation:new Date().getTime(),
|
||||
timeout:null
|
||||
})
|
||||
return id
|
||||
}
|
||||
/**Get the data of a session instance. Returns `null` when not found. */
|
||||
data(id:string): any|null {
|
||||
const session = this.sessions.find((session) => session.id === id)
|
||||
if (!session) return null
|
||||
return session.data
|
||||
}
|
||||
/**Stop & delete a session instance. Returns `true` when sucessful. */
|
||||
stop(id:string): boolean {
|
||||
const index = this.sessions.findIndex((session) => session.id === id)
|
||||
if (index < 0) return false
|
||||
this.sessions.splice(index,1)
|
||||
return true
|
||||
}
|
||||
/**Update the data of a session instance. Returns `true` when sucessful. */
|
||||
update(id:string, data:any): boolean {
|
||||
const session = this.sessions.find((session) => session.id === id)
|
||||
if (!session) return false
|
||||
session.data = data
|
||||
return true
|
||||
}
|
||||
/**Change the global or session timeout minutes. Returns `true` when sucessful. */
|
||||
setTimeout(min:number, id?:string): boolean {
|
||||
if (!id){
|
||||
//change global timeout minutes
|
||||
this.timeoutMinutes = min
|
||||
return true
|
||||
}else{
|
||||
//change session instance timeout minutes
|
||||
const session = this.sessions.find((session) => session.id === id)
|
||||
if (!session) return false
|
||||
session.timeout = min
|
||||
return true
|
||||
}
|
||||
}
|
||||
/**Listen for a session timeout (default or custom) */
|
||||
onTimeout(callback:ODSessionTimeoutCallback){
|
||||
this.#timeoutListeners.push(callback)
|
||||
}
|
||||
}
|
||||
@@ -1,320 +0,0 @@
|
||||
///////////////////////////////////////
|
||||
//STARTSCREEN MODULE
|
||||
///////////////////////////////////////
|
||||
import { ODId, ODManager, ODManagerData, ODValidId } from "./base"
|
||||
import { ODDebugger, ODError, ODLiveStatusManager } from "./console"
|
||||
import { ODFlag } from "./flag"
|
||||
import { ODPlugin, ODUnknownCrashedPlugin } from "./plugin"
|
||||
import ansis from "ansis"
|
||||
|
||||
/**## ODStartScreenComponentRenderCallback `type`
|
||||
* This is the render function of a startscreen component. It also sends the location of where the component is rendered.
|
||||
*/
|
||||
export type ODStartScreenComponentRenderCallback = (location:number) => string|Promise<string>
|
||||
|
||||
/**## ODStartScreenManager `class`
|
||||
* This is an Open Ticket startscreen manager.
|
||||
*
|
||||
* This class is responsible for managing & rendering the startscreen of the bot.
|
||||
* The startscreen is the part you see when the bot has started up successfully. (e.g. the Open Ticket logo, logs, livestatus, flags, ...)
|
||||
*/
|
||||
export class ODStartScreenManager extends ODManager<ODStartScreenComponent> {
|
||||
/**Alias to the Open Ticket debugger. */
|
||||
#debug: ODDebugger
|
||||
/**Alias to the livestatus manager. */
|
||||
livestatus: ODLiveStatusManager
|
||||
|
||||
constructor(debug:ODDebugger,livestatus:ODLiveStatusManager){
|
||||
super(debug,"startscreen component")
|
||||
this.#debug = debug
|
||||
this.livestatus = livestatus
|
||||
}
|
||||
|
||||
/**Get all components in sorted order. */
|
||||
getSortedComponents(priority:"ascending"|"descending"){
|
||||
return this.getAll().sort((a,b) => {
|
||||
if (priority == "ascending") return a.priority-b.priority
|
||||
else return b.priority-a.priority
|
||||
})
|
||||
}
|
||||
/**Render all startscreen components in priority order. */
|
||||
async renderAllComponents(){
|
||||
const components = this.getSortedComponents("descending")
|
||||
|
||||
let location = 0
|
||||
for (const component of components){
|
||||
try {
|
||||
const renderedText = await component.renderAll(location)
|
||||
console.log(renderedText)
|
||||
this.#debug.console.debugfile.writeText("[STARTSCREEN] Component: \""+component.id+"\"\n"+ansis.strip(renderedText))
|
||||
}catch(e){
|
||||
this.#debug.console.log("Unable to render \""+component.id+"\" startscreen component!","error")
|
||||
this.#debug.console.debugfile.writeErrorMessage(new ODError(e,"uncaughtException"))
|
||||
}
|
||||
location++
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODStartScreenComponent `class`
|
||||
* This is an Open Ticket startscreen component.
|
||||
*
|
||||
* This component can be rendered to the start screen of the bot.
|
||||
* An optional priority can be specified to choose the location of the component.
|
||||
*
|
||||
* It's recommended to use pre-built components except if you really need a custom one.
|
||||
*/
|
||||
export class ODStartScreenComponent extends ODManagerData {
|
||||
/**The priority of this component. */
|
||||
priority: number
|
||||
/**An optional render function which will be inserted before the default renderer. */
|
||||
renderBefore: ODStartScreenComponentRenderCallback|null = null
|
||||
/**The render function which will render the contents of this component. */
|
||||
render: ODStartScreenComponentRenderCallback
|
||||
/**An optional render function which will be inserted behind the default renderer. */
|
||||
renderAfter: ODStartScreenComponentRenderCallback|null = null
|
||||
|
||||
constructor(id:ODValidId, priority:number, render:ODStartScreenComponentRenderCallback){
|
||||
super(id)
|
||||
this.priority = priority
|
||||
this.render = render
|
||||
}
|
||||
|
||||
/**Render this component and combine it with the `renderBefore` & `renderAfter` contents. */
|
||||
async renderAll(location:number){
|
||||
const textBefore = (this.renderBefore) ? await this.renderBefore(location) : ""
|
||||
const text = await this.render(location)
|
||||
const textAfter = (this.renderAfter) ? await this.renderAfter(location) : ""
|
||||
return (textBefore ? textBefore+"\n" : "")+text+(textAfter ? "\n"+textAfter : "")
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODStartScreenProperty `type`
|
||||
* This interface contains properties used in a few default templates of the startscreen component.
|
||||
*/
|
||||
export interface ODStartScreenProperty {
|
||||
/**The key or name of this property. */
|
||||
key:string,
|
||||
/**The value or contents of this property. */
|
||||
value:string
|
||||
}
|
||||
|
||||
/**## ODStartScreenLogoComponent `class`
|
||||
* This is an Open Ticket startscreen logo component.
|
||||
*
|
||||
* This component will render an ASCII art logo (from an array) to the startscreen. Every property in the array is another row.
|
||||
* An optional priority can be specified to choose the location of the component.
|
||||
*/
|
||||
export class ODStartScreenLogoComponent extends ODStartScreenComponent {
|
||||
/**The ASCII logo contents. */
|
||||
logo: string[]
|
||||
/**When enabled, the component will add a new line above the logo. */
|
||||
topPadding: boolean
|
||||
/**When enabled, the component will add a new line below the logo. */
|
||||
bottomPadding: boolean
|
||||
/**The color of the logo in hex format. */
|
||||
logoHexColor: string
|
||||
|
||||
constructor(id:ODValidId, priority:number, logo:string[], topPadding?:boolean, bottomPadding?:boolean, logoHexColor?:string){
|
||||
super(id,priority,() => {
|
||||
const renderedTop = (this.topPadding ? "\n" : "")
|
||||
const renderedLogo = this.logo.join("\n")
|
||||
const renderedBottom = (this.bottomPadding ? "\n" : "")
|
||||
return ansis.hex(this.logoHexColor)(renderedTop+renderedLogo+renderedBottom)
|
||||
})
|
||||
this.logo = logo
|
||||
this.topPadding = topPadding ?? false
|
||||
this.bottomPadding = bottomPadding ?? false
|
||||
this.logoHexColor = logoHexColor ?? "#f8ba00"
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODStartScreenHeaderAlignmentSettings `type`
|
||||
* This interface contains all settings used in the startscreen header component.
|
||||
*/
|
||||
export interface ODStartScreenHeaderAlignmentSettings {
|
||||
/**The alignment settings for this header. */
|
||||
align:"center"|"left"|"right",
|
||||
/**The width or component to use when calculating center & right alignment. */
|
||||
width:number|ODStartScreenComponent
|
||||
}
|
||||
|
||||
/**## ODStartScreenHeaderComponent `class`
|
||||
* This is an Open Ticket startscreen header component.
|
||||
*
|
||||
* This component will render a header to the startscreen. Properties can be aligned left, right or centered.
|
||||
* An optional priority can be specified to choose the location of the component.
|
||||
*/
|
||||
export class ODStartScreenHeaderComponent extends ODStartScreenComponent {
|
||||
/**All properties of this header component. */
|
||||
properties: ODStartScreenProperty[]
|
||||
/**The spacer used between properties. */
|
||||
spacer: string
|
||||
/**The alignment settings of this header component. */
|
||||
align: ODStartScreenHeaderAlignmentSettings|null
|
||||
|
||||
constructor(id:ODValidId, priority:number, properties:ODStartScreenProperty[], spacer?:string, align?:ODStartScreenHeaderAlignmentSettings){
|
||||
super(id,priority,async () => {
|
||||
const renderedProperties = ansis.bold(this.properties.map((prop) => prop.key+": "+prop.value).join(this.spacer))
|
||||
if (!this.align || this.align.align == "left"){
|
||||
return renderedProperties
|
||||
}else if (this.align.align == "right"){
|
||||
const width = (typeof this.align.width == "number") ? this.align.width : (
|
||||
ansis.strip(await this.align.width.renderAll(0)).split("\n").map((row) => row.length).reduce((prev,curr) => {
|
||||
if (prev < curr) return curr
|
||||
else return prev
|
||||
},0)
|
||||
)
|
||||
const offset = width - ansis.strip(renderedProperties).length
|
||||
if (offset < 0) return renderedProperties
|
||||
else{
|
||||
return (" ".repeat(offset) + renderedProperties)
|
||||
}
|
||||
}else if (this.align.align == "center"){
|
||||
const width = (typeof this.align.width == "number") ? this.align.width : (
|
||||
ansis.strip(await this.align.width.renderAll(0)).split("\n").map((row) => row.length).reduce((prev,curr) => {
|
||||
if (prev < curr) return curr
|
||||
else return prev
|
||||
})
|
||||
)
|
||||
const offset = Math.round((width - ansis.strip(renderedProperties).length)/2)
|
||||
if (offset < 0) return renderedProperties
|
||||
else{
|
||||
return (" ".repeat(offset) + renderedProperties)
|
||||
}
|
||||
}
|
||||
return renderedProperties
|
||||
})
|
||||
this.properties = properties
|
||||
this.spacer = spacer ?? " - "
|
||||
this.align = align ?? null
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODStartScreenCategoryComponent `class`
|
||||
* This is an Open Ticket startscreen category component.
|
||||
*
|
||||
* This component will render a category to the startscreen. This will only render the category name. You'll need to provide your own renderer for the contents.
|
||||
* An optional priority can be specified to choose the location of the component.
|
||||
*/
|
||||
export class ODStartScreenCategoryComponent extends ODStartScreenComponent {
|
||||
/**The name of this category. */
|
||||
name: string
|
||||
/**When enabled, this category will still be rendered when the contents are empty. (enabled by default) */
|
||||
renderIfEmpty: boolean
|
||||
|
||||
constructor(id:ODValidId, priority:number, name:string, render:ODStartScreenComponentRenderCallback, renderIfEmpty?:boolean){
|
||||
super(id,priority,async (location) => {
|
||||
const contents = await render(location)
|
||||
if (contents != "" || this.renderIfEmpty){
|
||||
return ansis.bold.underline("\n"+name.toUpperCase()+(contents != "" ? ":\n" : ":")) + contents
|
||||
}else return ""
|
||||
})
|
||||
this.name = name
|
||||
this.renderIfEmpty = renderIfEmpty ?? true
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODStartScreenPropertiesCategoryComponent `class`
|
||||
* This is an Open Ticket startscreen properties category component.
|
||||
*
|
||||
* This component will render a properties category to the startscreen. This will list the properties in the category.
|
||||
* An optional priority can be specified to choose the location of the component.
|
||||
*/
|
||||
export class ODStartScreenPropertiesCategoryComponent extends ODStartScreenCategoryComponent {
|
||||
/**The properties of this category component. */
|
||||
properties: ODStartScreenProperty[]
|
||||
/**The hex color for the key/name of all the properties. */
|
||||
propertyHexColor: string
|
||||
|
||||
constructor(id:ODValidId, priority:number, name:string, properties:ODStartScreenProperty[], propertyHexColor?:string, renderIfEmpty?:boolean){
|
||||
super(id,priority,name,() => {
|
||||
return this.properties.map((prop) => ansis.hex(this.propertyHexColor)(prop.key+": ")+prop.value).join("\n")
|
||||
},renderIfEmpty)
|
||||
|
||||
this.properties = properties
|
||||
this.propertyHexColor = propertyHexColor ?? "#f8ba00"
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODStartScreenFlagsCategoryComponent `class`
|
||||
* This is an Open Ticket startscreen flags category component.
|
||||
*
|
||||
* This component will render a flags category to the startscreen. This will list the enabled flags in the category.
|
||||
* An optional priority can be specified to choose the location of the component.
|
||||
*/
|
||||
export class ODStartScreenFlagsCategoryComponent extends ODStartScreenCategoryComponent {
|
||||
/**A list of all flags to render. */
|
||||
flags: ODFlag[]
|
||||
|
||||
constructor(id:ODValidId, priority:number, flags:ODFlag[]){
|
||||
super(id,priority,"flags",() => {
|
||||
return this.flags.filter((flag) => (flag.value == true)).map((flag) => ansis.blue("["+flag.name+"] "+flag.description)).join("\n")
|
||||
},false)
|
||||
this.flags = flags
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODStartScreenPluginsCategoryComponent `class`
|
||||
* This is an Open Ticket startscreen plugins category component.
|
||||
*
|
||||
* This component will render a plugins category to the startscreen. This will list the enabled, disabled & crashed plugins in the category.
|
||||
* An optional priority can be specified to choose the location of the component.
|
||||
*/
|
||||
export class ODStartScreenPluginsCategoryComponent extends ODStartScreenCategoryComponent {
|
||||
/**A list of all plugins to render. */
|
||||
plugins: ODPlugin[]
|
||||
/**A list of all crashed plugins to render. */
|
||||
unknownCrashedPlugins: ODUnknownCrashedPlugin[]
|
||||
|
||||
constructor(id:ODValidId, priority:number, plugins:ODPlugin[], unknownCrashedPlugins:ODUnknownCrashedPlugin[]){
|
||||
super(id,priority,"plugins",() => {
|
||||
const disabledPlugins = this.plugins.filter((plugin) => !plugin.enabled)
|
||||
|
||||
const renderedActivePlugins = this.plugins.filter((plugin) => plugin.enabled && plugin.executed).sort((a,b) => b.priority-a.priority).map((plugin) => ansis.green("✅ ["+plugin.name+"] "+plugin.details.shortDescription))
|
||||
const renderedCrashedPlugins = this.plugins.filter((plugin) => plugin.enabled && plugin.crashed).sort((a,b) => b.priority-a.priority).map((plugin) => ansis.red("❌ ["+plugin.name+"] "+plugin.details.shortDescription))
|
||||
const renderedDisabledPlugins = (disabledPlugins.length > 4) ? [ansis.gray("💤 (+"+disabledPlugins.length+" disabled plugins)")] : disabledPlugins.sort((a,b) => b.priority-a.priority).map((plugin) => ansis.gray("💤 ["+plugin.name+"] "+plugin.details.shortDescription))
|
||||
const renderedUnknownPlugins = unknownCrashedPlugins.map((plugin) => ansis.red("❌ ["+plugin.name+"] "+plugin.description))
|
||||
|
||||
return [
|
||||
...renderedActivePlugins,
|
||||
...renderedDisabledPlugins,
|
||||
...renderedCrashedPlugins,
|
||||
...renderedUnknownPlugins
|
||||
].join("\n")
|
||||
},false)
|
||||
this.plugins = plugins
|
||||
this.unknownCrashedPlugins = unknownCrashedPlugins
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODStartScreenLiveStatusCategoryComponent `class`
|
||||
* This is an Open Ticket startscreen livestatus category component.
|
||||
*
|
||||
* This component will render a livestatus category to the startscreen. This will list the livestatus messages in the category.
|
||||
* An optional priority can be specified to choose the location of the component.
|
||||
*/
|
||||
export class ODStartScreenLiveStatusCategoryComponent extends ODStartScreenCategoryComponent {
|
||||
/**A reference to the Open Ticket livestatus manager. */
|
||||
livestatus: ODLiveStatusManager
|
||||
|
||||
constructor(id:ODValidId, priority:number, livestatus:ODLiveStatusManager){
|
||||
super(id,priority,"livestatus",async () => {
|
||||
const messages = await this.livestatus.getAllMessages()
|
||||
return this.livestatus.renderer.render(messages)
|
||||
},false)
|
||||
this.livestatus = livestatus
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODStartScreenLogsCategoryComponent `class`
|
||||
* This is an Open Ticket startscreen logs category component.
|
||||
*
|
||||
* This component will render a logs category to the startscreen. This will only render the logs category name.
|
||||
* An optional priority can be specified to choose the location of the component.
|
||||
*/
|
||||
export class ODStartScreenLogCategoryComponent extends ODStartScreenCategoryComponent {
|
||||
constructor(id:ODValidId, priority:number){
|
||||
super(id,priority,"logs",() => "",true)
|
||||
}
|
||||
}
|
||||
@@ -1,313 +0,0 @@
|
||||
///////////////////////////////////////
|
||||
//STAT MODULE
|
||||
///////////////////////////////////////
|
||||
import { ODId, ODManager, ODManagerData, ODSystemError, ODValidId } from "./base"
|
||||
import { ODDebugger } from "./console"
|
||||
import { ODDatabase, ODJsonDatabaseStructure } from "./database"
|
||||
import * as discord from "discord.js"
|
||||
|
||||
/**## ODValidStatValue `type`
|
||||
* These are the only allowed types for a stat value to improve compatibility with different database systems.
|
||||
*/
|
||||
export type ODValidStatValue = string|number|boolean
|
||||
|
||||
/**## ODStatsManagerInitCallback `type`
|
||||
* This callback can be used to execute something when the stats have been initiated.
|
||||
*
|
||||
* By default this is used to clear stats from users that left the server or tickets which don't exist anymore.
|
||||
*/
|
||||
export type ODStatsManagerInitCallback = (database:ODJsonDatabaseStructure, deletables:ODJsonDatabaseStructure) => void|Promise<void>
|
||||
|
||||
/**## ODStatScopeSetMode `type`
|
||||
* This type contains all valid methods for changing the value of a stat.
|
||||
*/
|
||||
export type ODStatScopeSetMode = "set"|"increase"|"decrease"
|
||||
|
||||
/**## ODStatsManager `class`
|
||||
* This is an Open Ticket stats manager.
|
||||
*
|
||||
* This class is responsible for managing all stats of the bot.
|
||||
* Stats are categorized in "scopes" which can be accessed in this manager.
|
||||
*
|
||||
* Stats can be accessed in the individual scopes.
|
||||
*/
|
||||
export class ODStatsManager extends ODManager<ODStatScope> {
|
||||
/**Alias to Open Ticket debugger. */
|
||||
#debug: ODDebugger
|
||||
/**Alias to Open Ticket stats database. */
|
||||
database: ODDatabase|null = null
|
||||
/**All the listeners for the init event. */
|
||||
#initListeners: ODStatsManagerInitCallback[] = []
|
||||
|
||||
constructor(debug:ODDebugger){
|
||||
super(debug,"stat scope")
|
||||
this.#debug = debug
|
||||
}
|
||||
|
||||
/**Select the database to use to read/write all stats from/to. */
|
||||
useDatabase(database:ODDatabase){
|
||||
this.database = database
|
||||
}
|
||||
add(data:ODStatScope, overwrite?:boolean): boolean {
|
||||
data.useDebug(this.#debug,"stat")
|
||||
if (this.database) data.useDatabase(this.database)
|
||||
return super.add(data,overwrite)
|
||||
}
|
||||
/**Init all stats and run `onInit()` listeners. */
|
||||
async init(){
|
||||
if (!this.database) throw new ODSystemError("Unable to initialize stats scopes due to missing database!")
|
||||
|
||||
//get all valid categories
|
||||
const validCategories: string[] = []
|
||||
for (const scope of this.getAll()){
|
||||
validCategories.push(...scope.init())
|
||||
}
|
||||
|
||||
//filter out the deletable stats
|
||||
const deletableStats: ODJsonDatabaseStructure = []
|
||||
const data = await this.database.getAll()
|
||||
data.forEach((data) => {
|
||||
if (!validCategories.includes(data.category)) deletableStats.push(data)
|
||||
})
|
||||
|
||||
//do additional deletion
|
||||
for (const cb of this.#initListeners){
|
||||
await cb(data,deletableStats)
|
||||
}
|
||||
|
||||
//delete all deletable stats
|
||||
for (const data of deletableStats){
|
||||
if (!this.database) return
|
||||
await this.database.delete(data.category,data.key)
|
||||
}
|
||||
}
|
||||
/**Reset all stats. (clears the entire database) */
|
||||
async reset(){
|
||||
if (!this.database) return
|
||||
const data = await this.database.getAll()
|
||||
for (const d of data){
|
||||
if (!this.database) return
|
||||
await this.database.delete(d.category,d.key)
|
||||
}
|
||||
}
|
||||
/**Run a function when the stats are initialized. This can be used to clear stats from users that left the server or tickets which don't exist anymore. */
|
||||
onInit(callback:ODStatsManagerInitCallback){
|
||||
this.#initListeners.push(callback)
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODStatScope `class`
|
||||
* This is an Open Ticket stat scope.
|
||||
*
|
||||
* A scope can contain multiple stats. Every scope is seperated from other scopes.
|
||||
* Here, you can read & write the values of all stats.
|
||||
*
|
||||
* The built-in Open Ticket scopes are: `global`, `user`, `ticket`
|
||||
*/
|
||||
export class ODStatScope extends ODManager<ODStat> {
|
||||
/**The id of this statistics scope. */
|
||||
id: ODId
|
||||
/**Is this stat scope already initialized? */
|
||||
ready: boolean = false
|
||||
/**Alias to Open Ticket stats database. */
|
||||
database: ODDatabase|null = null
|
||||
/**The name of this scope (used in embed title) */
|
||||
name:string
|
||||
|
||||
constructor(id:ODValidId, name:string){
|
||||
super()
|
||||
this.id = new ODId(id)
|
||||
this.name = name
|
||||
}
|
||||
|
||||
/**Select the database to use to read/write all stats from/to. (Automatically assigned when used in `ODStatsManager`) */
|
||||
useDatabase(database:ODDatabase){
|
||||
this.database = database
|
||||
}
|
||||
/**Get the value of a statistic. The `scopeId` is the unique id of the user, channel, role, etc that the stats are related to. */
|
||||
async getStat(id:ODValidId, scopeId:string): Promise<ODValidStatValue|null> {
|
||||
if (!this.database) return null
|
||||
const newId = new ODId(id)
|
||||
const data = await this.database.get(this.id.value+"_"+newId.value,scopeId)
|
||||
|
||||
if (typeof data == "undefined"){
|
||||
//set stats to default value & return
|
||||
return this.resetStat(id,scopeId)
|
||||
}else if (typeof data == "string" || typeof data == "boolean" || typeof data == "number"){
|
||||
//return value received from database
|
||||
return data
|
||||
}
|
||||
//return null on error
|
||||
return null
|
||||
}
|
||||
/**Get the value of a statistic for all `scopeId`'s. The `scopeId` is the unique id of the user, channel, role, etc that the stats are related to. */
|
||||
async getAllStats(id:ODValidId): Promise<{id:string,value:ODValidStatValue}[]> {
|
||||
if (!this.database) return []
|
||||
const newId = new ODId(id)
|
||||
const data = await this.database.getCategory(this.id.value+"_"+newId.value) ?? []
|
||||
const output: {id:string,value:ODValidStatValue}[] = []
|
||||
|
||||
for (const stat of data){
|
||||
if (typeof stat.value == "string" || typeof stat.value == "boolean" || typeof stat.value == "number"){
|
||||
//return value received from database
|
||||
output.push({id:stat.key,value:stat.value})
|
||||
}
|
||||
}
|
||||
|
||||
//return null on error
|
||||
return output
|
||||
}
|
||||
/**Set, increase or decrease the value of a statistic. The `scopeId` is the unique id of the user, channel, role, etc that the stats are related to. */
|
||||
async setStat(id:ODValidId, scopeId:string, value:ODValidStatValue, mode:ODStatScopeSetMode): Promise<boolean> {
|
||||
if (!this.database) return false
|
||||
const stat = this.get(id)
|
||||
if (!stat) return false
|
||||
if (mode == "set" || typeof value != "number"){
|
||||
await this.database.set(this.id.value+"_"+stat.id.value,scopeId,value)
|
||||
}else if (mode == "increase"){
|
||||
const currentValue = await this.getStat(id,scopeId)
|
||||
if (typeof currentValue != "number") await this.database.set(this.id.value+"_"+stat.id.value,scopeId,0+value)
|
||||
else await this.database.set(this.id.value+"_"+stat.id.value,scopeId,currentValue+value)
|
||||
}else if (mode == "decrease"){
|
||||
const currentValue = await this.getStat(id,scopeId)
|
||||
if (typeof currentValue != "number") await this.database.set(this.id.value+"_"+stat.id.value,scopeId,0-value)
|
||||
else await this.database.set(this.id.value+"_"+stat.id.value,scopeId,currentValue-value)
|
||||
}
|
||||
return true
|
||||
}
|
||||
/**Reset the value of a statistic to the initial value. The `scopeId` is the unique id of the user, channel, role, etc that the stats are related to. */
|
||||
async resetStat(id:ODValidId, scopeId:string): Promise<ODValidStatValue|null> {
|
||||
if (!this.database) return null
|
||||
const stat = this.get(id)
|
||||
if (!stat) return null
|
||||
if (stat.value != null) await this.database.set(this.id.value+"_"+stat.id.value,scopeId,stat.value)
|
||||
return stat.value
|
||||
}
|
||||
/**Initialize this stat scope & return a list of all statistic ids in the following format: `<scopeid>_<statid>` */
|
||||
init(): string[] {
|
||||
//get all valid stats categories
|
||||
this.ready = true
|
||||
return this.getAll().map((stat) => this.id.value+"_"+stat.id.value)
|
||||
}
|
||||
/**Render all stats in this scope for usage in a discord message/embed. */
|
||||
async render(scopeId:string, guild:discord.Guild, channel:discord.TextBasedChannel, user:discord.User): Promise<string> {
|
||||
//sort from high priority to low
|
||||
const derefArray = [...this.getAll()]
|
||||
derefArray.sort((a,b) => {
|
||||
return b.priority-a.priority
|
||||
})
|
||||
const result: string[] = []
|
||||
|
||||
for (const stat of derefArray){
|
||||
try {
|
||||
if (stat instanceof ODDynamicStat){
|
||||
//dynamic render (without value)
|
||||
result.push(await stat.render("",scopeId,guild,channel,user))
|
||||
}else{
|
||||
//normal render (with value)
|
||||
const value = await this.getStat(stat.id,scopeId)
|
||||
if (value != null) result.push(await stat.render(value,scopeId,guild,channel,user))
|
||||
}
|
||||
|
||||
}catch(err){
|
||||
process.emit("uncaughtException",err)
|
||||
}
|
||||
}
|
||||
|
||||
return result.filter((stat) => stat !== "").join("\n")
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODStatGlobalScope `class`
|
||||
* This is an Open Ticket stat global scope.
|
||||
*
|
||||
* A scope can contain multiple stats. Every scope is seperated from other scopes.
|
||||
* Here, you can read & write the values of all stats.
|
||||
*
|
||||
* This scope is made specifically for the global stats of Open Ticket.
|
||||
*/
|
||||
export class ODStatGlobalScope extends ODStatScope {
|
||||
getStat(id:ODValidId): Promise<ODValidStatValue|null> {
|
||||
return super.getStat(id,"GLOBAL")
|
||||
}
|
||||
getAllStats(id:ODValidId): Promise<{id:string,value:ODValidStatValue}[]> {
|
||||
return super.getAllStats(id)
|
||||
}
|
||||
setStat(id:ODValidId, value:ODValidStatValue, mode:ODStatScopeSetMode): Promise<boolean> {
|
||||
return super.setStat(id,"GLOBAL",value,mode)
|
||||
}
|
||||
resetStat(id:ODValidId): Promise<ODValidStatValue|null> {
|
||||
return super.resetStat(id,"GLOBAL")
|
||||
}
|
||||
render(scopeId:"GLOBAL", guild:discord.Guild, channel:discord.TextBasedChannel, user: discord.User): Promise<string> {
|
||||
return super.render("GLOBAL",guild,channel,user)
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODStatRenderer `type`
|
||||
* This callback will render a single statistic for a discord embed/message.
|
||||
*/
|
||||
export type ODStatRenderer = (value:ODValidStatValue, scopeId:string, guild:discord.Guild, channel:discord.TextBasedChannel, user:discord.User) => string|Promise<string>
|
||||
|
||||
/**## ODStat `class`
|
||||
* This is an Open Ticket statistic.
|
||||
*
|
||||
* This single statistic doesn't do anything except defining the rules of this statistic.
|
||||
* Use it in a stats scope to register a new statistic. A statistic can also include a priority to choose the render priority.
|
||||
*
|
||||
* It's recommended to use the `ODBasicStat` & `ODDynamicStat` classes instead of this one!
|
||||
*/
|
||||
export class ODStat extends ODManagerData {
|
||||
/**The priority of this statistic. */
|
||||
priority: number
|
||||
/**The render function of this statistic. */
|
||||
render: ODStatRenderer
|
||||
/**The value of this statistic. */
|
||||
value: ODValidStatValue|null
|
||||
|
||||
constructor(id:ODValidId, priority:number, render:ODStatRenderer, value?:ODValidStatValue){
|
||||
super(id)
|
||||
this.priority = priority
|
||||
this.render = render
|
||||
this.value = value ?? null
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODBasicStat `class`
|
||||
* This is an Open Ticket basic statistic.
|
||||
*
|
||||
* This single statistic will store a number, boolean or string in the database.
|
||||
* Use it to create a simple statistic for any stats scope.
|
||||
*/
|
||||
export class ODBasicStat extends ODStat {
|
||||
/**The name of this stat. Rendered in discord embeds/messages. */
|
||||
name: string
|
||||
|
||||
constructor(id:ODValidId, priority:number, name:string, value:ODValidStatValue){
|
||||
super(id,priority,(value) => {
|
||||
return ""+name+": `"+value.toString()+"`"
|
||||
},value)
|
||||
this.name = name
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODDynamicStatRenderer `type`
|
||||
* This callback will render a single dynamic statistic for a discord embed/message.
|
||||
*/
|
||||
export type ODDynamicStatRenderer = (scopeId:string, guild:discord.Guild, channel:discord.TextBasedChannel, user:discord.User) => string|Promise<string>
|
||||
|
||||
/**## ODDynamicStat `class`
|
||||
* This is an Open Ticket dynamic statistic.
|
||||
*
|
||||
* A dynamic statistic does not store anything in the database! Instead, it will execute a function to return a custom result.
|
||||
* This can be used to show statistics which are not stored in the database.
|
||||
*
|
||||
* This is used in Open Ticket for the live ticket status, participants & system status.
|
||||
*/
|
||||
export class ODDynamicStat extends ODStat {
|
||||
constructor(id:ODValidId, priority:number, render:ODDynamicStatRenderer){
|
||||
super(id,priority,(value,scopeId,guild,channel,user) => {
|
||||
return render(scopeId,guild,channel,user)
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
///////////////////////////////////////
|
||||
//VERIFYBAR MODULE
|
||||
///////////////////////////////////////
|
||||
import { ODId, ODManager, ODManagerData, ODValidId } from "./base"
|
||||
import { ODMessage } from "./builder"
|
||||
import { ODDebugger } from "./console"
|
||||
import { ODButtonResponderInstance } from "./responder"
|
||||
import * as discord from "discord.js"
|
||||
import { ODWorkerManager } from "./worker"
|
||||
|
||||
/**## 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){
|
||||
super(id)
|
||||
this.success = new ODWorkerManager("descending")
|
||||
this.failure = new ODWorkerManager("descending")
|
||||
this.message = message
|
||||
this.enabled = enabled ?? true
|
||||
}
|
||||
|
||||
/**Build the message and reply to a button with this verifybar. */
|
||||
async activate(responder:ODButtonResponderInstance){
|
||||
if (this.enabled){
|
||||
//show verifybar
|
||||
const {guild,channel,user,message} = responder
|
||||
await responder.update(await this.message.build("verifybar",{guild,channel,user,verifybar:this,originalMessage:message}))
|
||||
}else{
|
||||
//instant success
|
||||
if (this.success) await this.success.executeWorkers(responder,"verifybar",{data:null,verifybarMessage:null})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**## 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")
|
||||
}
|
||||
}
|
||||
@@ -1,93 +0,0 @@
|
||||
///////////////////////////////////////
|
||||
//WORKER MODULE
|
||||
///////////////////////////////////////
|
||||
import { ODId, ODManager, ODManagerData, ODValidId } from "./base"
|
||||
|
||||
/**## ODWorkerCallback `type`
|
||||
* This is the callback used in `ODWorker`!
|
||||
*/
|
||||
export type ODWorkerCallback<Instance, Source extends string, Params> = (instance:Instance, params:Params, source:Source, cancel:() => void) => void|Promise<void>
|
||||
|
||||
/**## ODWorker `class`
|
||||
* This is an Open Ticket worker.
|
||||
*
|
||||
* You can compare it with a normal javascript callback, but slightly more advanced!
|
||||
*
|
||||
* - It has an `id` for identification of the function
|
||||
* - A `priority` to know when to execute this callback (related to others)
|
||||
* - It knows who called this callback (`source`)
|
||||
* - And much more!
|
||||
*/
|
||||
export class ODWorker<Instance, Source extends string, Params> extends ODManagerData {
|
||||
/**The priority of this worker */
|
||||
priority: number
|
||||
/**The main callback of this worker */
|
||||
callback: ODWorkerCallback<Instance,Source,Params>
|
||||
|
||||
constructor(id:ODValidId, priority:number, callback:ODWorkerCallback<Instance,Source,Params>){
|
||||
super(id)
|
||||
this.priority = priority
|
||||
this.callback = callback
|
||||
}
|
||||
}
|
||||
|
||||
/**## ODWorker `class`
|
||||
* This is an Open Ticket worker manager.
|
||||
*
|
||||
* It manages & executes `ODWorker`'s in the correct order.
|
||||
*
|
||||
* You can register a custom worker in this class to create a message or button.
|
||||
*/
|
||||
export class ODWorkerManager<Instance, Source extends string, Params> extends ODManager<ODWorker<Instance,Source,Params>> {
|
||||
/**The order of execution for workers inside this manager. */
|
||||
#priorityOrder: "ascending"|"descending"
|
||||
/**The backup worker will be executed when one of the workers fails or cancels execution. */
|
||||
backupWorker: ODWorker<{reason:"error"|"cancel"},Source,Params>|null = null
|
||||
|
||||
constructor(priorityOrder:"ascending"|"descending"){
|
||||
super()
|
||||
this.#priorityOrder = priorityOrder
|
||||
}
|
||||
|
||||
/**Get all workers in sorted order. */
|
||||
getSortedWorkers(priority:"ascending"|"descending"){
|
||||
const derefArray = [...this.getAll()]
|
||||
|
||||
return derefArray.sort((a,b) => {
|
||||
if (priority == "ascending") return a.priority-b.priority
|
||||
else return b.priority-a.priority
|
||||
})
|
||||
}
|
||||
/**Execute all workers on an instance using the given source & parameters. */
|
||||
async executeWorkers(instance:Instance, source:Source, params:Params){
|
||||
const derefParams = {...params}
|
||||
const workers = this.getSortedWorkers(this.#priorityOrder)
|
||||
let didCancel = false
|
||||
let didCrash = false
|
||||
|
||||
for (const worker of workers){
|
||||
if (didCancel) break
|
||||
try {
|
||||
await worker.callback(instance,derefParams,source,() => {
|
||||
didCancel = true
|
||||
})
|
||||
}catch(err){
|
||||
process.emit("uncaughtException",err)
|
||||
didCrash = true
|
||||
}
|
||||
}
|
||||
if (didCancel && this.backupWorker){
|
||||
try{
|
||||
await this.backupWorker.callback({reason:"cancel"},derefParams,source,() => {})
|
||||
}catch(err){
|
||||
process.emit("uncaughtException",err)
|
||||
}
|
||||
}else if (didCrash && this.backupWorker){
|
||||
try{
|
||||
await this.backupWorker.callback({reason:"error"},derefParams,source,() => {})
|
||||
}catch(err){
|
||||
process.emit("uncaughtException",err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,7 @@
|
||||
///////////////////////////////////////
|
||||
//OPENTICKET BLACKLIST MODULE
|
||||
///////////////////////////////////////
|
||||
import { ODManager, ODManagerData, ODValidId } from "../modules/base"
|
||||
import { ODDebugger } from "../modules/console"
|
||||
import * as api from "@open-discord-bots/framework/api"
|
||||
|
||||
/**## ODBlacklist `class`
|
||||
* This is an Open Ticket blacklisted user.
|
||||
@@ -11,11 +10,11 @@ import { ODDebugger } from "../modules/console"
|
||||
*
|
||||
* Create this class & add it to the `ODBlacklistManager` to blacklist someone!
|
||||
*/
|
||||
export class ODBlacklist extends ODManagerData {
|
||||
export class ODBlacklist extends api.ODManagerData {
|
||||
/**The reason why this user got blacklisted. (optional) */
|
||||
#reason: string|null
|
||||
|
||||
constructor(id:ODValidId,reason:string|null){
|
||||
constructor(id:api.ODValidId,reason:string|null){
|
||||
super(id)
|
||||
this.#reason = reason
|
||||
}
|
||||
@@ -37,8 +36,8 @@ export class ODBlacklist extends ODManagerData {
|
||||
*
|
||||
* All `ODBlacklist`'s added, removed & edited in this list will be synced automatically with the database.
|
||||
*/
|
||||
export class ODBlacklistManager extends ODManager<ODBlacklist> {
|
||||
constructor(debug:ODDebugger){
|
||||
export class ODBlacklistManager extends api.ODManager<ODBlacklist> {
|
||||
constructor(debug:api.ODDebugger){
|
||||
super(debug,"blacklist")
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,8 @@
|
||||
///////////////////////////////////////
|
||||
//OPENTICKET OPTION MODULE
|
||||
///////////////////////////////////////
|
||||
import { ODDatabase } from "../modules/database"
|
||||
import * as api from "@open-discord-bots/framework/api"
|
||||
import { ODJsonConfig_DefaultOptionEmbedSettingsType, ODJsonConfig_DefaultOptionPingSettingsType } from "../defaults/config"
|
||||
import { ODId, ODManager, ODValidJsonType, ODValidId, ODVersion, ODValidButtonColor, ODManagerData, ODSystemError } from "../modules/base"
|
||||
import { ODDebugger } from "../modules/console"
|
||||
import * as discord from "discord.js"
|
||||
import * as crypto from "crypto"
|
||||
import { ODRoleUpdateMode } from "./role"
|
||||
@@ -16,13 +14,13 @@ import { ODRoleUpdateMode } from "./role"
|
||||
*
|
||||
* All option types including: tickets, websites & reaction roles are stored here.
|
||||
*/
|
||||
export class ODOptionManager extends ODManager<ODOption> {
|
||||
export class ODOptionManager extends api.ODManager<ODOption> {
|
||||
/**A reference to the Open Ticket debugger. */
|
||||
#debug: ODDebugger
|
||||
#debug: api.ODDebugger
|
||||
/**The option suffix manager used to generate channel suffixes for ticket names. */
|
||||
suffix: ODOptionSuffixManager
|
||||
|
||||
constructor(debug:ODDebugger){
|
||||
constructor(debug:api.ODDebugger){
|
||||
super(debug,"option")
|
||||
this.#debug = debug
|
||||
this.suffix = new ODOptionSuffixManager(debug)
|
||||
@@ -41,7 +39,7 @@ export interface ODOptionDataJson {
|
||||
/**The id of this property. */
|
||||
id:string,
|
||||
/**The value of this property. */
|
||||
value:ODValidJsonType
|
||||
value:api.ODValidJsonType
|
||||
}
|
||||
|
||||
/**## ODOptionDataJson `interface`
|
||||
@@ -65,15 +63,15 @@ export interface ODOptionJson {
|
||||
*
|
||||
* It's recommended to use `ODTicketOption`, `ODWebsiteOption` or `ODRoleOption` instead!
|
||||
*/
|
||||
export class ODOption extends ODManager<ODOptionData<ODValidJsonType>> {
|
||||
export class ODOption extends api.ODManager<ODOptionData<api.ODValidJsonType>> {
|
||||
/**The id of this option. (from the config) */
|
||||
id:ODId
|
||||
id:api.ODId
|
||||
/**The type of this option. (e.g. `opendiscord:ticket`, `opendiscord:website`, `opendiscord:role`) */
|
||||
type: string
|
||||
|
||||
constructor(id:ODValidId, type:string, data:ODOptionData<ODValidJsonType>[]){
|
||||
constructor(id:api.ODValidId, type:string, data:ODOptionData<api.ODValidJsonType>[]){
|
||||
super()
|
||||
this.id = new ODId(id)
|
||||
this.id = new api.ODId(id)
|
||||
this.type = type
|
||||
data.forEach((data) => {
|
||||
this.add(data)
|
||||
@@ -81,7 +79,7 @@ export class ODOption extends ODManager<ODOptionData<ODValidJsonType>> {
|
||||
}
|
||||
|
||||
/**Convert this option to a JSON object for storing this option in the database. */
|
||||
toJson(version:ODVersion): ODOptionJson {
|
||||
toJson(version:api.ODVersion): ODOptionJson {
|
||||
const data = this.getAll().map((data) => {
|
||||
return {
|
||||
id:data.id.toString(),
|
||||
@@ -110,11 +108,11 @@ export class ODOption extends ODManager<ODOptionData<ODValidJsonType>> {
|
||||
*
|
||||
* When this property is edited, the database will be updated automatically.
|
||||
*/
|
||||
export class ODOptionData<DataType extends ODValidJsonType> extends ODManagerData {
|
||||
export class ODOptionData<DataType extends api.ODValidJsonType> extends api.ODManagerData {
|
||||
/**The value of this property. */
|
||||
#value: DataType
|
||||
|
||||
constructor(id:ODValidId, value:DataType){
|
||||
constructor(id:api.ODValidId, value:DataType){
|
||||
super(id)
|
||||
this.#value = value
|
||||
}
|
||||
@@ -143,7 +141,7 @@ export interface ODTicketOptionIds {
|
||||
|
||||
"opendiscord:button-emoji":ODOptionData<string>,
|
||||
"opendiscord:button-label":ODOptionData<string>,
|
||||
"opendiscord:button-color":ODOptionData<ODValidButtonColor>,
|
||||
"opendiscord:button-color":ODOptionData<api.ODValidButtonColor>,
|
||||
|
||||
"opendiscord:admins":ODOptionData<string[]>,
|
||||
"opendiscord:admins-readonly":ODOptionData<string[]>,
|
||||
@@ -198,28 +196,28 @@ export interface ODTicketOptionIds {
|
||||
export class ODTicketOption extends ODOption {
|
||||
type: "opendiscord:ticket" = "opendiscord:ticket"
|
||||
|
||||
constructor(id:ODValidId, data:ODOptionData<ODValidJsonType>[]){
|
||||
constructor(id:api.ODValidId, data:ODOptionData<api.ODValidJsonType>[]){
|
||||
super(id,"opendiscord:ticket",data)
|
||||
}
|
||||
|
||||
get<OptionId extends keyof ODTicketOptionIds>(id:OptionId): ODTicketOptionIds[OptionId]
|
||||
get(id:ODValidId): ODOptionData<ODValidJsonType>|null
|
||||
get(id:api.ODValidId): ODOptionData<api.ODValidJsonType>|null
|
||||
|
||||
get(id:ODValidId): ODOptionData<ODValidJsonType>|null {
|
||||
get(id:api.ODValidId): ODOptionData<api.ODValidJsonType>|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<OptionId extends keyof ODTicketOptionIds>(id:OptionId): ODTicketOptionIds[OptionId]
|
||||
remove(id:ODValidId): ODOptionData<ODValidJsonType>|null
|
||||
remove(id:api.ODValidId): ODOptionData<api.ODValidJsonType>|null
|
||||
|
||||
remove(id:ODValidId): ODOptionData<ODValidJsonType>|null {
|
||||
remove(id:api.ODValidId): ODOptionData<api.ODValidJsonType>|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODTicketOptionIds): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
|
||||
@@ -252,28 +250,28 @@ export interface ODWebsiteOptionIds {
|
||||
export class ODWebsiteOption extends ODOption {
|
||||
type: "opendiscord:website" = "opendiscord:website"
|
||||
|
||||
constructor(id:ODValidId, data:ODOptionData<ODValidJsonType>[]){
|
||||
constructor(id:api.ODValidId, data:ODOptionData<api.ODValidJsonType>[]){
|
||||
super(id,"opendiscord:website",data)
|
||||
}
|
||||
|
||||
get<OptionId extends keyof ODWebsiteOptionIds>(id:OptionId): ODWebsiteOptionIds[OptionId]
|
||||
get(id:ODValidId): ODOptionData<ODValidJsonType>|null
|
||||
get(id:api.ODValidId): ODOptionData<api.ODValidJsonType>|null
|
||||
|
||||
get(id:ODValidId): ODOptionData<ODValidJsonType>|null {
|
||||
get(id:api.ODValidId): ODOptionData<api.ODValidJsonType>|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<OptionId extends keyof ODWebsiteOptionIds>(id:OptionId): ODWebsiteOptionIds[OptionId]
|
||||
remove(id:ODValidId): ODOptionData<ODValidJsonType>|null
|
||||
remove(id:api.ODValidId): ODOptionData<api.ODValidJsonType>|null
|
||||
|
||||
remove(id:ODValidId): ODOptionData<ODValidJsonType>|null {
|
||||
remove(id:api.ODValidId): ODOptionData<api.ODValidJsonType>|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODWebsiteOptionIds): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
|
||||
@@ -292,7 +290,7 @@ export interface ODRoleOptionIds {
|
||||
|
||||
"opendiscord:button-emoji":ODOptionData<string>,
|
||||
"opendiscord:button-label":ODOptionData<string>,
|
||||
"opendiscord:button-color":ODOptionData<ODValidButtonColor>,
|
||||
"opendiscord:button-color":ODOptionData<api.ODValidButtonColor>,
|
||||
|
||||
"opendiscord:roles":ODOptionData<string[]>,
|
||||
"opendiscord:mode":ODOptionData<ODRoleUpdateMode>,
|
||||
@@ -310,28 +308,28 @@ export interface ODRoleOptionIds {
|
||||
export class ODRoleOption extends ODOption {
|
||||
type: "opendiscord:role" = "opendiscord:role"
|
||||
|
||||
constructor(id:ODValidId, data:ODOptionData<ODValidJsonType>[]){
|
||||
constructor(id:api.ODValidId, data:ODOptionData<api.ODValidJsonType>[]){
|
||||
super(id,"opendiscord:role",data)
|
||||
}
|
||||
|
||||
get<OptionId extends keyof ODRoleOptionIds>(id:OptionId): ODRoleOptionIds[OptionId]
|
||||
get(id:ODValidId): ODOptionData<ODValidJsonType>|null
|
||||
get(id:api.ODValidId): ODOptionData<api.ODValidJsonType>|null
|
||||
|
||||
get(id:ODValidId): ODOptionData<ODValidJsonType>|null {
|
||||
get(id:api.ODValidId): ODOptionData<api.ODValidJsonType>|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<OptionId extends keyof ODRoleOptionIds>(id:OptionId): ODRoleOptionIds[OptionId]
|
||||
remove(id:ODValidId): ODOptionData<ODValidJsonType>|null
|
||||
remove(id:api.ODValidId): ODOptionData<api.ODValidJsonType>|null
|
||||
|
||||
remove(id:ODValidId): ODOptionData<ODValidJsonType>|null {
|
||||
remove(id:api.ODValidId): ODOptionData<api.ODValidJsonType>|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODRoleOptionIds): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
|
||||
@@ -347,8 +345,8 @@ export class ODRoleOption extends ODOption {
|
||||
*
|
||||
* All ticket options should have a corresponding option suffix class.
|
||||
*/
|
||||
export class ODOptionSuffixManager extends ODManager<ODOptionSuffix> {
|
||||
constructor(debug:ODDebugger){
|
||||
export class ODOptionSuffixManager extends api.ODManager<ODOptionSuffix> {
|
||||
constructor(debug:api.ODDebugger){
|
||||
super(debug,"ticket suffix")
|
||||
}
|
||||
|
||||
@@ -381,18 +379,18 @@ export class ODOptionSuffixManager extends ODManager<ODOptionSuffix> {
|
||||
*
|
||||
* Use `getSuffix()` to get the new suffix!
|
||||
*/
|
||||
export class ODOptionSuffix extends ODManagerData {
|
||||
export class ODOptionSuffix extends api.ODManagerData {
|
||||
/**The option of this suffix. */
|
||||
option: ODTicketOption
|
||||
|
||||
constructor(id:ODValidId, option:ODTicketOption){
|
||||
constructor(id:api.ODValidId, option:ODTicketOption){
|
||||
super(id)
|
||||
this.option = option
|
||||
}
|
||||
|
||||
/**Get the suffix for a new ticket. */
|
||||
async getSuffix(member:discord.GuildMember): Promise<string> {
|
||||
throw new ODSystemError("Tried to use an unimplemented ODOptionSuffix!")
|
||||
throw new api.ODSystemError("Tried to use an unimplemented ODOptionSuffix!")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -444,9 +442,9 @@ export class ODOptionUserIdSuffix extends ODOptionSuffix {
|
||||
*/
|
||||
export class ODOptionCounterDynamicSuffix extends ODOptionSuffix {
|
||||
/**The database where the value of this counter is stored. */
|
||||
database: ODDatabase
|
||||
database: api.ODDatabase
|
||||
|
||||
constructor(id:ODValidId, option:ODTicketOption, database:ODDatabase){
|
||||
constructor(id:api.ODValidId, option:ODTicketOption, database:api.ODDatabase){
|
||||
super(id,option)
|
||||
this.database = database
|
||||
this.#init()
|
||||
@@ -474,9 +472,9 @@ export class ODOptionCounterDynamicSuffix extends ODOptionSuffix {
|
||||
*/
|
||||
export class ODOptionCounterFixedSuffix extends ODOptionSuffix {
|
||||
/**The database where the value of this counter is stored. */
|
||||
database: ODDatabase
|
||||
database: api.ODDatabase
|
||||
|
||||
constructor(id:ODValidId, option:ODTicketOption, database:ODDatabase){
|
||||
constructor(id:api.ODValidId, option:ODTicketOption, database:api.ODDatabase){
|
||||
super(id,option)
|
||||
this.database = database
|
||||
this.#init()
|
||||
@@ -508,9 +506,9 @@ export class ODOptionCounterFixedSuffix extends ODOptionSuffix {
|
||||
*/
|
||||
export class ODOptionRandomNumberSuffix extends ODOptionSuffix {
|
||||
/**The database where previous random numbers are stored. */
|
||||
database: ODDatabase
|
||||
database: api.ODDatabase
|
||||
|
||||
constructor(id:ODValidId, option:ODTicketOption, database:ODDatabase){
|
||||
constructor(id:api.ODValidId, option:ODTicketOption, database:api.ODDatabase){
|
||||
super(id,option)
|
||||
this.database = database
|
||||
this.#init()
|
||||
@@ -551,9 +549,9 @@ export class ODOptionRandomNumberSuffix extends ODOptionSuffix {
|
||||
*/
|
||||
export class ODOptionRandomHexSuffix extends ODOptionSuffix {
|
||||
/**The database where previous random hexes are stored. */
|
||||
database: ODDatabase
|
||||
database: api.ODDatabase
|
||||
|
||||
constructor(id:ODValidId, option:ODTicketOption, database:ODDatabase){
|
||||
constructor(id:api.ODValidId, option:ODTicketOption, database:api.ODDatabase){
|
||||
super(id,option)
|
||||
this.database = database
|
||||
this.#init()
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
///////////////////////////////////////
|
||||
//OPENTICKET PANEL MODULE
|
||||
///////////////////////////////////////
|
||||
import * as api from "@open-discord-bots/framework/api"
|
||||
import { ODJsonConfig_DefaultPanelEmbedSettingsType } from "../defaults/config"
|
||||
import { ODId, ODManager, ODValidJsonType, ODValidId, ODVersion, ODValidButtonColor, ODManagerData } from "../modules/base"
|
||||
import { ODDebugger } from "../modules/console"
|
||||
|
||||
/**## ODPanelManager `class`
|
||||
* This is an Open Ticket panel manager.
|
||||
@@ -12,11 +11,11 @@ import { ODDebugger } from "../modules/console"
|
||||
*
|
||||
* Panels are not stored in the database and will be parsed from the config every startup.
|
||||
*/
|
||||
export class ODPanelManager extends ODManager<ODPanel> {
|
||||
export class ODPanelManager extends api.ODManager<ODPanel> {
|
||||
/**A reference to the Open Ticket debugger. */
|
||||
#debug: ODDebugger
|
||||
#debug: api.ODDebugger
|
||||
|
||||
constructor(debug:ODDebugger){
|
||||
constructor(debug:api.ODDebugger){
|
||||
super(debug,"option")
|
||||
this.#debug = debug
|
||||
}
|
||||
@@ -34,7 +33,7 @@ export interface ODPanelDataJson {
|
||||
/**The id of this property. */
|
||||
id:string,
|
||||
/**The value of this property. */
|
||||
value:ODValidJsonType
|
||||
value:api.ODValidJsonType
|
||||
}
|
||||
|
||||
/**## ODPanelDataJson `interface`
|
||||
@@ -78,20 +77,20 @@ export interface ODPanelIds {
|
||||
*
|
||||
* This class contains all data related to this panel (parsed from the config).
|
||||
*/
|
||||
export class ODPanel extends ODManager<ODPanelData<ODValidJsonType>> {
|
||||
export class ODPanel extends api.ODManager<ODPanelData<api.ODValidJsonType>> {
|
||||
/**The id of this panel. (from the config) */
|
||||
id:ODId
|
||||
id:api.ODId
|
||||
|
||||
constructor(id:ODValidId, data:ODPanelData<ODValidJsonType>[]){
|
||||
constructor(id:api.ODValidId, data:ODPanelData<api.ODValidJsonType>[]){
|
||||
super()
|
||||
this.id = new ODId(id)
|
||||
this.id = new api.ODId(id)
|
||||
data.forEach((data) => {
|
||||
this.add(data)
|
||||
})
|
||||
}
|
||||
|
||||
/**Convert this panel to a JSON object for storing this panel in the database. */
|
||||
toJson(version:ODVersion): ODPanelJson {
|
||||
toJson(version:api.ODVersion): ODPanelJson {
|
||||
const data = this.getAll().map((data) => {
|
||||
return {
|
||||
id:data.id.toString(),
|
||||
@@ -112,23 +111,23 @@ export class ODPanel extends ODManager<ODPanelData<ODValidJsonType>> {
|
||||
}
|
||||
|
||||
get<PanelId extends keyof ODPanelIds>(id:PanelId): ODPanelIds[PanelId]
|
||||
get(id:ODValidId): ODPanelData<ODValidJsonType>|null
|
||||
get(id:api.ODValidId): ODPanelData<api.ODValidJsonType>|null
|
||||
|
||||
get(id:ODValidId): ODPanelData<ODValidJsonType>|null {
|
||||
get(id:api.ODValidId): ODPanelData<api.ODValidJsonType>|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<PanelId extends keyof ODPanelIds>(id:PanelId): ODPanelIds[PanelId]
|
||||
remove(id:ODValidId): ODPanelData<ODValidJsonType>|null
|
||||
remove(id:api.ODValidId): ODPanelData<api.ODValidJsonType>|null
|
||||
|
||||
remove(id:ODValidId): ODPanelData<ODValidJsonType>|null {
|
||||
remove(id:api.ODValidId): ODPanelData<api.ODValidJsonType>|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODPanelIds): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
}
|
||||
@@ -140,11 +139,11 @@ export class ODPanel extends ODManager<ODPanelData<ODValidJsonType>> {
|
||||
*
|
||||
* When this property is edited, the database will be updated automatically.
|
||||
*/
|
||||
export class ODPanelData<DataType extends ODValidJsonType> extends ODManagerData {
|
||||
export class ODPanelData<DataType extends api.ODValidJsonType> extends api.ODManagerData {
|
||||
/**The value of this property. */
|
||||
#value: DataType
|
||||
|
||||
constructor(id:ODValidId, value:DataType){
|
||||
constructor(id:api.ODValidId, value:DataType){
|
||||
super(id)
|
||||
this.#value = value
|
||||
}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
///////////////////////////////////////
|
||||
//OPENTICKET PRIORITY MODULE
|
||||
///////////////////////////////////////
|
||||
import { ODId, ODManager, ODValidJsonType, ODValidId, ODVersion, ODManagerData } from "../modules/base"
|
||||
import { ODDebugger } from "../modules/console"
|
||||
import * as api from "@open-discord-bots/framework/api"
|
||||
import * as discord from "discord.js"
|
||||
|
||||
/**## ODPriorityManager `class`
|
||||
@@ -12,11 +11,11 @@ import * as discord from "discord.js"
|
||||
*
|
||||
* Priorities levels can be changed/updated/translated by plugins to allow for more customisability.
|
||||
*/
|
||||
export class ODPriorityManager extends ODManager<ODPriorityLevel> {
|
||||
export class ODPriorityManager extends api.ODManager<ODPriorityLevel> {
|
||||
/**A reference to the Open Ticket debugger. */
|
||||
#debug: ODDebugger
|
||||
#debug: api.ODDebugger
|
||||
|
||||
constructor(debug:ODDebugger){
|
||||
constructor(debug:api.ODDebugger){
|
||||
super(debug,"priority")
|
||||
this.#debug = debug
|
||||
}
|
||||
@@ -53,23 +52,23 @@ export interface ODPriorityManagerIds {
|
||||
*/
|
||||
export class ODPriorityManager_Default extends ODPriorityManager {
|
||||
get<PriorityId extends keyof ODPriorityManagerIds>(id:PriorityId): ODPriorityManagerIds[PriorityId]
|
||||
get(id:ODValidId): ODPriorityLevel|null
|
||||
get(id:api.ODValidId): ODPriorityLevel|null
|
||||
|
||||
get(id:ODValidId): ODPriorityLevel|null {
|
||||
get(id:api.ODValidId): ODPriorityLevel|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<PriorityId extends keyof ODPriorityManagerIds>(id:PriorityId): ODPriorityManagerIds[PriorityId]
|
||||
remove(id:ODValidId): ODPriorityLevel|null
|
||||
remove(id:api.ODValidId): ODPriorityLevel|null
|
||||
|
||||
remove(id:ODValidId): ODPriorityLevel|null {
|
||||
remove(id:api.ODValidId): ODPriorityLevel|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODPriorityManagerIds): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
}
|
||||
@@ -83,7 +82,7 @@ export class ODPriorityManager_Default extends ODPriorityManager {
|
||||
*
|
||||
* #### 🚨 Negative priorities are treated as `disabled/no-priority`!
|
||||
*/
|
||||
export class ODPriorityLevel extends ODManagerData {
|
||||
export class ODPriorityLevel extends api.ODManagerData {
|
||||
/**The priority level itself. A negative number (e.g. `-1`) is treated as `disabled/no-priority`. */
|
||||
priority:number
|
||||
/**The raw name of the level (used in text/slash command inputs). */
|
||||
@@ -95,7 +94,7 @@ export class ODPriorityLevel extends ODManagerData {
|
||||
/**The emoji added to the channel name when the level is applied to a ticket. */
|
||||
channelEmoji:string|null
|
||||
|
||||
constructor(id:ODValidId,priority:number,rawName:string,displayName:string,displayEmoji:string|null,channelEmoji:string|null){
|
||||
constructor(id:api.ODValidId,priority:number,rawName:string,displayName:string,displayEmoji:string|null,channelEmoji:string|null){
|
||||
super(id)
|
||||
this.priority = priority
|
||||
this.rawName = rawName
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
///////////////////////////////////////
|
||||
//OPENTICKET OPTION MODULE
|
||||
///////////////////////////////////////
|
||||
import { ODId, ODManager, ODValidJsonType, ODValidId, ODVersion, ODManagerData } from "../modules/base"
|
||||
import { ODDebugger } from "../modules/console"
|
||||
import * as api from "@open-discord-bots/framework/api"
|
||||
|
||||
/**## ODQuestionManager `class`
|
||||
* This is an Open Ticket question manager.
|
||||
@@ -11,11 +10,11 @@ import { ODDebugger } from "../modules/console"
|
||||
*
|
||||
* Questions are not stored in the database and will be parsed from the config every startup.
|
||||
*/
|
||||
export class ODQuestionManager extends ODManager<ODQuestion> {
|
||||
export class ODQuestionManager extends api.ODManager<ODQuestion> {
|
||||
/**A reference to the Open Ticket debugger. */
|
||||
#debug: ODDebugger
|
||||
#debug: api.ODDebugger
|
||||
|
||||
constructor(debug:ODDebugger){
|
||||
constructor(debug:api.ODDebugger){
|
||||
super(debug,"question")
|
||||
this.#debug = debug
|
||||
}
|
||||
@@ -33,7 +32,7 @@ export interface ODQuestionDataJson {
|
||||
/**The id of this property. */
|
||||
id:string,
|
||||
/**The value of this property. */
|
||||
value:ODValidJsonType
|
||||
value:api.ODValidJsonType
|
||||
}
|
||||
|
||||
/**## ODQuestionDataJson `interface`
|
||||
@@ -57,15 +56,15 @@ export interface ODQuestionJson {
|
||||
*
|
||||
* Use `ODShortQuestion` or `ODParagraphQuestion` instead!
|
||||
*/
|
||||
export class ODQuestion extends ODManager<ODQuestionData<ODValidJsonType>> {
|
||||
export class ODQuestion extends api.ODManager<ODQuestionData<api.ODValidJsonType>> {
|
||||
/**The id of this question. (from the config) */
|
||||
id:ODId
|
||||
id:api.ODId
|
||||
/**The type of this question (e.g. `opendiscord:short` or `opendiscord:paragraph`) */
|
||||
type: string
|
||||
|
||||
constructor(id:ODValidId, type:string, data:ODQuestionData<ODValidJsonType>[]){
|
||||
constructor(id:api.ODValidId, type:string, data:ODQuestionData<api.ODValidJsonType>[]){
|
||||
super()
|
||||
this.id = new ODId(id)
|
||||
this.id = new api.ODId(id)
|
||||
this.type = type
|
||||
data.forEach((data) => {
|
||||
this.add(data)
|
||||
@@ -73,7 +72,7 @@ export class ODQuestion extends ODManager<ODQuestionData<ODValidJsonType>> {
|
||||
}
|
||||
|
||||
/**Convert this question to a JSON object for storing this question in the database. */
|
||||
toJson(version:ODVersion): ODQuestionJson {
|
||||
toJson(version:api.ODVersion): ODQuestionJson {
|
||||
const data = this.getAll().map((data) => {
|
||||
return {
|
||||
id:data.id.toString(),
|
||||
@@ -102,11 +101,11 @@ export class ODQuestion extends ODManager<ODQuestionData<ODValidJsonType>> {
|
||||
*
|
||||
* When this property is edited, the database will be updated automatically.
|
||||
*/
|
||||
export class ODQuestionData<DataType extends ODValidJsonType> extends ODManagerData {
|
||||
export class ODQuestionData<DataType extends api.ODValidJsonType> extends api.ODManagerData {
|
||||
/**The value of this property. */
|
||||
#value: DataType
|
||||
|
||||
constructor(id:ODValidId, value:DataType){
|
||||
constructor(id:api.ODValidId, value:DataType){
|
||||
super(id)
|
||||
this.#value = value
|
||||
}
|
||||
@@ -149,28 +148,28 @@ export interface ODShortQuestionIds {
|
||||
export class ODShortQuestion extends ODQuestion {
|
||||
type: "opendiscord:short" = "opendiscord:short"
|
||||
|
||||
constructor(id:ODValidId, data:ODQuestionData<ODValidJsonType>[]){
|
||||
constructor(id:api.ODValidId, data:ODQuestionData<api.ODValidJsonType>[]){
|
||||
super(id,"opendiscord:short",data)
|
||||
}
|
||||
|
||||
get<QuestionId extends keyof ODShortQuestionIds>(id:QuestionId): ODShortQuestionIds[QuestionId]
|
||||
get(id:ODValidId): ODQuestionData<ODValidJsonType>|null
|
||||
get(id:api.ODValidId): ODQuestionData<api.ODValidJsonType>|null
|
||||
|
||||
get(id:ODValidId): ODQuestionData<ODValidJsonType>|null {
|
||||
get(id:api.ODValidId): ODQuestionData<api.ODValidJsonType>|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<QuestionId extends keyof ODShortQuestionIds>(id:QuestionId): ODShortQuestionIds[QuestionId]
|
||||
remove(id:ODValidId): ODQuestionData<ODValidJsonType>|null
|
||||
remove(id:api.ODValidId): ODQuestionData<api.ODValidJsonType>|null
|
||||
|
||||
remove(id:ODValidId): ODQuestionData<ODValidJsonType>|null {
|
||||
remove(id:api.ODValidId): ODQuestionData<api.ODValidJsonType>|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODShortQuestionIds): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
|
||||
@@ -203,28 +202,28 @@ export interface ODParagraphQuestionIds {
|
||||
export class ODParagraphQuestion extends ODQuestion {
|
||||
type: "opendiscord:paragraph" = "opendiscord:paragraph"
|
||||
|
||||
constructor(id:ODValidId, data:ODQuestionData<ODValidJsonType>[]){
|
||||
constructor(id:api.ODValidId, data:ODQuestionData<api.ODValidJsonType>[]){
|
||||
super(id,"opendiscord:paragraph",data)
|
||||
}
|
||||
|
||||
get<QuestionId extends keyof ODParagraphQuestionIds>(id:QuestionId): ODParagraphQuestionIds[QuestionId]
|
||||
get(id:ODValidId): ODQuestionData<ODValidJsonType>|null
|
||||
get(id:api.ODValidId): ODQuestionData<api.ODValidJsonType>|null
|
||||
|
||||
get(id:ODValidId): ODQuestionData<ODValidJsonType>|null {
|
||||
get(id:api.ODValidId): ODQuestionData<api.ODValidJsonType>|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<QuestionId extends keyof ODParagraphQuestionIds>(id:QuestionId): ODParagraphQuestionIds[QuestionId]
|
||||
remove(id:ODValidId): ODQuestionData<ODValidJsonType>|null
|
||||
remove(id:api.ODValidId): ODQuestionData<api.ODValidJsonType>|null
|
||||
|
||||
remove(id:ODValidId): ODQuestionData<ODValidJsonType>|null {
|
||||
remove(id:api.ODValidId): ODQuestionData<api.ODValidJsonType>|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODParagraphQuestionIds): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
///////////////////////////////////////
|
||||
//OPENTICKET ROLE MODULE
|
||||
///////////////////////////////////////
|
||||
import { ODId, ODManager, ODValidJsonType, ODValidId, ODVersion, ODManagerData } from "../modules/base"
|
||||
import { ODDebugger } from "../modules/console"
|
||||
import * as api from "@open-discord-bots/framework/api"
|
||||
import * as discord from "discord.js"
|
||||
|
||||
/**## ODRoleManager `class`
|
||||
@@ -12,11 +11,11 @@ import * as discord from "discord.js"
|
||||
*
|
||||
* Roles are not stored in the database and will be parsed from the config every startup.
|
||||
*/
|
||||
export class ODRoleManager extends ODManager<ODRole> {
|
||||
export class ODRoleManager extends api.ODManager<ODRole> {
|
||||
/**A reference to the Open Ticket debugger. */
|
||||
#debug: ODDebugger
|
||||
#debug: api.ODDebugger
|
||||
|
||||
constructor(debug:ODDebugger){
|
||||
constructor(debug:api.ODDebugger){
|
||||
super(debug,"role")
|
||||
this.#debug = debug
|
||||
}
|
||||
@@ -34,7 +33,7 @@ export interface ODRoleDataJson {
|
||||
/**The id of this property. */
|
||||
id:string,
|
||||
/**The value of this property. */
|
||||
value:ODValidJsonType
|
||||
value:api.ODValidJsonType
|
||||
}
|
||||
|
||||
/**## ODRoleJson `interface`
|
||||
@@ -67,20 +66,20 @@ export interface ODRoleIds {
|
||||
*
|
||||
* These properties will be used to handle reaction role options.
|
||||
*/
|
||||
export class ODRole extends ODManager<ODRoleData<ODValidJsonType>> {
|
||||
export class ODRole extends api.ODManager<ODRoleData<api.ODValidJsonType>> {
|
||||
/**The id of this role. (from the config) */
|
||||
id:ODId
|
||||
id:api.ODId
|
||||
|
||||
constructor(id:ODValidId, data:ODRoleData<ODValidJsonType>[]){
|
||||
constructor(id:api.ODValidId, data:ODRoleData<api.ODValidJsonType>[]){
|
||||
super()
|
||||
this.id = new ODId(id)
|
||||
this.id = new api.ODId(id)
|
||||
data.forEach((data) => {
|
||||
this.add(data)
|
||||
})
|
||||
}
|
||||
|
||||
/**Convert this role to a JSON object for storing this role in the database. */
|
||||
toJson(version:ODVersion): ODRoleJson {
|
||||
toJson(version:api.ODVersion): ODRoleJson {
|
||||
const data = this.getAll().map((data) => {
|
||||
return {
|
||||
id:data.id.toString(),
|
||||
@@ -101,23 +100,23 @@ export class ODRole extends ODManager<ODRoleData<ODValidJsonType>> {
|
||||
}
|
||||
|
||||
get<OptionId extends keyof ODRoleIds>(id:OptionId): ODRoleIds[OptionId]
|
||||
get(id:ODValidId): ODRoleData<ODValidJsonType>|null
|
||||
get(id:api.ODValidId): ODRoleData<api.ODValidJsonType>|null
|
||||
|
||||
get(id:ODValidId): ODRoleData<ODValidJsonType>|null {
|
||||
get(id:api.ODValidId): ODRoleData<api.ODValidJsonType>|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<OptionId extends keyof ODRoleIds>(id:OptionId): ODRoleIds[OptionId]
|
||||
remove(id:ODValidId): ODRoleData<ODValidJsonType>|null
|
||||
remove(id:api.ODValidId): ODRoleData<api.ODValidJsonType>|null
|
||||
|
||||
remove(id:ODValidId): ODRoleData<ODValidJsonType>|null {
|
||||
remove(id:api.ODValidId): ODRoleData<api.ODValidJsonType>|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODRoleIds): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
}
|
||||
@@ -129,11 +128,11 @@ export class ODRole extends ODManager<ODRoleData<ODValidJsonType>> {
|
||||
*
|
||||
* When this property is edited, the database will be updated automatically.
|
||||
*/
|
||||
export class ODRoleData<DataType extends ODValidJsonType> extends ODManagerData {
|
||||
export class ODRoleData<DataType extends api.ODValidJsonType> extends api.ODManagerData {
|
||||
/**The value of this property. */
|
||||
#value: DataType
|
||||
|
||||
constructor(id:ODValidId, value:DataType){
|
||||
constructor(id:api.ODValidId, value:DataType){
|
||||
super(id)
|
||||
this.#value = value
|
||||
}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
///////////////////////////////////////
|
||||
//OPENTICKET TICKET MODULE
|
||||
///////////////////////////////////////
|
||||
import { ODId, ODManager, ODValidJsonType, ODValidId, ODVersion, ODManagerData } from "../modules/base"
|
||||
import { ODDebugger } from "../modules/console"
|
||||
import * as api from "@open-discord-bots/framework/api"
|
||||
import { ODClientManager_Default } from "../defaults/client"
|
||||
import { ODTicketOption } from "./option"
|
||||
import * as discord from "discord.js"
|
||||
@@ -14,15 +13,15 @@ import * as discord from "discord.js"
|
||||
*
|
||||
* All tickets which are added, removed or modified in this manager will be updated automatically in the database.
|
||||
*/
|
||||
export class ODTicketManager extends ODManager<ODTicket> {
|
||||
export class ODTicketManager extends api.ODManager<ODTicket> {
|
||||
/**A reference to the main server of the bot */
|
||||
#guild: discord.Guild|null = null
|
||||
/**A reference to the Open Ticket client manager. */
|
||||
#client: ODClientManager_Default
|
||||
/**A reference to the Open Ticket debugger. */
|
||||
#debug: ODDebugger
|
||||
#debug: api.ODDebugger
|
||||
|
||||
constructor(debug:ODDebugger, client:ODClientManager_Default){
|
||||
constructor(debug:api.ODDebugger, client:ODClientManager_Default){
|
||||
super(debug,"ticket")
|
||||
this.#debug = debug
|
||||
this.#client = client
|
||||
@@ -132,7 +131,7 @@ export interface ODTicketDataJson {
|
||||
/**The id of this property. */
|
||||
id:string,
|
||||
/**The value of this property. */
|
||||
value:ODValidJsonType
|
||||
value:api.ODValidJsonType
|
||||
}
|
||||
|
||||
/**## ODTicketDataJson `interface`
|
||||
@@ -200,15 +199,15 @@ export interface ODTicketIds {
|
||||
*
|
||||
* These properties contain the current state of the ticket & are used by actions like claiming, pinning, closing, ...
|
||||
*/
|
||||
export class ODTicket extends ODManager<ODTicketData<ODValidJsonType>> {
|
||||
export class ODTicket extends api.ODManager<ODTicketData<api.ODValidJsonType>> {
|
||||
/**The id of this ticket. (discord channel id) */
|
||||
id:ODId
|
||||
id:api.ODId
|
||||
/**The option related to this ticket. */
|
||||
#option: ODTicketOption
|
||||
|
||||
constructor(id:ODValidId, option:ODTicketOption, data:ODTicketData<ODValidJsonType>[]){
|
||||
constructor(id:api.ODValidId, option:ODTicketOption, data:ODTicketData<api.ODValidJsonType>[]){
|
||||
super()
|
||||
this.id = new ODId(id)
|
||||
this.id = new api.ODId(id)
|
||||
this.#option = option
|
||||
data.forEach((data) => {
|
||||
this.add(data)
|
||||
@@ -225,7 +224,7 @@ export class ODTicket extends ODManager<ODTicketData<ODValidJsonType>> {
|
||||
}
|
||||
|
||||
/**Convert this ticket to a JSON object for storing this ticket in the database. */
|
||||
toJson(version:ODVersion): ODTicketJson {
|
||||
toJson(version:api.ODVersion): ODTicketJson {
|
||||
const data = this.getAll().map((data) => {
|
||||
return {
|
||||
id:data.id.toString(),
|
||||
@@ -247,23 +246,23 @@ export class ODTicket extends ODManager<ODTicketData<ODValidJsonType>> {
|
||||
}
|
||||
|
||||
get<OptionId extends keyof ODTicketIds>(id:OptionId): ODTicketIds[OptionId]
|
||||
get(id:ODValidId): ODTicketData<ODValidJsonType>|null
|
||||
get(id:api.ODValidId): ODTicketData<api.ODValidJsonType>|null
|
||||
|
||||
get(id:ODValidId): ODTicketData<ODValidJsonType>|null {
|
||||
get(id:api.ODValidId): ODTicketData<api.ODValidJsonType>|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<OptionId extends keyof ODTicketIds>(id:OptionId): ODTicketIds[OptionId]
|
||||
remove(id:ODValidId): ODTicketData<ODValidJsonType>|null
|
||||
remove(id:api.ODValidId): ODTicketData<api.ODValidJsonType>|null
|
||||
|
||||
remove(id:ODValidId): ODTicketData<ODValidJsonType>|null {
|
||||
remove(id:api.ODValidId): ODTicketData<api.ODValidJsonType>|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODTicketIds): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
}
|
||||
@@ -275,11 +274,11 @@ export class ODTicket extends ODManager<ODTicketData<ODValidJsonType>> {
|
||||
*
|
||||
* When this property is edited, the database will be updated automatically.
|
||||
*/
|
||||
export class ODTicketData<DataType extends ODValidJsonType> extends ODManagerData {
|
||||
export class ODTicketData<DataType extends api.ODValidJsonType> extends api.ODManagerData {
|
||||
/**The value of this property. */
|
||||
#value: DataType
|
||||
|
||||
constructor(id:ODValidId, value:DataType){
|
||||
constructor(id:api.ODValidId, value:DataType){
|
||||
super(id)
|
||||
this.#value = value
|
||||
}
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
///////////////////////////////////////
|
||||
//OPENTICKET TRANSCRIPT MODULE
|
||||
///////////////////////////////////////
|
||||
import { ODId, ODManager, ODValidJsonType, ODValidId, ODManagerData, ODValidButtonColor } from "../modules/base"
|
||||
import { ODDebugger } from "../modules/console"
|
||||
import * as api from "@open-discord-bots/framework/api"
|
||||
import { ODPermissionManager_Default } from "../defaults/permission"
|
||||
import { ODTicket, ODTicketManager } from "./ticket"
|
||||
import { ODMessageBuildResult } from "../modules/builder"
|
||||
import { ODClientManager } from "../modules/client"
|
||||
import * as discord from "discord.js"
|
||||
import { ODPermissionManager_Default } from "#opendiscord-types"
|
||||
|
||||
/**## ODTranscriptManager `class`
|
||||
* This is an Open Ticket transcript manager.
|
||||
@@ -16,13 +13,13 @@ import { ODPermissionManager_Default } from "#opendiscord-types"
|
||||
*
|
||||
* The 2 default built-in transcript generators are: `opendiscord:html-compiler` & `opendiscord:text-compiler`.
|
||||
*/
|
||||
export class ODTranscriptManager extends ODManager<ODTranscriptCompiler<any,null|object>> {
|
||||
export class ODTranscriptManager extends api.ODManager<ODTranscriptCompiler<any,null|object>> {
|
||||
/**The manager responsible for collecting all messages in a channel. */
|
||||
collector: ODTranscriptCollector
|
||||
/**Alias for the client manager. */
|
||||
#client: ODClientManager
|
||||
#client: api.ODClientManager
|
||||
|
||||
constructor(debug:ODDebugger, tickets:ODTicketManager, client:ODClientManager, permissions:ODPermissionManager_Default){
|
||||
constructor(debug:api.ODDebugger, tickets:ODTicketManager, client:api.ODClientManager, permissions:ODPermissionManager_Default){
|
||||
super(debug,"transcript compiler")
|
||||
this.#client = client
|
||||
this.collector = new ODTranscriptCollector(tickets,client,permissions)
|
||||
@@ -53,7 +50,7 @@ export interface ODTranscriptCompilerInitResult<InitData extends object|null> {
|
||||
/**When not successfull, what was the reason? This will also be shown to the user. */
|
||||
errorReason:string|null,
|
||||
/**An optional message which will be sent while the transcript is being generated. */
|
||||
pendingMessage:ODMessageBuildResult|null,
|
||||
pendingMessage:api.ODMessageBuildResult|null,
|
||||
/**An optional object containing data from the init() function which can be used in the compiler. */
|
||||
initData:InitData,
|
||||
}
|
||||
@@ -83,15 +80,15 @@ export interface ODTranscriptCompilerCompileResult<Data extends object> {
|
||||
*/
|
||||
export interface ODTranscriptCompilerReadyResult {
|
||||
/**The message to be sent in the specified channel in the server. */
|
||||
channelMessage?:ODMessageBuildResult,
|
||||
channelMessage?:api.ODMessageBuildResult,
|
||||
/**The message to be sent to the DM of the ticket creator. */
|
||||
creatorDmMessage?:ODMessageBuildResult,
|
||||
creatorDmMessage?:api.ODMessageBuildResult,
|
||||
/**The message to be sent to the DM of all participants. */
|
||||
participantDmMessage?:ODMessageBuildResult,
|
||||
participantDmMessage?:api.ODMessageBuildResult,
|
||||
/**The message to be sent to the DM of all admins who actively participated in the ticket. */
|
||||
activeAdminDmMessage?:ODMessageBuildResult,
|
||||
activeAdminDmMessage?:api.ODMessageBuildResult,
|
||||
/**The message to be sent to the DM of all admins who were assigned to this ticket. */
|
||||
everyAdminDmMessage?:ODMessageBuildResult
|
||||
everyAdminDmMessage?:api.ODMessageBuildResult
|
||||
}
|
||||
|
||||
/**## ODTranscriptCompiler `class`
|
||||
@@ -101,7 +98,7 @@ export interface ODTranscriptCompilerReadyResult {
|
||||
*
|
||||
* These functions should be defined when creating this compiler. Existing compilers already exist for html & text transcripts.
|
||||
*/
|
||||
export class ODTranscriptCompiler<Data extends object,InitData extends (object|null)> extends ODManagerData {
|
||||
export class ODTranscriptCompiler<Data extends object,InitData extends (object|null)> extends api.ODManagerData {
|
||||
/*Initialise the system every time a transcript is created. Returns optional "pending" message to display while the transcript is being compiled. */
|
||||
init: ODTranscriptCompilerInitFunction<InitData>|null
|
||||
/*Compile or create the transcript. Returns data to give to the ready() function for message creation. */
|
||||
@@ -109,7 +106,7 @@ export class ODTranscriptCompiler<Data extends object,InitData extends (object|n
|
||||
/*Unload the system & create the final transcript message that will be sent. */
|
||||
ready: ODTranscriptCompilerReadyFunction<Data>|null
|
||||
|
||||
constructor(id:ODValidId, init?:ODTranscriptCompilerInitFunction<InitData>, compile?:ODTranscriptCompilerCompileFunction<Data,InitData>, ready?:ODTranscriptCompilerReadyFunction<Data>|null){
|
||||
constructor(id:api.ODValidId, init?:ODTranscriptCompilerInitFunction<InitData>, compile?:ODTranscriptCompilerCompileFunction<Data,InitData>, ready?:ODTranscriptCompilerReadyFunction<Data>|null){
|
||||
super(id)
|
||||
this.init = init ?? null
|
||||
this.compile = compile ?? null
|
||||
@@ -134,23 +131,23 @@ export interface ODTranscriptCompilerIds {
|
||||
*/
|
||||
export class ODTranscriptManager_Default extends ODTranscriptManager {
|
||||
get<CompilerId extends keyof ODTranscriptCompilerIds>(id:CompilerId): ODTranscriptCompilerIds[CompilerId]
|
||||
get(id:ODValidId): ODTranscriptCompiler<any,null|object>|null
|
||||
get(id:api.ODValidId): ODTranscriptCompiler<any,null|object>|null
|
||||
|
||||
get(id:ODValidId): ODTranscriptCompiler<any,null|object>|null {
|
||||
get(id:api.ODValidId): ODTranscriptCompiler<any,null|object>|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<CompilerId extends keyof ODTranscriptCompilerIds>(id:CompilerId): ODTranscriptCompilerIds[CompilerId]
|
||||
remove(id:ODValidId): ODTranscriptCompiler<any,null|object>|null
|
||||
remove(id:api.ODValidId): ODTranscriptCompiler<any,null|object>|null
|
||||
|
||||
remove(id:ODValidId): ODTranscriptCompiler<any,null|object>|null {
|
||||
remove(id:api.ODValidId): ODTranscriptCompiler<any,null|object>|null {
|
||||
return super.remove(id)
|
||||
}
|
||||
|
||||
exists(id:keyof ODTranscriptCompilerIds): boolean
|
||||
exists(id:ODValidId): boolean
|
||||
exists(id:api.ODValidId): boolean
|
||||
|
||||
exists(id:ODValidId): boolean {
|
||||
exists(id:api.ODValidId): boolean {
|
||||
return super.exists(id)
|
||||
}
|
||||
}
|
||||
@@ -166,11 +163,11 @@ export class ODTranscriptCollector {
|
||||
/**Alias for the ticket manager. */
|
||||
#tickets: ODTicketManager
|
||||
/**Alias for the client manager. */
|
||||
#client: ODClientManager
|
||||
#client: api.ODClientManager
|
||||
/**Alias for the permissions manager. */
|
||||
#permissions: ODPermissionManager_Default
|
||||
|
||||
constructor(tickets:ODTicketManager,client:ODClientManager,permissions:ODPermissionManager_Default){
|
||||
constructor(tickets:ODTicketManager,client:api.ODClientManager,permissions:ODPermissionManager_Default){
|
||||
this.#tickets = tickets
|
||||
this.#client = client
|
||||
this.#permissions = permissions
|
||||
@@ -420,7 +417,7 @@ export class ODTranscriptCollector {
|
||||
}
|
||||
}
|
||||
/**Create the `ODValidButtonColor` from the discord.js button style. */
|
||||
#handleButtonComponentStyle(style:discord.ButtonStyle): ODValidButtonColor {
|
||||
#handleButtonComponentStyle(style:discord.ButtonStyle): api.ODValidButtonColor {
|
||||
if (style == discord.ButtonStyle.Danger) return "red"
|
||||
else if (style == discord.ButtonStyle.Success) return "green"
|
||||
else if (style == discord.ButtonStyle.Primary) return "blue"
|
||||
@@ -622,7 +619,7 @@ export interface ODTranscriptButtonComponentData extends ODTranscriptComponentDa
|
||||
/**The emoji of this button. */
|
||||
emoji: ODTranscriptEmojiData|null,
|
||||
/**The color of this button. */
|
||||
color: ODValidButtonColor,
|
||||
color: api.ODValidButtonColor,
|
||||
/**Is this button a url or button? */
|
||||
mode: "url"|"button",
|
||||
/**The url of this button. */
|
||||
|
||||
Reference in New Issue
Block a user