From 3a46c67c619d0739f49722fa9906e7dd81d00b78 Mon Sep 17 00:00:00 2001 From: rob Date: Mon, 22 Apr 2024 18:15:49 -0400 Subject: [PATCH] added remove-chat-room --- dtp-chat-cli.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/dtp-chat-cli.js b/dtp-chat-cli.js index 9437fb5..7dcf6f9 100644 --- a/dtp-chat-cli.js +++ b/dtp-chat-cli.js @@ -50,6 +50,10 @@ class SiteTerminalApp extends SiteRuntime { handler: this.removeMessage.bind(this), help: 'remove-message messageId', }, + 'remove-chat-room': { + handler: this.removeChatRoom.bind(this), + help: 'remove-chat-room roomId', + }, 'transcode-mov': { handler: this.transcodeMov.bind(this), help: 'transcode-mov filename', @@ -159,6 +163,16 @@ class SiteTerminalApp extends SiteRuntime { await chatService.removeMessage(message); } + async removeChatRoom (args) { + const { chat: chatService } = this.services; + const roomId = args.shift(); + const room = await chatService.getRoomById(roomId); + if (!room) { + throw new Error('chat room not found'); + } + await chatService.destroyRoom(room); + } + async transcodeMov (args) { const { video: videoService } = this.services;