From c257ffbd2af58ff1399efa4f10706c654cd26ff2 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 3 Feb 2024 21:29:35 -0300 Subject: [PATCH] TODO: Chat logs --- src/channel/Channel.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/channel/Channel.ts b/src/channel/Channel.ts index c9aebc5..0602515 100644 --- a/src/channel/Channel.ts +++ b/src/channel/Channel.ts @@ -126,6 +126,19 @@ export class Channel extends EventEmitter { this.sendArray([outgoing]); this.chatHistory.push(outgoing); + + prisma.chatHistory.upsert({ + where:{ + id: this._id + }, + update:{ + messages: JSON.stringify(this.chatHistory) + }, + create: { + id:this._id, + messages: JSON.stringify(this.chatHistory) + } + }) try { if (msg.message.startsWith("/")) { this.emit("command", msg, socket);