Merge branch 'release/5.0.0' into develop

This commit is contained in:
Chocobozzz 2023-01-24 13:43:25 +01:00
commit 3a380e9a71
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 7 additions and 2 deletions

View File

@ -108,11 +108,16 @@ class PluginsManager {
} }
} }
async runHook<T> (hookName: ClientHookName, result?: T, params?: any) { async runHook<T> (hookName: ClientHookName, resultArg?: T | Promise<T>, params?: any) {
if (!this.hooks[hookName]) return result if (!this.hooks[hookName]) {
// eslint-disable-next-line no-return-await
return await resultArg
}
const hookType = getHookType(hookName) const hookType = getHookType(hookName)
let result = await resultArg
for (const hook of this.hooks[hookName]) { for (const hook of this.hooks[hookName]) {
logger.info(`Running hook ${hookName} of plugin ${hook.plugin.name}`) logger.info(`Running hook ${hookName} of plugin ${hook.plugin.name}`)