General Actions to handlers Refacto

This commit is contained in:
STEINNI
2026-06-20 18:50:26 +00:00
parent 7435d96135
commit 44a84c64ec
56 changed files with 832 additions and 973 deletions
+10 -4
View File
@@ -9,9 +9,11 @@ export class RedisConnexion {
this.redisConfig = this.config
this.meshName = options.meshName
this.meshModule = options.meshModule ?? null
this.senderId = options.senderId ?? null
this.actionsReply = options.actionsReply ?? null
if(this.meshModule?.meshActions) Object.assign(this, this.meshModule.meshActions)
this.afterLoginMethods = this.meshModule?.afterLoginMethods ?? []
if(this.meshModule?.actionHandlers) Object.assign(this, this.meshModule.actionHandlers)
this.afterLogin = this.meshModule?.afterLogin ?? []
this.redisClient = redis.createClient({
socket: {
@@ -56,7 +58,7 @@ export class RedisConnexion {
console.log(`[${this.redisConfig.redisId}] Redis ${this.redisConfig.redisId} time:`, redisTime)
}
for(const method of this.afterLoginMethods){
for(const method of this.afterLogin){
if(typeof method != 'function') continue
method(this)
}
@@ -282,7 +284,11 @@ export class RedisConnexion {
}
if(typeof(this.meshModule?.dispatchMessage) === 'function') {
this.meshModule.dispatchMessage(this, msg, chan)
try {
await this.meshModule.dispatchMessage(this, msg, chan)
} catch(err) {
console.error(`[${this.redisConfig.redisId}] dispatchMessage failed on ${chan}:`, err)
}
}
}