|
1 | 1 | import { ChatInputCommandInteraction, GuildMember, Message } from "discord.js"; |
2 | | -import { GuildPluginData, helpers } from "knub"; |
| 2 | +import { GuildPluginData } from "knub"; |
3 | 3 | 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"; |
6 | 6 | import { CasesPlugin } from "../../../Cases/CasesPlugin.js"; |
7 | 7 | import { LogsPlugin } from "../../../Logs/LogsPlugin.js"; |
8 | 8 | import { TimeAndDatePlugin } from "../../../TimeAndDate/TimeAndDatePlugin.js"; |
@@ -43,15 +43,13 @@ export async function actualDeleteCaseCmd( |
43 | 43 |
|
44 | 44 | const cases = pluginData.getPlugin(CasesPlugin); |
45 | 45 | const embedContent = await cases.getCaseEmbed(theCase); |
46 | | - sendContextResponse(context, { |
| 46 | + |
| 47 | + const confirmed = await confirm(context, author.id, { |
47 | 48 | ...embedContent, |
48 | | - content: "Delete the following case? Answer 'Yes' to continue, 'No' to cancel.", |
| 49 | + content: "Delete the following case?", |
49 | 50 | }); |
50 | 51 |
|
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) { |
55 | 53 | cancelled++; |
56 | 54 | continue; |
57 | 55 | } |
|
0 commit comments