From 0780213aa1007fa6e8121d3b27c3a7cf50fa43f3 Mon Sep 17 00:00:00 2001 From: Hri7566 Date: Sat, 2 Dec 2023 19:28:05 -0500 Subject: [PATCH] Change how MPP service sends chat messages --- src/services/mpp/index.ts | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/services/mpp/index.ts b/src/services/mpp/index.ts index 6323a18..e329c7e 100644 --- a/src/services/mpp/index.ts +++ b/src/services/mpp/index.ts @@ -73,16 +73,21 @@ export class MPPAgent extends ServiceAgent { ); if (str) { - if (str.includes("\n")) { - let sp = str.split("\n"); + this.logger.debug(str); + if (typeof str == "string") { + if (str.includes("\n")) { + let sp = str.split("\n"); - for (const s of sp) { - this.client.sendArray([ - { - m: "a", - message: `\u034f${s}` - } - ]); + for (const s of sp) { + this.client.sendArray([ + { + m: "a", + message: `\u034f${s}` + } + ]); + } + } else { + this.emit("send chat", str); } } else { this.emit("send chat", str);