From b8fd2fb93175f15d0f19f4aa4f8a473f1e6a4735 Mon Sep 17 00:00:00 2001 From: carrot <68383195+AnnikaV9@users.noreply.github.com> Date: Tue, 21 Nov 2023 22:35:12 +0800 Subject: [PATCH] Add `complete` mode to `updateMessage` --- client/client.js | 4 ++++ commands/core/updateMessage.js | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/client/client.js b/client/client.js index f40e3f3..d40d779 100644 --- a/client/client.js +++ b/client/client.js @@ -412,6 +412,10 @@ var COMMANDS = { for (var i = 0; i < activeMessages.length; i++) { var msg = activeMessages[i]; if (msg.userid === args.userid && msg.customId === customId) { + if (mode === 'complete') { + activeMessages.splice(i, 1); + return; + } message = msg; break; } diff --git a/commands/core/updateMessage.js b/commands/core/updateMessage.js index 9318420..af1a6f1 100644 --- a/commands/core/updateMessage.js +++ b/commands/core/updateMessage.js @@ -3,14 +3,14 @@ import { isAdmin, isModerator } from "../utility/_UAC.js"; import { ACTIVE_MESSAGES, MAX_MESSAGE_ID_LENGTH } from "./chat.js"; export async function run({ core, server, socket, payload }) { - // undefined | "overwrite" | "append" | "prepend" + // undefined | "overwrite" | "append" | "prepend" | "complete" let mode = payload.mode; if (!mode) { mode = 'overwrite'; } - if (mode !== 'overwrite' && mode !== 'append' && mode !== 'prepend') { + if (mode !== 'overwrite' && mode !== 'append' && mode !== 'prepend' && mode !== 'complete') { return server.police.frisk(socket.address, 13); } @@ -93,5 +93,5 @@ export const info = { category: 'core', description: 'Update a message you have sent.', usage: ` - API: { cmd: 'updateMessage', mode: 'overwrite'|'append'|'prepend', text: '', customId: '' }`, + API: { cmd: 'updateMessage', mode: 'overwrite'|'append'|'prepend'|'complete', text: '', customId: '' }`, };