mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-07-06 10:37:19 +00:00
Replace text confirmation with button-based confirmation in delete case command
This commit is contained in:
parent
f5806932af
commit
3d54eff654
1 changed files with 7 additions and 9 deletions
|
@ -1,8 +1,8 @@
|
||||||
import { ChatInputCommandInteraction, GuildMember, Message } from "discord.js";
|
import { ChatInputCommandInteraction, GuildMember, Message } from "discord.js";
|
||||||
import { GuildPluginData, helpers } from "knub";
|
import { GuildPluginData } from "knub";
|
||||||
import { Case } from "../../../../data/entities/Case.js";
|
import { Case } from "../../../../data/entities/Case.js";
|
||||||
import { getContextChannel, sendContextResponse } from "../../../../pluginUtils.js";
|
import { getContextChannel } from "../../../../pluginUtils.js";
|
||||||
import { SECONDS, renderUsername } from "../../../../utils.js";
|
import { confirm, renderUsername } from "../../../../utils.js";
|
||||||
import { CasesPlugin } from "../../../Cases/CasesPlugin.js";
|
import { CasesPlugin } from "../../../Cases/CasesPlugin.js";
|
||||||
import { LogsPlugin } from "../../../Logs/LogsPlugin.js";
|
import { LogsPlugin } from "../../../Logs/LogsPlugin.js";
|
||||||
import { TimeAndDatePlugin } from "../../../TimeAndDate/TimeAndDatePlugin.js";
|
import { TimeAndDatePlugin } from "../../../TimeAndDate/TimeAndDatePlugin.js";
|
||||||
|
@ -43,15 +43,13 @@ export async function actualDeleteCaseCmd(
|
||||||
|
|
||||||
const cases = pluginData.getPlugin(CasesPlugin);
|
const cases = pluginData.getPlugin(CasesPlugin);
|
||||||
const embedContent = await cases.getCaseEmbed(theCase);
|
const embedContent = await cases.getCaseEmbed(theCase);
|
||||||
sendContextResponse(context, {
|
|
||||||
|
const confirmed = await confirm(context, author.id, {
|
||||||
...embedContent,
|
...embedContent,
|
||||||
content: "Delete the following case? Answer 'Yes' to continue, 'No' to cancel.",
|
content: "Delete the following case?",
|
||||||
});
|
});
|
||||||
|
|
||||||
const reply = await helpers.waitForReply(pluginData.client, channel, author.id, 15 * SECONDS);
|
if (!confirmed) {
|
||||||
const normalizedReply = (reply?.content || "").toLowerCase().trim();
|
|
||||||
if (normalizedReply !== "yes" && normalizedReply !== "y") {
|
|
||||||
sendContextResponse(context, "Cancelled. Case was not deleted.");
|
|
||||||
cancelled++;
|
cancelled++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue