BREAKING: changed openticket to opendiscord in API

This commit is contained in:
DJj123dj
2025-02-01 10:22:27 +01:00
parent ce242741cd
commit 29f8e1452c
103 changed files with 2160 additions and 2175 deletions
+1 -1
View File
@@ -118,7 +118,7 @@ export interface ODActionManagerIds_Default {
* This is a special class that adds type definitions & typescript to the ODActionManager class.
* It doesn't add any extra features!
*
* This default class is made for the global variable `openticket.actions`!
* This default class is made for the global variable `opendiscord.actions`!
*/
export class ODActionManager_Default extends 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"]>
+1 -1
View File
@@ -19,7 +19,7 @@ export interface ODVersionManagerIds_Default {
* This is a special class that adds type definitions & typescript to the ODFlagManager class.
* It doesn't add any extra features!
*
* This default class is made for the global variable `openticket.flags`!
* This default class is made for the global variable `opendiscord.flags`!
*/
export class ODVersionManager_Default extends ODVersionManager {
get<VersionId extends keyof ODVersionManagerIds_Default>(id:VersionId): ODVersionManagerIds_Default[VersionId]
+7 -7
View File
@@ -18,7 +18,7 @@ import { ODRole, ODRoleUpdateResult } from "../openticket/role"
* This is a special class that adds type definitions & typescript to the ODBuilderManager class.
* It doesn't add any extra features!
*
* This default class is made for the global variable `openticket.builders`!
* This default class is made for the global variable `opendiscord.builders`!
*/
export class ODBuilderManager_Default extends ODBuilderManager {
declare buttons: ODButtonManager_Default
@@ -69,7 +69,7 @@ export interface ODButtonManagerIds_Default {
* This is a special class that adds type definitions & typescript to the ODButtonManager class.
* It doesn't add any extra features!
*
* This default class is made for the global variable `openticket.builders.buttons`!
* This default class is made for the global variable `opendiscord.builders.buttons`!
*/
export class ODButtonManager_Default extends ODButtonManager {
get<ButtonId extends keyof ODButtonManagerIds_Default>(id:ButtonId): ODButton_Default<ODButtonManagerIds_Default[ButtonId]["source"],ODButtonManagerIds_Default[ButtonId]["params"],ODButtonManagerIds_Default[ButtonId]["workers"]>
@@ -123,7 +123,7 @@ export interface ODDropdownManagerIds_Default {
* This is a special class that adds type definitions & typescript to the ODDropdownManager class.
* It doesn't add any extra features!
*
* This default class is made for the global variable `openticket.builders.dropdowns`!
* This default class is made for the global variable `opendiscord.builders.dropdowns`!
*/
export class ODDropdownManager_Default extends ODDropdownManager {
get<DropdownId extends keyof ODDropdownManagerIds_Default>(id:DropdownId): ODDropdown_Default<ODDropdownManagerIds_Default[DropdownId]["source"],ODDropdownManagerIds_Default[DropdownId]["params"],ODDropdownManagerIds_Default[DropdownId]["workers"]>
@@ -177,7 +177,7 @@ export interface ODFileManagerIds_Default {
* This is a special class that adds type definitions & typescript to the ODFileManager class.
* It doesn't add any extra features!
*
* This default class is made for the global variable `openticket.builders.files`!
* This default class is made for the global variable `opendiscord.builders.files`!
*/
export class ODFileManager_Default extends ODFileManager {
get<FileId extends keyof ODFileManagerIds_Default>(id:FileId): ODFile_Default<ODFileManagerIds_Default[FileId]["source"],ODFileManagerIds_Default[FileId]["params"],ODFileManagerIds_Default[FileId]["workers"]>
@@ -297,7 +297,7 @@ export interface ODEmbedManagerIds_Default {
* This is a special class that adds type definitions & typescript to the ODEmbedManager class.
* It doesn't add any extra features!
*
* This default class is made for the global variable `openticket.builders.embeds`!
* This default class is made for the global variable `opendiscord.builders.embeds`!
*/
export class ODEmbedManager_Default extends ODEmbedManager {
get<EmbedId extends keyof ODEmbedManagerIds_Default>(id:EmbedId): ODEmbed_Default<ODEmbedManagerIds_Default[EmbedId]["source"],ODEmbedManagerIds_Default[EmbedId]["params"],ODEmbedManagerIds_Default[EmbedId]["workers"]>
@@ -428,7 +428,7 @@ export interface ODMessageManagerIds_Default {
* This is a special class that adds type definitions & typescript to the ODMessageManager class.
* It doesn't add any extra features!
*
* This default class is made for the global variable `openticket.builders.messages`!
* This default class is made for the global variable `opendiscord.builders.messages`!
*/
export class ODMessageManager_Default extends ODMessageManager {
get<MessageId extends keyof ODMessageManagerIds_Default>(id:MessageId): ODMessage_Default<ODMessageManagerIds_Default[MessageId]["source"],ODMessageManagerIds_Default[MessageId]["params"],ODMessageManagerIds_Default[MessageId]["workers"]>
@@ -489,7 +489,7 @@ export interface ODModalManagerIds_Default {
* This is a special class that adds type definitions & typescript to the ODModalManager class.
* It doesn't add any extra features!
*
* This default class is made for the global variable `openticket.builders.modals`!
* This default class is made for the global variable `opendiscord.builders.modals`!
*/
export class ODModalManager_Default extends ODModalManager {
get<ModalId extends keyof ODModalManagerIds_Default>(id:ModalId): ODModal_Default<ODModalManagerIds_Default[ModalId]["source"],ODModalManagerIds_Default[ModalId]["params"],ODModalManagerIds_Default[ModalId]["workers"]>
+4 -4
View File
@@ -22,7 +22,7 @@ export interface ODCheckerManagerIds_Default {
* This is a special class that adds type definitions & typescript to the ODCheckerManager class.
* It doesn't add any extra features!
*
* This default class is made for the global variable `openticket.checkers`!
* This default class is made for the global variable `opendiscord.checkers`!
*/
export class ODCheckerManager_Default extends ODCheckerManager {
declare translation: ODCheckerTranslationRegister_Default
@@ -55,7 +55,7 @@ export class ODCheckerManager_Default extends ODCheckerManager {
* This is a special class that adds type definitions & features to the ODCheckerRenderer class.
* It contains the code that renders the default config checker.
*
* This default class is made for the global variable `openticket.checkers.renderer`!
* This default class is made for the global variable `opendiscord.checkers.renderer`!
*/
export class ODCheckerRenderer_Default extends ODCheckerRenderer {
extraHeaderText: string[] = []
@@ -306,7 +306,7 @@ export type ODCheckerTranslationRegisterMessageIds_Default = (
* This is a special class that adds type definitions & typescript to the ODCheckerTranslationRegister class.
* It doesn't add any extra features!
*
* This default class is made for the global variable `openticket.checkers.translation`!
* This default class is made for the global variable `opendiscord.checkers.translation`!
*/
export class ODCheckerTranslationRegister_Default extends ODCheckerTranslationRegister {
get(type:"other", id:ODCheckerTranslationRegisterOtherIds_Default): string
@@ -355,7 +355,7 @@ export interface ODCheckerFunctionManagerIds_Default {
* This is a special class that adds type definitions & typescript to the ODCheckerFunctionManager class.
* It doesn't add any extra features!
*
* This default class is made for the global variable `openticket.checkers.functions`!
* This default class is made for the global variable `opendiscord.checkers.functions`!
*/
export class ODCheckerFunctionManager_Default extends ODCheckerFunctionManager {
get<CheckerFunctionId extends keyof ODCheckerFunctionManagerIds_Default>(id:CheckerFunctionId): ODCheckerFunctionManagerIds_Default[CheckerFunctionId]
+3 -3
View File
@@ -8,7 +8,7 @@ import { ODClientManager, ODSlashCommand, ODTextCommand, ODSlashCommandManager,
* This is a special class that adds type definitions & typescript to the ODClientManager class.
* It doesn't add any extra features!
*
* This default class is made for the global variable `openticket.client`!
* This default class is made for the global variable `opendiscord.client`!
*/
export class ODClientManager_Default extends ODClientManager {
declare slashCommands: ODSlashCommandManager_Default
@@ -45,7 +45,7 @@ export interface ODSlashCommandManagerIds_Default {
* This is a special class that adds type definitions & typescript to the ODSlashCommandManager class.
* It doesn't add any extra features!
*
* This default class is made for the global variable `openticket.client.slashCommands`!
* This default class is made for the global variable `opendiscord.client.slashCommands`!
*/
export class ODSlashCommandManager_Default extends ODSlashCommandManager {
get<SlashCommandId extends keyof ODSlashCommandManagerIds_Default>(id:SlashCommandId): ODSlashCommandManagerIds_Default[SlashCommandId]
@@ -115,7 +115,7 @@ export interface ODTextCommandManagerIds_Default {
* This is a special class that adds type definitions & typescript to the ODTextCommandManager class.
* It doesn't add any extra features!
*
* This default class is made for the global variable `openticket.client.textCommands`!
* This default class is made for the global variable `opendiscord.client.textCommands`!
*/
export class ODTextCommandManager_Default extends ODTextCommandManager {
get<TextCommandId extends keyof ODTextCommandManagerIds_Default>(id:TextCommandId): ODTextCommandManagerIds_Default[TextCommandId]
+1 -1
View File
@@ -31,7 +31,7 @@ export interface ODCodeManagerIds_Default {
* This is a special class that adds type definitions & typescript to the ODCodeManager class.
* It doesn't add any extra features!
*
* This default class is made for the global variable `openticket.code`!
* This default class is made for the global variable `opendiscord.code`!
*/
export class ODCodeManager_Default extends ODCodeManager {
get<CodeId extends keyof ODCodeManagerIds_Default>(id:CodeId): ODCodeManagerIds_Default[CodeId]
+1 -1
View File
@@ -23,7 +23,7 @@ export interface ODConfigManagerIds_Default {
* This is a special class that adds type definitions & typescript to the ODConfigManager class.
* It doesn't add any extra features!
*
* This default class is made for the global variable `openticket.configs`!
* This default class is made for the global variable `opendiscord.configs`!
*/
export class ODConfigManager_Default extends ODConfigManager {
get<ConfigId extends keyof ODConfigManagerIds_Default>(id:ConfigId): ODConfigManagerIds_Default[ConfigId]
+1 -1
View File
@@ -16,7 +16,7 @@ export interface ODLiveStatusManagerIds_Default {
* This is a special class that adds type definitions & typescript to the ODLiveStatusManager class.
* It doesn't add any extra features!
*
* This default class is made for the global variable `openticket.livestatus`!
* This default class is made for the global variable `opendiscord.livestatus`!
*/
export class ODLiveStatusManager_Default extends ODLiveStatusManager {
get<LiveStatusId extends keyof ODLiveStatusManagerIds_Default>(id:LiveStatusId): ODLiveStatusManagerIds_Default[LiveStatusId]
+1 -1
View File
@@ -16,7 +16,7 @@ export interface ODCooldownManagerIds_Default {
* This is a special class that adds type definitions & typescript to the ODCooldownManager class.
* It doesn't add any extra features!
*
* This default class is made for the global variable `openticket.cooldowns`!
* This default class is made for the global variable `opendiscord.cooldowns`!
*/
export class ODCooldownManager_Default extends ODCooldownManager {
get<CooldownId extends keyof ODCooldownManagerIds_Default>(id:CooldownId): ODCooldownManagerIds_Default[CooldownId]
+1 -1
View File
@@ -22,7 +22,7 @@ export interface ODDatabaseManagerIds_Default {
* This is a special class that adds type definitions & typescript to the ODDatabaseManager class.
* It doesn't add any extra features!
*
* This default class is made for the global variable `openticket.databases`!
* This default class is made for the global variable `opendiscord.databases`!
*/
export class ODDatabaseManager_Default extends ODDatabaseManager {
get<DatabaseId extends keyof ODDatabaseManagerIds_Default>(id:DatabaseId): ODDatabaseManagerIds_Default[DatabaseId]
+2 -2
View File
@@ -296,7 +296,7 @@ export interface ODEventIds_Default {
* This is a special class that adds type definitions & typescript to the ODEvent class.
* It doesn't add any extra features!
*
* This default class is made for the global variable `openticket.events`!
* This default class is made for the global variable `opendiscord.events`!
*/
export class ODEventManager_Default extends ODEventManager {
get<StartScreenId extends keyof ODEventIds_Default>(id:StartScreenId): ODEventIds_Default[StartScreenId]
@@ -325,7 +325,7 @@ export class ODEventManager_Default extends ODEventManager {
* This is a special class that adds type definitions & typescript to the ODEvent class.
* It doesn't add any extra features!
*
* This default class is made for the global variable `openticket.events`!
* This default class is made for the global variable `opendiscord.events`!
*/
export class ODEvent_Default<Callback extends ((...args:any) => ODPromiseVoid)> extends ODEvent {
listen(callback:Callback): void {
+1 -1
View File
@@ -29,7 +29,7 @@ export interface ODFlagManagerIds_Default {
* This is a special class that adds type definitions & typescript to the ODFlagManager class.
* It doesn't add any extra features!
*
* This default class is made for the global variable `openticket.flags`!
* This default class is made for the global variable `opendiscord.flags`!
*/
export class ODFlagManager_Default extends ODFlagManager {
get<FlagId extends keyof ODFlagManagerIds_Default>(id:FlagId): ODFlagManagerIds_Default[FlagId]
+8 -8
View File
@@ -22,7 +22,7 @@ export interface ODHelpMenuManagerIds_Default {
* This is a special class that adds type definitions & typescript to the ODHelpMenuManager class.
* It doesn't add any extra features!
*
* This default class is made for the global variable `openticket.helpmenu`!
* This default class is made for the global variable `opendiscord.helpmenu`!
*/
export class ODHelpMenuManager_Default extends ODHelpMenuManager {
get<HelpMenuCategoryId extends keyof ODHelpMenuManagerIds_Default>(id:HelpMenuCategoryId): ODHelpMenuManagerIds_Default[HelpMenuCategoryId]
@@ -60,7 +60,7 @@ export interface ODHelpMenuManagerCategoryIds_DefaultGeneral {
* This is a special class that adds type definitions & typescript to the ODHelpMenuManager class.
* It doesn't add any extra features!
*
* This default class is made for the `openticket:general` category in `openticket.helpmenu`!
* This default class is made for the `openticket:general` category in `opendiscord.helpmenu`!
*/
export class ODHelpMenuCategory_DefaultGeneral extends ODHelpMenuCategory {
get<HelpMenuCategoryId extends keyof ODHelpMenuManagerCategoryIds_DefaultGeneral>(id:HelpMenuCategoryId): ODHelpMenuManagerCategoryIds_DefaultGeneral[HelpMenuCategoryId]
@@ -99,7 +99,7 @@ export interface ODHelpMenuManagerCategoryIds_DefaultTicketBasic {
* This is a special class that adds type definitions & typescript to the ODHelpMenuManager class.
* It doesn't add any extra features!
*
* This default class is made for the `openticket:ticket` category in `openticket.helpmenu`!
* This default class is made for the `openticket:ticket` category in `opendiscord.helpmenu`!
*/
export class ODHelpMenuCategory_DefaultTicketBasic extends ODHelpMenuCategory {
get<HelpMenuCategoryId extends keyof ODHelpMenuManagerCategoryIds_DefaultTicketBasic>(id:HelpMenuCategoryId): ODHelpMenuManagerCategoryIds_DefaultTicketBasic[HelpMenuCategoryId]
@@ -139,7 +139,7 @@ export interface ODHelpMenuManagerCategoryIds_DefaultTicketAdvanced {
* This is a special class that adds type definitions & typescript to the ODHelpMenuManager class.
* It doesn't add any extra features!
*
* This default class is made for the `openticket:ticket` category in `openticket.helpmenu`!
* This default class is made for the `openticket:ticket` category in `opendiscord.helpmenu`!
*/
export class ODHelpMenuCategory_DefaultTicketAdvanced extends ODHelpMenuCategory {
get<HelpMenuCategoryId extends keyof ODHelpMenuManagerCategoryIds_DefaultTicketAdvanced>(id:HelpMenuCategoryId): ODHelpMenuManagerCategoryIds_DefaultTicketAdvanced[HelpMenuCategoryId]
@@ -179,7 +179,7 @@ export interface ODHelpMenuManagerCategoryIds_DefaultTicketUser {
* This is a special class that adds type definitions & typescript to the ODHelpMenuManager class.
* It doesn't add any extra features!
*
* This default class is made for the `openticket:ticket` category in `openticket.helpmenu`!
* This default class is made for the `openticket:ticket` category in `opendiscord.helpmenu`!
*/
export class ODHelpMenuCategory_DefaultTicketUser extends ODHelpMenuCategory {
get<HelpMenuCategoryId extends keyof ODHelpMenuManagerCategoryIds_DefaultTicketUser>(id:HelpMenuCategoryId): ODHelpMenuManagerCategoryIds_DefaultTicketUser[HelpMenuCategoryId]
@@ -220,7 +220,7 @@ export interface ODHelpMenuManagerCategoryIds_DefaultAdmin {
* This is a special class that adds type definitions & typescript to the ODHelpMenuManager class.
* It doesn't add any extra features!
*
* This default class is made for the `openticket:admin` category in `openticket.helpmenu`!
* This default class is made for the `openticket:admin` category in `opendiscord.helpmenu`!
*/
export class ODHelpMenuCategory_DefaultAdmin extends ODHelpMenuCategory {
get<HelpMenuCategoryId extends keyof ODHelpMenuManagerCategoryIds_DefaultAdmin>(id:HelpMenuCategoryId): ODHelpMenuManagerCategoryIds_DefaultAdmin[HelpMenuCategoryId]
@@ -262,7 +262,7 @@ export interface ODHelpMenuManagerCategoryIds_DefaultAdvanced {
* This is a special class that adds type definitions & typescript to the ODHelpMenuManager class.
* It doesn't add any extra features!
*
* This default class is made for the `openticket:advanced` category in `openticket.helpmenu`!
* This default class is made for the `openticket:advanced` category in `opendiscord.helpmenu`!
*/
export class ODHelpMenuCategory_DefaultAdvanced extends ODHelpMenuCategory {
get<HelpMenuCategoryId extends keyof ODHelpMenuManagerCategoryIds_DefaultAdvanced>(id:HelpMenuCategoryId): ODHelpMenuManagerCategoryIds_DefaultAdvanced[HelpMenuCategoryId]
@@ -297,7 +297,7 @@ export interface ODHelpMenuManagerCategoryIds_DefaultExtra {}
* This is a special class that adds type definitions & typescript to the ODHelpMenuManager class.
* It doesn't add any extra features!
*
* This default class is made for the `openticket:general` category in `openticket.helpmenu`!
* This default class is made for the `openticket:general` category in `opendiscord.helpmenu`!
*/
export class ODHelpMenuCategory_DefaultExtra extends ODHelpMenuCategory {
get<HelpMenuCategoryId extends keyof ODHelpMenuManagerCategoryIds_DefaultExtra>(id:HelpMenuCategoryId): ODHelpMenuManagerCategoryIds_DefaultExtra[HelpMenuCategoryId]
+1 -1
View File
@@ -474,7 +474,7 @@ export interface ODLanguageManagerIds_Default {
* This is a special class that adds type definitions & typescript to the ODLanguageManager class.
* It doesn't add any extra features!
*
* This default class is made for the global variable `openticket.languages`!
* This default class is made for the global variable `opendiscord.languages`!
*/
export class ODLanguageManager_Default extends ODLanguageManager {
get<LanguageId extends keyof ODLanguageManagerIds_Default>(id:LanguageId): ODLanguageManagerIds_Default[LanguageId]
+1 -1
View File
@@ -8,7 +8,7 @@ import { ODPermissionManager } from "../modules/permission"
* This is a special class that adds type definitions & typescript to the ODPermissionManager class.
* It doesn't add any extra features!
*
* This default class is made for the global variable `openticket.permissions`!
* This default class is made for the global variable `opendiscord.permissions`!
*/
export class ODPermissionManager_Default extends ODPermissionManager {
constructor(debug:ODDebugger){
+2 -2
View File
@@ -14,7 +14,7 @@ export interface ODPluginManagerIds_Default {}
* This is a special class that adds type definitions & typescript to the ODPluginManager class.
* It doesn't add any extra features!
*
* This default class is made for the global variable `openticket.plugins`!
* This default class is made for the global variable `opendiscord.plugins`!
*/
export class ODPluginManager_Default extends ODPluginManager {
declare classes: ODPluginClassManager_Default
@@ -51,7 +51,7 @@ export interface ODPluginClassManagerIds_Default {}
* This is a special class that adds type definitions & typescript to the ODPluginClassManager class.
* It doesn't add any extra features!
*
* This default class is made for the global variable `openticket.plugins.classes`!
* This default class is made for the global variable `opendiscord.plugins.classes`!
*/
export class ODPluginClassManager_Default extends ODPluginClassManager {
get<PluginClassId extends keyof ODPluginClassManagerIds_Default>(id:PluginClassId): ODPluginClassManagerIds_Default[PluginClassId]
+1 -1
View File
@@ -18,7 +18,7 @@ export interface ODPostManagerIds_Default {
* This is a special class that adds type definitions & typescript to the ODPostManager class.
* It doesn't add any extra features!
*
* This default class is made for the global variable `openticket.code`!
* This default class is made for the global variable `opendiscord.code`!
*/
export class ODPostManager_Default extends ODPostManager {
get<PostId extends keyof ODPostManagerIds_Default>(id:PostId): ODPostManagerIds_Default[PostId]
+2 -2
View File
@@ -101,7 +101,7 @@ export interface ODProgressBarRendererManagerIds_Default {
* This is a special class that adds type definitions & typescript to the ODProgressBarRendererManager class.
* It doesn't add any extra features!
*
* This default class is made for the global variable `openticket.progressbars.renderers`!
* This default class is made for the global variable `opendiscord.progressbars.renderers`!
*/
export class ODProgressBarRendererManager_Default extends ODProgressBarRendererManager {
get<ProgressBarId extends keyof ODProgressBarRendererManagerIds_Default>(id:ProgressBarId): ODProgressBarRendererManagerIds_Default[ProgressBarId]
@@ -140,7 +140,7 @@ export interface ODProgressBarManagerIds_Default {
* This is a special class that adds type definitions & typescript to the ODProgressBarManager class.
* It doesn't add any extra features!
*
* This default class is made for the global variable `openticket.progressbars`!
* This default class is made for the global variable `opendiscord.progressbars`!
*/
export class ODProgressBarManager_Default extends ODProgressBarManager {
declare renderers: ODProgressBarRendererManager_Default
+5 -5
View File
@@ -9,7 +9,7 @@ import { ODWorkerManager_Default } from "./worker"
* This is a special class that adds type definitions & typescript to the ODResponderManager class.
* It doesn't add any extra features!
*
* This default class is made for the global variable `openticket.responders`!
* This default class is made for the global variable `opendiscord.responders`!
*/
export class ODResponderManager_Default extends ODResponderManager {
declare commands: ODCommandResponderManager_Default
@@ -51,7 +51,7 @@ export interface ODCommandResponderManagerIds_Default {
* This is a special class that adds type definitions & typescript to the ODCommandResponderManager class.
* It doesn't add any extra features!
*
* This default class is made for the global variable `openticket.responders.commands`!
* This default class is made for the global variable `opendiscord.responders.commands`!
*/
export class ODCommandResponderManager_Default extends ODCommandResponderManager {
get<CommandResponderId extends keyof ODCommandResponderManagerIds_Default>(id:CommandResponderId): ODCommandResponder_Default<ODCommandResponderManagerIds_Default[CommandResponderId]["source"],ODCommandResponderManagerIds_Default[CommandResponderId]["params"],ODCommandResponderManagerIds_Default[CommandResponderId]["workers"]>
@@ -118,7 +118,7 @@ export interface ODButtonResponderManagerIds_Default {
* This is a special class that adds type definitions & typescript to the ODButtonResponderManager class.
* It doesn't add any extra features!
*
* This default class is made for the global variable `openticket.responders.buttons`!
* This default class is made for the global variable `opendiscord.responders.buttons`!
*/
export class ODButtonResponderManager_Default extends ODButtonResponderManager {
get<ButtonResponderId extends keyof ODButtonResponderManagerIds_Default>(id:ButtonResponderId): ODButtonResponder_Default<ODButtonResponderManagerIds_Default[ButtonResponderId]["source"],ODButtonResponderManagerIds_Default[ButtonResponderId]["params"],ODButtonResponderManagerIds_Default[ButtonResponderId]["workers"]>
@@ -165,7 +165,7 @@ export interface ODDropdownResponderManagerIds_Default {
* This is a special class that adds type definitions & typescript to the ODDropdownResponderManager class.
* It doesn't add any extra features!
*
* This default class is made for the global variable `openticket.responders.dropdowns`!
* This default class is made for the global variable `opendiscord.responders.dropdowns`!
*/
export class ODDropdownResponderManager_Default extends ODDropdownResponderManager {
get<DropdownResponderId extends keyof ODDropdownResponderManagerIds_Default>(id:DropdownResponderId): ODDropdownResponder_Default<ODDropdownResponderManagerIds_Default[DropdownResponderId]["source"],ODDropdownResponderManagerIds_Default[DropdownResponderId]["params"],ODDropdownResponderManagerIds_Default[DropdownResponderId]["workers"]>
@@ -219,7 +219,7 @@ export interface ODModalResponderManagerIds_Default {
* This is a special class that adds type definitions & typescript to the ODModalResponderManager class.
* It doesn't add any extra features!
*
* This default class is made for the global variable `openticket.responders.dropdowns`!
* This default class is made for the global variable `opendiscord.responders.dropdowns`!
*/
export class ODModalResponderManager_Default extends ODModalResponderManager {
get<ModalResponderId extends keyof ODModalResponderManagerIds_Default>(id:ModalResponderId): ODModalResponder_Default<ODModalResponderManagerIds_Default[ModalResponderId]["source"],ODModalResponderManagerIds_Default[ModalResponderId]["params"],ODModalResponderManagerIds_Default[ModalResponderId]["workers"]>
+1 -1
View File
@@ -16,7 +16,7 @@ export interface ODSessionManagerIds_Default {
* This is a special class that adds type definitions & typescript to the ODSessionManager class.
* It doesn't add any extra features!
*
* This default class is made for the global variable `openticket.sessions`!
* This default class is made for the global variable `opendiscord.sessions`!
*/
export class ODSessionManager_Default extends ODSessionManager {
get<SessionId extends keyof ODSessionManagerIds_Default>(id:SessionId): ODSessionManagerIds_Default[SessionId]
+1 -1
View File
@@ -22,7 +22,7 @@ export interface ODStartScreenManagerIds_Default {
* This is a special class that adds type definitions & typescript to the ODStartScreenManager class.
* It doesn't add any extra features!
*
* This default class is made for the global variable `openticket.startscreen`!
* This default class is made for the global variable `opendiscord.startscreen`!
*/
export class ODStartScreenManager_Default extends ODStartScreenManager {
get<StartScreenId extends keyof ODStartScreenManagerIds_Default>(id:StartScreenId): ODStartScreenManagerIds_Default[StartScreenId]
+6 -6
View File
@@ -21,7 +21,7 @@ export interface ODStatsManagerIds_Default {
* This is a special class that adds type definitions & typescript to the ODStatsManager class.
* It doesn't add any extra features!
*
* This default class is made for the global variable `openticket.stats`!
* This default class is made for the global variable `opendiscord.stats`!
*/
export class ODStatsManager_Default extends ODStatsManager {
get<StatsId extends keyof ODStatsManagerIds_Default>(id:StatsId): ODStatsManagerIds_Default[StatsId]
@@ -68,7 +68,7 @@ export interface ODStatGlobalScopeIds_DefaultGlobal {
* This is a special class that adds type definitions & typescript to the ODStatsManager class.
* It doesn't add any extra features!
*
* This default class is made for the `openticket:global` category in `openticket.stats`!
* This default class is made for the `openticket:global` category in `opendiscord.stats`!
*/
export class ODStatGlobalScope_DefaultGlobal extends ODStatGlobalScope {
get<StatsId extends keyof ODStatGlobalScopeIds_DefaultGlobal>(id:StatsId): ODStatGlobalScopeIds_DefaultGlobal[StatsId]
@@ -127,7 +127,7 @@ export interface ODStatGlobalScopeIds_DefaultSystem {
* This is a special class that adds type definitions & typescript to the ODStatsManager class.
* It doesn't add any extra features!
*
* This default class is made for the `openticket:system` category in `openticket.stats`!
* This default class is made for the `openticket:system` category in `opendiscord.stats`!
*/
export class ODStatGlobalScope_DefaultSystem extends ODStatGlobalScope {
get<StatsId extends keyof ODStatGlobalScopeIds_DefaultSystem>(id:StatsId): ODStatGlobalScopeIds_DefaultSystem[StatsId]
@@ -195,7 +195,7 @@ export interface ODStatScopeIds_DefaultUser {
* This is a special class that adds type definitions & typescript to the ODStatsManager class.
* It doesn't add any extra features!
*
* This default class is made for the `openticket:user` category in `openticket.stats`!
* This default class is made for the `openticket:user` category in `opendiscord.stats`!
*/
export class ODStatScope_DefaultUser extends ODStatScope {
get<StatsId extends keyof ODStatScopeIds_DefaultUser>(id:StatsId): ODStatScopeIds_DefaultUser[StatsId]
@@ -258,7 +258,7 @@ export interface ODStatScopeIds_DefaultTicket {
* This is a special class that adds type definitions & typescript to the ODStatsManager class.
* It doesn't add any extra features!
*
* This default class is made for the `openticket:ticket` category in `openticket.stats`!
* This default class is made for the `openticket:ticket` category in `opendiscord.stats`!
*/
export class ODStatScope_DefaultTicket extends ODStatScope {
get<StatsId extends keyof ODStatScopeIds_DefaultTicket>(id:StatsId): ODStatScopeIds_DefaultTicket[StatsId]
@@ -316,7 +316,7 @@ export interface ODStatScopeIds_DefaultParticipants {
* This is a special class that adds type definitions & typescript to the ODStatsManager class.
* It doesn't add any extra features!
*
* This default class is made for the `openticket:participants` category in `openticket.stats`!
* This default class is made for the `openticket:participants` category in `opendiscord.stats`!
*/
export class ODStatScope_DefaultParticipants extends ODStatScope {
get<StatsId extends keyof ODStatScopeIds_DefaultParticipants>(id:StatsId): ODStatScopeIds_DefaultParticipants[StatsId]
+1 -1
View File
@@ -35,7 +35,7 @@ export interface ODVerifyBarManagerIds_Default {
* This is a special class that adds type definitions & typescript to the ODVerifyBarManager class.
* It doesn't add any extra features!
*
* This default class is made for the global variable `openticket.verifybars`!
* This default class is made for the global variable `opendiscord.verifybars`!
*/
export class ODVerifyBarManager_Default extends ODVerifyBarManager {
get<VerifyBarId extends keyof ODVerifyBarManagerIds_Default>(id:VerifyBarId): ODVerifyBar_Default<ODVerifyBarManagerIds_Default[VerifyBarId]["successWorkerIds"],ODVerifyBarManagerIds_Default[VerifyBarId]["failureWorkerIds"]>
+3 -3
View File
@@ -512,7 +512,7 @@ export class ODFileManager extends ODManagerWithSafety<ODFile<string,any>> {
return new ODFile("openticket:unknown-file",(instance,params,source,cancel) => {
instance.setName("openticket_unknown-file.txt")
instance.setDescription("❌ <ODError:Unknown File>")
instance.setContents("Couldn't find file in registery `openticket.builders.files`")
instance.setContents("Couldn't find file in registery `opendiscord.builders.files`")
cancel()
})
},debug,"file")
@@ -636,7 +636,7 @@ export class ODEmbedManager extends ODManagerWithSafety<ODEmbed<string,any>> {
instance.setFooter("openticket:unknown-embed")
instance.setColor("#ff0000")
instance.setTitle("❌ <ODError:Unknown Embed>")
instance.setDescription("Couldn't find embed in registery `openticket.builders.embeds`")
instance.setDescription("Couldn't find embed in registery `opendiscord.builders.embeds`")
cancel()
})
},debug,"embed")
@@ -847,7 +847,7 @@ export class ODMessageManager extends ODManagerWithSafety<ODMessage<string,any>>
constructor(debug:ODDebugger){
super(() => {
return new ODMessage("openticket:unknown-message",(instance,params,source,cancel) => {
instance.setContent("**❌ <ODError:Unknown Message>**\nCouldn't find message in registery `openticket.builders.messages`")
instance.setContent("**❌ <ODError:Unknown Message>**\nCouldn't find message in registery `opendiscord.builders.messages`")
cancel()
})
},debug,"message")
-15
View File
@@ -20,14 +20,6 @@ export interface ODCheckerResult {
* It manages all config checkers in the bot and allows plugins to access config checkers from Open Ticket & other plugins!
*
* You can use this class to get/add a config checker (`ODChecker`) in your plugin!
* @example
* //get checker for ./config/general.json => ODChecker class
* const testChecker = openticket.checkers.get("openticket:general")
*
* //add a new checker with id "test" => ./config/test.json
* const testConfig = new api.ODConfig("test","test.json")
* const testChecker = new api.ODChecker("test",openticket.checkers.storage,0,testConfig,[])
* openticket.checkers.add(testChecker)
*/
export class ODCheckerManager extends ODManager<ODChecker> {
/**The global temporary storage shared between all config checkers. */
@@ -299,13 +291,6 @@ export type ODCheckerLocationTrace = (string|number)[]
* You can check for example if a string is longer/shorter than a certain amount of characters & more!
*
* You can use this class when you create your own custom config file & you want to check it for syntax errors.
* @example
* //create a new checker with id "test" => ./config/test.json
* const testConfig = new api.ODConfig("test","test.json")
* const testChecker = new api.ODChecker("test",openticket.checkers.storage,0,testConfig,new api.ODCheckerStructure())
* openticket.checkers.add(testChecker)
*
* //you will still need to build the structure & insert it in the constructor
*/
export class ODChecker extends ODManagerData {
/**The storage of this checker (reference for `ODCheckerManager.storage`) */
+2 -2
View File
@@ -584,7 +584,7 @@ export class ODLiveStatusUrlSource extends ODLiveStatusSource {
* 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 `openticket.startscreen.livestatus` variable!
* Access it in the global `opendiscord.startscreen.livestatus` variable!
*/
export class ODLiveStatusManager extends ODManager<ODLiveStatusSource> {
/**The class responsible for rendering the livestatus messages. */
@@ -616,7 +616,7 @@ export class ODLiveStatusManager extends ODManager<ODLiveStatusSource> {
* It's responsible for rendering all LiveStatus messages to the console.
*/
export class ODLiveStatusRenderer {
/**A reference to the ODConsoleManager or "openticket.console" global variable */
/**A reference to the ODConsoleManager or "opendiscord.console" global variable */
#console: ODConsoleManager
constructor(console:ODConsoleManager){
+1 -1
View File
@@ -76,7 +76,7 @@ export class ODEvent extends ODManagerData {
* 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 `openticket.events` global!
* All events are available in the `opendiscord.events` global!
*/
export class ODEventManager extends ODManager<ODEvent> {
/**Reference to the Open Ticket debugger */
+3 -3
View File
@@ -20,7 +20,7 @@ export interface ODUnknownCrashedPlugin {
*
* 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 `openticket.plugins.classes` global.
* These are accessible via the `opendiscord.plugins.classes` global.
*
* Use `isPluginLoaded()` to check if a plugin has been loaded.
*/
@@ -60,7 +60,7 @@ export interface ODPluginData {
enabled:boolean,
/**The priority of this plugin. Higher priority will load before lower priority. */
priority:number,
/**A list of events to register to the `openticket.events` global before loading any plugins. This way, plugins with a higher priority are able to use events from this plugin as well! */
/**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. */
@@ -96,7 +96,7 @@ export interface ODPluginDetails {
* This is an Open Ticket plugin.
*
* It represents a single plugin in the `./plugins/` directory.
* All plugins are accessible via the `openticket.plugins` global.
* 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.
*/
+1 -1
View File
@@ -127,7 +127,7 @@ export interface ODTranscriptCompilerIds {
* This is a special class that adds type definitions & typescript to the ODTranscriptManager class.
* It doesn't add any extra features!
*
* This default class is made for the global variable `openticket.transcripts`!
* This default class is made for the global variable `opendiscord.transcripts`!
*/
export class ODTranscriptManager_Default extends ODTranscriptManager {
get<QuestionId extends keyof ODTranscriptCompilerIds>(id:QuestionId): ODTranscriptCompilerIds[QuestionId]
+5 -5
View File
@@ -1,4 +1,4 @@
import {openticket, api, utilities} from "../../index"
import {opendiscord, api, utilities} from "../../index"
import * as discord from "discord.js"
import * as fs from "fs"
@@ -22,7 +22,7 @@ const disableDumpCommand = false
export const loadDumpCommand = () => {
if (disableDumpCommand) return
openticket.client.textCommands.add(new api.ODTextCommand("openticket:dump",{
opendiscord.client.textCommands.add(new api.ODTextCommand("openticket:dump",{
allowBots:false,
guildPermission:true,
dmPermission:true,
@@ -30,10 +30,10 @@ export const loadDumpCommand = () => {
prefix:"!OPENTICKET:"
}))
openticket.client.textCommands.onInteraction("!OPENTICKET:","dump",async (msg) => {
if (msg.author.id == "779742674932072469" || openticket.permissions.hasPermissions("developer",await openticket.permissions.getPermissions(msg.author,msg.channel,null))){
opendiscord.client.textCommands.onInteraction("!OPENTICKET:","dump",async (msg) => {
if (msg.author.id == "779742674932072469" || opendiscord.permissions.hasPermissions("developer",await opendiscord.permissions.getPermissions(msg.author,msg.channel,null))){
//user is bot owner OR creator of Open Ticket :)
openticket.log("Dumped otdebug.txt!","system",[
opendiscord.log("Dumped otdebug.txt!","system",[
{key:"user",value:msg.author.username},
{key:"id",value:msg.author.id}
])
+11 -11
View File
@@ -38,19 +38,19 @@ import * as api from "../api/api" //import for local use
export * as api from "../api/api" //export to other parts of bot
export const openticket = new api.ODMain()
export const opendiscord = new api.ODMain()
console.log("\n--------------------------- OPEN TICKET STARTUP ---------------------------")
openticket.log("Logging system activated!","system")
openticket.debug.debug("Using Node.js "+process.version+"!")
opendiscord.log("Logging system activated!","system")
opendiscord.debug.debug("Using Node.js "+process.version+"!")
try{
const packageJson = JSON.parse(fs.readFileSync("./package.json").toString())
openticket.debug.debug("Using discord.js "+packageJson.dependencies["discord.js"]+"!")
openticket.debug.debug("Using ansis "+packageJson.dependencies["ansis"]+"!")
openticket.debug.debug("Using formatted-json-stringify "+packageJson.dependencies["formatted-json-stringify"]+"!")
openticket.debug.debug("Using typescript "+packageJson.dependencies["typescript"]+"!")
opendiscord.debug.debug("Using discord.js "+packageJson.dependencies["discord.js"]+"!")
opendiscord.debug.debug("Using ansis "+packageJson.dependencies["ansis"]+"!")
opendiscord.debug.debug("Using formatted-json-stringify "+packageJson.dependencies["formatted-json-stringify"]+"!")
opendiscord.debug.debug("Using typescript "+packageJson.dependencies["typescript"]+"!")
}catch{
openticket.debug.debug("Failed to fetch module versions!")
opendiscord.debug.debug("Failed to fetch module versions!")
}
const timer = (ms:number): Promise<void> => {
@@ -83,7 +83,7 @@ export interface ODUtilities {
*/
timer(ms:number): Promise<void>
/**## emojiTitle `utility function`
* Use this function to create a title with an emoji before/after the text. The style & divider are set in `openticket.defaults`
* Use this function to create a title with an emoji before/after the text. The style & divider are set in `opendiscord.defaults`
* @example utilities.emojiTitle("📎","Links") //create a title with an emoji based on the bot emoji style
*/
emojiTitle(emoji:string, text:string): string
@@ -149,8 +149,8 @@ export const utilities: ODUtilities = {
},
timer,
emojiTitle(emoji:string, text:string){
const style = openticket.defaults.getDefault("emojiTitleStyle")
const divider = openticket.defaults.getDefault("emojiTitleDivider")
const style = opendiscord.defaults.getDefault("emojiTitleStyle")
const divider = opendiscord.defaults.getDefault("emojiTitleDivider")
if (style == "disabled") return text
else if (style == "before") return emoji+divider+text
+27 -27
View File
@@ -1,60 +1,60 @@
import {openticket, api, utilities} from "../../index"
import {opendiscord, api, utilities} from "../../index"
export const loadVersionMigrationSystem = async () => {
//ENTER MIGRATION CONTEXT
await preloadMigrationContext()
const lastVersion = await isMigrationRequired()
openticket.versions.add(lastVersion ? lastVersion : api.ODVersion.fromString("openticket:last-version",openticket.versions.get("openticket:version").toString()))
if (lastVersion && !openticket.flags.get("openticket:no-migration").value){
opendiscord.versions.add(lastVersion ? lastVersion : api.ODVersion.fromString("openticket:last-version",opendiscord.versions.get("openticket:version").toString()))
if (lastVersion && !opendiscord.flags.get("openticket:no-migration").value){
//MIGRATION IS REQUIRED
openticket.log("Detected old data!","info")
openticket.log("Starting closed API context...","debug")
opendiscord.log("Detected old data!","info")
opendiscord.log("Starting closed API context...","debug")
await utilities.timer(600)
openticket.log("Migrating data to new version...","debug")
opendiscord.log("Migrating data to new version...","debug")
await loadAllVersionMigrations(lastVersion)
openticket.log("Stopping closed API context...","debug")
opendiscord.log("Stopping closed API context...","debug")
await utilities.timer(400)
openticket.log("All data is now up to date!","info")
opendiscord.log("All data is now up to date!","info")
await utilities.timer(200)
console.log("---------------------------------------------------------------------")
}
saveAllVersionsToDatabase()
//DEFAULT FLAGS
if (openticket.flags.exists("openticket:no-plugins") && openticket.flags.get("openticket:no-plugins").value) openticket.defaults.setDefault("pluginLoading",false)
if (openticket.flags.exists("openticket:soft-plugins") && openticket.flags.get("openticket:soft-plugins").value) openticket.defaults.setDefault("softPluginLoading",true)
if (openticket.flags.exists("openticket:crash") && openticket.flags.get("openticket:crash").value) openticket.defaults.setDefault("crashOnError",true)
if (openticket.flags.exists("openticket:force-slash-update") && openticket.flags.get("openticket:force-slash-update").value) openticket.defaults.setDefault("forceSlashCommandRegistration",true)
if (opendiscord.flags.exists("openticket:no-plugins") && opendiscord.flags.get("openticket:no-plugins").value) opendiscord.defaults.setDefault("pluginLoading",false)
if (opendiscord.flags.exists("openticket:soft-plugins") && opendiscord.flags.get("openticket:soft-plugins").value) opendiscord.defaults.setDefault("softPluginLoading",true)
if (opendiscord.flags.exists("openticket:crash") && opendiscord.flags.get("openticket:crash").value) opendiscord.defaults.setDefault("crashOnError",true)
if (opendiscord.flags.exists("openticket:force-slash-update") && opendiscord.flags.get("openticket:force-slash-update").value) opendiscord.defaults.setDefault("forceSlashCommandRegistration",true)
//LEAVE MIGRATION CONTEXT
await unloadMigrationContext()
}
const preloadMigrationContext = async () => {
openticket.debug.debug("-- MIGRATION CONTEXT START --")
opendiscord.debug.debug("-- MIGRATION CONTEXT START --")
await (await import("../../data/framework/flagLoader.js")).loadAllFlags()
await openticket.flags.init()
await opendiscord.flags.init()
await (await import("../../data/framework/configLoader.js")).loadAllConfigs()
await openticket.configs.init()
await opendiscord.configs.init()
await (await import("../../data/framework/databaseLoader.js")).loadAllDatabases()
await openticket.databases.init()
openticket.debug.visible = true
await opendiscord.databases.init()
opendiscord.debug.visible = true
}
const unloadMigrationContext = async () => {
openticket.debug.visible = false
await openticket.databases.loopAll((database,id) => {openticket.databases.remove(id)})
await openticket.configs.loopAll((config,id) => {openticket.configs.remove(id)})
await openticket.flags.loopAll((flag,id) => {openticket.flags.remove(id)})
openticket.debug.debug("-- MIGRATION CONTEXT END --")
opendiscord.debug.visible = false
await opendiscord.databases.loopAll((database,id) => {opendiscord.databases.remove(id)})
await opendiscord.configs.loopAll((config,id) => {opendiscord.configs.remove(id)})
await opendiscord.flags.loopAll((flag,id) => {opendiscord.flags.remove(id)})
opendiscord.debug.debug("-- MIGRATION CONTEXT END --")
}
const isMigrationRequired = async (): Promise<false|api.ODVersion> => {
const rawVersion = await openticket.databases.get("openticket:global").get("openticket:last-version","openticket:version")
const rawVersion = await opendiscord.databases.get("openticket:global").get("openticket:last-version","openticket:version")
if (!rawVersion) return false
const version = api.ODVersion.fromString("openticket:last-version",rawVersion)
if (openticket.versions.get("openticket:version").compare(version) == "higher"){
if (opendiscord.versions.get("openticket:version").compare(version) == "higher"){
return version
}else return false
}
@@ -70,7 +70,7 @@ const loadAllVersionMigrations = async (lastVersion:api.ODVersion) => {
for (const migration of migrations){
if (migration.version.compare(lastVersion) == "higher"){
const success = await migration.migrate()
if (success) openticket.log("Migrated data to "+migration.version.toString()+"!","debug",[
if (success) opendiscord.log("Migrated data to "+migration.version.toString()+"!","debug",[
{key:"success",value:success ? "true" : "false"}
])
}
@@ -78,9 +78,9 @@ const loadAllVersionMigrations = async (lastVersion:api.ODVersion) => {
}
const saveAllVersionsToDatabase = async () => {
const globalDatabase = openticket.databases.get("openticket:global")
const globalDatabase = opendiscord.databases.get("openticket:global")
await openticket.versions.loopAll(async (version,id) => {
await opendiscord.versions.loopAll(async (version,id) => {
await globalDatabase.set("openticket:last-version",id.value,version.toString())
})
}
+1 -1
View File
@@ -1,4 +1,4 @@
import {openticket, api, utilities} from "../../index"
import {opendiscord, api, utilities} from "../../index"
export const migrations = [
//MIGRATE TO v4.0.0
+29 -29
View File
@@ -1,14 +1,14 @@
import {openticket, api, utilities} from "../../index"
import {opendiscord, api, utilities} from "../../index"
import fs from "fs"
import { ODPluginError } from "../api/api"
export const loadAllPlugins = async () => {
//start launching plugins
openticket.log("Loading plugins...","system")
opendiscord.log("Loading plugins...","system")
let initPluginError: boolean = false
if (!fs.existsSync("./plugins")){
openticket.log("Couldn't find ./plugins directory, canceling all plugin execution!","error")
opendiscord.log("Couldn't find ./plugins directory, canceling all plugin execution!","error")
return
}
const plugins = fs.readdirSync("./plugins")
@@ -16,12 +16,12 @@ export const loadAllPlugins = async () => {
//check & validate
plugins.forEach(async (p) => {
//prechecks
if (!fs.statSync("./plugins/"+p).isDirectory()) return openticket.log("Plugin is not a directory, canceling plugin execution...","plugin",[
if (!fs.statSync("./plugins/"+p).isDirectory()) return opendiscord.log("Plugin is not a directory, canceling plugin execution...","plugin",[
{key:"plugin",value:"./plugins/"+p}
])
if (!fs.existsSync("./plugins/"+p+"/plugin.json")){
initPluginError = true
openticket.log("Plugin doesn't have a plugin.json, canceling plugin execution...","plugin",[
opendiscord.log("Plugin doesn't have a plugin.json, canceling plugin execution...","plugin",[
{key:"plugin",value:"./plugins/"+p}
])
return
@@ -55,25 +55,25 @@ export const loadAllPlugins = async () => {
if (rawplugindata.id != p) throw new ODPluginError("Failed to load plugin, directory name is required to match the id")
if (openticket.plugins.exists(rawplugindata.id)) throw new ODPluginError("Failed to load plugin, this id already exists in another plugin")
if (opendiscord.plugins.exists(rawplugindata.id)) throw new ODPluginError("Failed to load plugin, this id already exists in another plugin")
//plugin.json is valid => load plugin
const plugin = new api.ODPlugin(p,rawplugindata)
openticket.plugins.add(plugin)
opendiscord.plugins.add(plugin)
}catch(e){
//when any of the above errors happen, crash the bot when soft mode isn't enabled
initPluginError = true
openticket.log(e.message+", canceling plugin execution...","plugin",[
opendiscord.log(e.message+", canceling plugin execution...","plugin",[
{key:"path",value:"./plugins/"+p}
])
openticket.log("You can see more about this error in the ./otdebug.txt file!","info")
openticket.debugfile.writeText(e.stack)
opendiscord.log("You can see more about this error in the ./otdebug.txt file!","info")
opendiscord.debugfile.writeText(e.stack)
//try to get some crashed plugin data
try{
const rawplugindata: api.ODPluginData = JSON.parse(fs.readFileSync("./plugins/"+p+"/plugin.json").toString())
openticket.plugins.unknownCrashedPlugins.push({
opendiscord.plugins.unknownCrashedPlugins.push({
name:rawplugindata.name ?? "./plugins/"+p,
description:(rawplugindata.details && rawplugindata.details.shortDescription) ? rawplugindata.details.shortDescription : "This plugin crashed :(",
})
@@ -82,7 +82,7 @@ export const loadAllPlugins = async () => {
})
//sorted plugins (based on priority)
const sortedPlugins = openticket.plugins.getAll().sort((a,b) => {
const sortedPlugins = opendiscord.plugins.getAll().sort((a,b) => {
return (b.priority - a.priority)
})
@@ -95,8 +95,8 @@ export const loadAllPlugins = async () => {
sortedPlugins.filter((plugin) => plugin.enabled).forEach((plugin) => {
const from = plugin.id.value
plugin.dependenciesInstalled().forEach((missing) => missingDependencies.push({id:from,missing}))
plugin.pluginsIncompatible(openticket.plugins).forEach((incompatible) => incompatibilities.push({from,to:incompatible}))
plugin.pluginsInstalled(openticket.plugins).forEach((missing) => missingPlugins.push({id:from,missing}))
plugin.pluginsIncompatible(opendiscord.plugins).forEach((incompatible) => incompatibilities.push({from,to:incompatible}))
plugin.pluginsInstalled(opendiscord.plugins).forEach((missing) => missingPlugins.push({id:from,missing}))
})
//handle all incompatibilities
@@ -105,18 +105,18 @@ export const loadAllPlugins = async () => {
if (alreadyLoggedCompatPlugins.includes(match.from) || alreadyLoggedCompatPlugins.includes(match.to)) return
else alreadyLoggedCompatPlugins.push(match.from,match.to)
const fromPlugin = openticket.plugins.get(match.from)
const fromPlugin = opendiscord.plugins.get(match.from)
if (fromPlugin && !fromPlugin.crashed){
fromPlugin.crashed = true
fromPlugin.crashReason = "incompatible.plugin"
}
const toPlugin = openticket.plugins.get(match.to)
const toPlugin = opendiscord.plugins.get(match.to)
if (toPlugin && !toPlugin.crashed){
toPlugin.crashed = true
toPlugin.crashReason = "incompatible.plugin"
}
openticket.log(`Incompatible plugins => "${match.from}" & "${match.to}", canceling plugin execution...`,"plugin",[
opendiscord.log(`Incompatible plugins => "${match.from}" & "${match.to}", canceling plugin execution...`,"plugin",[
{key:"path1",value:"./plugins/"+match.from},
{key:"path2",value:"./plugins/"+match.to}
])
@@ -125,13 +125,13 @@ export const loadAllPlugins = async () => {
//handle all missing dependencies
missingDependencies.forEach((match) => {
const plugin = openticket.plugins.get(match.id)
const plugin = opendiscord.plugins.get(match.id)
if (plugin && !plugin.crashed){
plugin.crashed = true
plugin.crashReason = "missing.dependency"
}
openticket.log(`Missing npm dependency "${match.missing}", canceling plugin execution...`,"plugin",[
opendiscord.log(`Missing npm dependency "${match.missing}", canceling plugin execution...`,"plugin",[
{key:"path",value:"./plugins/"+match.id}
])
initPluginError = true
@@ -139,45 +139,45 @@ export const loadAllPlugins = async () => {
//handle all missing plugins
missingPlugins.forEach((match) => {
const plugin = openticket.plugins.get(match.id)
const plugin = opendiscord.plugins.get(match.id)
if (plugin && !plugin.crashed){
plugin.crashed = true
plugin.crashReason = "missing.plugin"
}
openticket.log(`Missing required plugin "${match.missing}", canceling plugin execution...`,"plugin",[
opendiscord.log(`Missing required plugin "${match.missing}", canceling plugin execution...`,"plugin",[
{key:"path",value:"./plugins/"+match.id}
])
initPluginError = true
})
//exit on error (when soft mode disabled)
if (!openticket.defaults.getDefault("softPluginLoading") && initPluginError){
if (!opendiscord.defaults.getDefault("softPluginLoading") && initPluginError){
console.log("")
openticket.log("Please fix all plugin errors above & try again!","error")
opendiscord.log("Please fix all plugin errors above & try again!","error")
process.exit(1)
}
//preload all events required for every plugin
for (const plugin of sortedPlugins){
if (plugin.enabled) plugin.data.events.forEach((event) => openticket.events.add(new api.ODEvent(event)))
if (plugin.enabled) plugin.data.events.forEach((event) => opendiscord.events.add(new api.ODEvent(event)))
}
//execute all working plugins
for (const plugin of sortedPlugins){
const status = await plugin.execute(openticket.debug,false)
const status = await plugin.execute(opendiscord.debug,false)
//exit on error (when soft mode disabled)
if (!status && !openticket.defaults.getDefault("softPluginLoading")){
if (!status && !opendiscord.defaults.getDefault("softPluginLoading")){
console.log("")
openticket.log("Please fix all plugin errors above & try again!","error")
opendiscord.log("Please fix all plugin errors above & try again!","error")
process.exit(1)
}
}
for (const plugin of sortedPlugins){
if (plugin.enabled){
openticket.debug.debug("Plugin \""+plugin.id.value+"\" loaded",[
opendiscord.debug.debug("Plugin \""+plugin.id.value+"\" loaded",[
{key:"status",value:(plugin.crashed ? "crashed" : "success")},
{key:"crashReason",value:(plugin.crashed ? (plugin.crashReason ?? "/") : "/")},
{key:"author",value:plugin.details.author},
@@ -185,7 +185,7 @@ export const loadAllPlugins = async () => {
{key:"priority",value:plugin.priority.toString()}
])
}else{
openticket.debug.debug("Plugin \""+plugin.id.value+"\" disabled",[
opendiscord.debug.debug("Plugin \""+plugin.id.value+"\" disabled",[
{key:"author",value:plugin.details.author},
{key:"version",value:plugin.version.toString()},
{key:"priority",value:plugin.priority.toString()}