From 22108c5c9f5ad83d3b6cf0c6596af057a8bb9bd3 Mon Sep 17 00:00:00 2001 From: Cohee Date: Thu, 13 Jul 2023 20:00:17 +0300 Subject: [PATCH] Fix /cut command --- public/script.js | 5 +++-- public/scripts/power-user.js | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/public/script.js b/public/script.js index d1851d0df..3e0032fc6 100644 --- a/public/script.js +++ b/public/script.js @@ -7967,8 +7967,9 @@ $(document).ready(function () { }); - $(document).on("click", ".mes_edit_delete", async function () { - if (power_user.confirm_message_delete) { + $(document).on("click", ".mes_edit_delete", async function (event, customData) { + const fromSlashCommand = customData?.fromSlashCommand || false; + if (power_user.confirm_message_delete && fromSlashCommand !== true) { const confirmation = await callPopup("Are you sure you want to delete this message?", 'confirm'); if (!confirmation) { return; diff --git a/public/scripts/power-user.js b/public/scripts/power-user.js index 972c183a2..9bad0f73f 100644 --- a/public/scripts/power-user.js +++ b/public/scripts/power-user.js @@ -16,7 +16,8 @@ import { name1, name2, replaceCurrentChat, - setCharacterId + setCharacterId, + setEditedMessageId } from "../script.js"; import { favsToHotswap, isMobile, initMovingUI } from "./RossAscends-mods.js"; import { @@ -1123,8 +1124,8 @@ async function doMesCut(_, text) { return } - mesToCut.find('.mes_edit_delete').trigger('click'); - $('#dialogue_popup_ok').trigger('click'); + setEditedMessageId(mesIDToCut); + mesToCut.find('.mes_edit_delete').trigger('click', { fromSlashCommand: true }); }