Skip to content

Commit cba4e21

Browse files
authored
Merge pull request #523 from seeyebe/feature/delete-case-buttons
Replace text confirmation with button-based confirmation in delete case command
2 parents 28f9b51 + 3d54eff commit cba4e21

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

backend/src/plugins/ModActions/commands/deletecase/actualDeleteCaseCmd.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { ChatInputCommandInteraction, GuildMember, Message } from "discord.js";
2-
import { GuildPluginData, helpers } from "knub";
2+
import { GuildPluginData } from "knub";
33
import { Case } from "../../../../data/entities/Case.js";
4-
import { getContextChannel, sendContextResponse } from "../../../../pluginUtils.js";
5-
import { SECONDS, renderUsername } from "../../../../utils.js";
4+
import { getContextChannel } from "../../../../pluginUtils.js";
5+
import { confirm, renderUsername } from "../../../../utils.js";
66
import { CasesPlugin } from "../../../Cases/CasesPlugin.js";
77
import { LogsPlugin } from "../../../Logs/LogsPlugin.js";
88
import { TimeAndDatePlugin } from "../../../TimeAndDate/TimeAndDatePlugin.js";
@@ -43,15 +43,13 @@ export async function actualDeleteCaseCmd(
4343

4444
const cases = pluginData.getPlugin(CasesPlugin);
4545
const embedContent = await cases.getCaseEmbed(theCase);
46-
sendContextResponse(context, {
46+
47+
const confirmed = await confirm(context, author.id, {
4748
...embedContent,
48-
content: "Delete the following case? Answer 'Yes' to continue, 'No' to cancel.",
49+
content: "Delete the following case?",
4950
});
5051

51-
const reply = await helpers.waitForReply(pluginData.client, channel, author.id, 15 * SECONDS);
52-
const normalizedReply = (reply?.content || "").toLowerCase().trim();
53-
if (normalizedReply !== "yes" && normalizedReply !== "y") {
54-
sendContextResponse(context, "Cancelled. Case was not deleted.");
52+
if (!confirmed) {
5553
cancelled++;
5654
continue;
5755
}

0 commit comments

Comments
 (0)