diff --git a/commands/core/chat.js b/commands/core/chat.js index 8c4cca1..5ba3dee 100644 --- a/commands/core/chat.js +++ b/commands/core/chat.js @@ -40,7 +40,7 @@ export function cleanActiveMessages() { const now = Date.now(); for (let i = 0; i < ACTIVE_MESSAGES.length; i++) { const message = ACTIVE_MESSAGES[i]; - if (now - message.sent > ACTIVE_TIMEOUT) { + if (now - message.sent > ACTIVE_TIMEOUT || message.toDelete) { ACTIVE_MESSAGES.splice(i, 1); i--; } @@ -62,6 +62,7 @@ export function addActiveMessage(customId, userid) { customId, userid, sent: Date.now(), + toDelete: false, }); } diff --git a/commands/core/updateMessage.js b/commands/core/updateMessage.js index af1a6f1..880d96c 100644 --- a/commands/core/updateMessage.js +++ b/commands/core/updateMessage.js @@ -48,6 +48,9 @@ export async function run({ core, server, socket, payload }) { if (msg.userid === socket.userid && msg.customId === customId) { message = ACTIVE_MESSAGES[i]; + if (mode === 'complete') { + ACTIVE_MESSAGES[i].toDelete = true; + } break; } }