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);