Added 13 new utility events for plugins

This commit is contained in:
DJj123dj
2025-02-09 11:19:03 +01:00
parent b2a5e65fe2
commit 9395e9af75
4 changed files with 77 additions and 1 deletions
+26 -1
View File
@@ -63,7 +63,7 @@ export interface ODEventIds_Default {
"onFlagInit": ODEvent_Default<(flags:ODFlagManager_Default) => ODPromiseVoid>
"afterFlagsInitiated": ODEvent_Default<(flags:ODFlagManager_Default) => ODPromiseVoid>
//progres bars
//progress bars
"onProgressBarRendererLoad": ODEvent_Default<(renderers:ODProgressBarRendererManager_Default) => ODPromiseVoid>
"afterProgressBarRenderersLoaded": ODEvent_Default<(renderers:ODProgressBarRendererManager_Default) => ODPromiseVoid>
"onProgressBarLoad": ODEvent_Default<(progressbars:ODProgressBarManager_Default) => ODPromiseVoid>
@@ -106,6 +106,10 @@ export interface ODEventIds_Default {
"afterCheckersRendered": ODEvent_Default<(renderer:ODCheckerRenderer_Default, checkers:ODCheckerManager_Default) => ODPromiseVoid>
"onCheckerQuit": ODEvent_Default<(checkers:ODCheckerManager_Default) => ODPromiseVoid>
//plugin loading before client
"onPluginBeforeClientLoad": ODEvent_Default<() => ODPromiseVoid>,
"afterPluginBeforeClientLoaded": ODEvent_Default<() => ODPromiseVoid>,
//client configuration
"onClientLoad": ODEvent_Default<(client:ODClientManager_Default) => ODPromiseVoid>
"afterClientLoaded": ODEvent_Default<(client:ODClientManager_Default) => ODPromiseVoid>
@@ -128,6 +132,10 @@ export interface ODEventIds_Default {
"onTextCommandLoad": ODEvent_Default<(text:ODTextCommandManager_Default, client:ODClientManager_Default,) => ODPromiseVoid>
"afterTextCommandsLoaded": ODEvent_Default<(text:ODTextCommandManager_Default, client:ODClientManager_Default) => ODPromiseVoid>
//plugin loading before managers
"onPluginBeforeManagerLoad": ODEvent_Default<() => ODPromiseVoid>,
"afterPluginBeforeManagerLoaded": ODEvent_Default<() => ODPromiseVoid>,
//questions
"onQuestionLoad": ODEvent_Default<(questions:ODQuestionManager) => ODPromiseVoid>
"afterQuestionsLoaded": ODEvent_Default<(questions:ODQuestionManager) => ODPromiseVoid>
@@ -210,6 +218,10 @@ export interface ODEventIds_Default {
"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>
//plugin loading before builders
"onPluginBeforeBuilderLoad": ODEvent_Default<() => ODPromiseVoid>,
"afterPluginBeforeBuilderLoaded": ODEvent_Default<() => 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>
@@ -224,6 +236,10 @@ export interface ODEventIds_Default {
"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>
//plugin loading before responders
"onPluginBeforeResponderLoad": ODEvent_Default<() => ODPromiseVoid>,
"afterPluginBeforeResponderLoaded": ODEvent_Default<() => 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>
@@ -234,6 +250,10 @@ export interface ODEventIds_Default {
"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>
//plugin loading before finalizations
"onPluginBeforeFinalizationLoad": ODEvent_Default<() => ODPromiseVoid>,
"afterPluginBeforeFinalizationLoaded": ODEvent_Default<() => ODPromiseVoid>,
//actions
"onActionLoad": ODEvent_Default<(actions:ODActionManager_Default) => ODPromiseVoid>
"afterActionsLoaded": ODEvent_Default<(actions:ODActionManager_Default) => ODPromiseVoid>
@@ -272,6 +292,10 @@ export interface ODEventIds_Default {
"onStatInit": ODEvent_Default<(stats:ODStatsManager_Default) => ODPromiseVoid>
"afterStatsInitiated": ODEvent_Default<(stats:ODStatsManager_Default) => ODPromiseVoid>
//plugin loading before code
"onPluginBeforeCodeLoad": ODEvent_Default<() => ODPromiseVoid>,
"afterPluginBeforeCodeLoaded": ODEvent_Default<() => ODPromiseVoid>,
//code
"onCodeLoad": ODEvent_Default<(code:ODCodeManager_Default) => ODPromiseVoid>
"afterCodeLoaded": ODEvent_Default<(code:ODCodeManager_Default) => ODPromiseVoid>
@@ -289,6 +313,7 @@ export interface ODEventIds_Default {
"afterStartScreensRendered": ODEvent_Default<(startscreen:ODStartScreenManager_Default) => ODPromiseVoid>
//ready
"beforeReadyForUsage": ODEvent_Default<() => ODPromiseVoid>
"onReadyForUsage": ODEvent_Default<() => ODPromiseVoid>
}
+1
View File
@@ -104,6 +104,7 @@ export class ODId {
export class ODManagerChangeHelper {
#change: (() => void)|null = null
/**Trigger an `onChange()` event in the parent `ODManager` of this class. */
protected _change(){
if (this.#change){
try{
+25
View File
@@ -60,6 +60,10 @@ export const loadAllEvents = () => {
"afterCheckersRendered",
"onCheckerQuit",
//plugin loading before client
"onPluginBeforeClientLoad",
"afterPluginBeforeClientLoaded",
//client configuration
"onClientLoad",
"afterClientLoaded",
@@ -82,6 +86,10 @@ export const loadAllEvents = () => {
"onTextCommandLoad",
"afterTextCommandsLoaded",
//plugin loading before managers
"onPluginBeforeManagerLoad",
"afterPluginBeforeManagerLoaded",
//questions
"onQuestionLoad",
"afterQuestionsLoaded",
@@ -164,6 +172,10 @@ export const loadAllEvents = () => {
"onTranscriptReady",
"afterTranscriptReady",
//plugin loading before builders
"onPluginBeforeBuilderLoad",
"afterPluginBeforeBuilderLoaded",
//builders
"onButtonBuilderLoad",
"afterButtonBuildersLoaded",
@@ -178,6 +190,10 @@ export const loadAllEvents = () => {
"onModalBuilderLoad",
"afterModalBuildersLoaded",
//plugin loading before responders
"onPluginBeforeResponderLoad",
"afterPluginBeforeResponderLoaded",
//responders
"onCommandResponderLoad",
"afterCommandRespondersLoaded",
@@ -188,6 +204,10 @@ export const loadAllEvents = () => {
"onModalResponderLoad",
"afterModalRespondersLoaded",
//plugin loading before finalizations
"onPluginBeforeFinalizationLoad",
"afterPluginBeforeFinalizationLoaded",
//actions
"onActionLoad",
"afterActionsLoaded",
@@ -226,6 +246,10 @@ export const loadAllEvents = () => {
"onStatInit",
"afterStatsInitiated",
//plugin loading before code
"onPluginBeforeCodeLoad",
"afterPluginBeforeCodeLoaded",
//code
"onCodeLoad",
"afterCodeLoaded",
@@ -243,6 +267,7 @@ export const loadAllEvents = () => {
"afterStartScreensRendered",
//ready
"beforeReadyForUsage",
"onReadyForUsage"
]
eventList.forEach((event) => opendiscord.events.add(new api.ODEvent(event)))
+25
View File
@@ -284,6 +284,10 @@ const main = async () => {
}
}
//plugin loading before client
await opendiscord.events.get("onPluginBeforeClientLoad").emit([])
await opendiscord.events.get("afterPluginBeforeClientLoaded").emit([])
//client configuration
opendiscord.log("Loading client...","system")
if (opendiscord.defaults.getDefault("clientLoading")){
@@ -458,6 +462,10 @@ const main = async () => {
opendiscord.log("discord.js client ready!","info")
}
//plugin loading before managers
await opendiscord.events.get("onPluginBeforeManagerLoad").emit([])
await opendiscord.events.get("afterPluginBeforeManagerLoaded").emit([])
//load questions
opendiscord.log("Loading questions...","system")
if (opendiscord.defaults.getDefault("questionLoading")){
@@ -522,6 +530,10 @@ const main = async () => {
await opendiscord.events.get("onTranscriptHistoryLoad").emit([opendiscord.transcripts])
await opendiscord.events.get("afterTranscriptHistoryLoaded").emit([opendiscord.transcripts])
//plugin loading before builders
await opendiscord.events.get("onPluginBeforeBuilderLoad").emit([])
await opendiscord.events.get("afterPluginBeforeBuilderLoaded").emit([])
//load button builders
opendiscord.log("Loading buttons...","system")
if (opendiscord.defaults.getDefault("buttonBuildersLoading")){
@@ -570,6 +582,10 @@ const main = async () => {
await opendiscord.events.get("onModalBuilderLoad").emit([opendiscord.builders.modals,opendiscord.builders,opendiscord.actions])
await opendiscord.events.get("afterModalBuildersLoaded").emit([opendiscord.builders.modals,opendiscord.builders,opendiscord.actions])
//plugin loading before responders
await opendiscord.events.get("onPluginBeforeResponderLoad").emit([])
await opendiscord.events.get("afterPluginBeforeResponderLoaded").emit([])
//load command responders
opendiscord.log("Loading command responders...","system")
if (opendiscord.defaults.getDefault("commandRespondersLoading")){
@@ -639,6 +655,10 @@ const main = async () => {
await opendiscord.events.get("onModalResponderLoad").emit([opendiscord.responders.modals,opendiscord.responders,opendiscord.actions])
await opendiscord.events.get("afterModalRespondersLoaded").emit([opendiscord.responders.modals,opendiscord.responders,opendiscord.actions])
//plugin loading before finalizations
await opendiscord.events.get("onPluginBeforeFinalizationLoad").emit([])
await opendiscord.events.get("afterPluginBeforeFinalizationLoaded").emit([])
//load actions
opendiscord.log("Loading actions...","system")
if (opendiscord.defaults.getDefault("actionsLoading")){
@@ -752,6 +772,10 @@ const main = async () => {
await opendiscord.events.get("afterStatsInitiated").emit([opendiscord.stats])
}
//plugin loading before code
await opendiscord.events.get("onPluginBeforeCodeLoad").emit([])
await opendiscord.events.get("afterPluginBeforeCodeLoaded").emit([])
//load code
opendiscord.log("Loading code...","system")
if (opendiscord.defaults.getDefault("codeLoading")){
@@ -802,6 +826,7 @@ const main = async () => {
//YIPPPIE!!
//The startup of Open Ticket is completed :)
await opendiscord.events.get("beforeReadyForUsage").emit([])
opendiscord.readyStartupDate = new Date()
await opendiscord.events.get("onReadyForUsage").emit([])
}