mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-17 07:05:03 +00:00
remove evidence
This commit is contained in:
parent
e93f017e8a
commit
4cd95b68a7
3 changed files with 181 additions and 218 deletions
|
@ -16,13 +16,11 @@ import { convertDelayStringToMS, renderUserUsername } from "../../../utils";
|
|||
import { CaseArgs } from "../../Cases/types";
|
||||
import { MODAL_TIMEOUT } from "../commands/ModMenuUserCtxCmd";
|
||||
import { ContextMenuPluginType, ModMenuActionType } from "../types";
|
||||
import { updateAction } from "./update";
|
||||
|
||||
async function banAction(
|
||||
pluginData: GuildPluginData<ContextMenuPluginType>,
|
||||
duration: string | undefined,
|
||||
reason: string | undefined,
|
||||
evidence: string | undefined,
|
||||
target: string,
|
||||
interaction: ButtonInteraction | ContextMenuCommandInteraction,
|
||||
submitInteraction: ModalSubmitInteraction,
|
||||
|
@ -65,13 +63,10 @@ async function banAction(
|
|||
|
||||
const userName = renderUserUsername(targetMember.user);
|
||||
const messageResultText = result.notifyResult.text ? ` (${result.notifyResult.text})` : "";
|
||||
const banMessage = `Banned **${userName}** ${durationMs ? `for ${humanizeDuration(durationMs)}` : "indefinitely"
|
||||
const banMessage = `Banned **${userName}** ${
|
||||
durationMs ? `for ${humanizeDuration(durationMs)}` : "indefinitely"
|
||||
} (Case #${result.case.case_number})${messageResultText}`;
|
||||
|
||||
if (evidence) {
|
||||
await updateAction(pluginData, executingMember, result.case, evidence);
|
||||
}
|
||||
|
||||
await interactionToReply
|
||||
.editReply({ content: banMessage, embeds: [], components: [] })
|
||||
.catch((err) => logger.error(`Ban interaction reply failed: ${err}`));
|
||||
|
@ -94,15 +89,9 @@ export async function launchBanActionModal(
|
|||
.setLabel("Reason (Optional)")
|
||||
.setRequired(false)
|
||||
.setStyle(TextInputStyle.Paragraph);
|
||||
const evidenceIn = new TextInputBuilder()
|
||||
.setCustomId("evidence")
|
||||
.setLabel("Evidence (Optional)")
|
||||
.setRequired(false)
|
||||
.setStyle(TextInputStyle.Paragraph);
|
||||
const durationRow = new ActionRowBuilder<TextInputBuilder>().addComponents(durationIn);
|
||||
const reasonRow = new ActionRowBuilder<TextInputBuilder>().addComponents(reasonIn);
|
||||
const evidenceRow = new ActionRowBuilder<TextInputBuilder>().addComponents(evidenceIn);
|
||||
modal.addComponents(durationRow, reasonRow, evidenceRow);
|
||||
modal.addComponents(durationRow, reasonRow);
|
||||
|
||||
await interaction.showModal(modal);
|
||||
await interaction
|
||||
|
@ -118,9 +107,8 @@ export async function launchBanActionModal(
|
|||
|
||||
const duration = submitted.fields.getTextInputValue("duration");
|
||||
const reason = submitted.fields.getTextInputValue("reason");
|
||||
const evidence = submitted.fields.getTextInputValue("evidence");
|
||||
|
||||
await banAction(pluginData, duration, reason, evidence, target, interaction, submitted);
|
||||
await banAction(pluginData, duration, reason, target, interaction, submitted);
|
||||
})
|
||||
.catch((err) => logger.error(`Ban modal interaction failed: ${err}`));
|
||||
}
|
|
@ -19,13 +19,11 @@ import { LogsPlugin } from "../../Logs/LogsPlugin";
|
|||
import { MutesPlugin } from "../../Mutes/MutesPlugin";
|
||||
import { MODAL_TIMEOUT } from "../commands/ModMenuUserCtxCmd";
|
||||
import { ContextMenuPluginType, ModMenuActionType } from "../types";
|
||||
import { updateAction } from "./update";
|
||||
|
||||
async function muteAction(
|
||||
pluginData: GuildPluginData<ContextMenuPluginType>,
|
||||
duration: string | undefined,
|
||||
reason: string | undefined,
|
||||
evidence: string | undefined,
|
||||
target: string,
|
||||
interaction: ButtonInteraction | ContextMenuCommandInteraction,
|
||||
submitInteraction: ModalSubmitInteraction,
|
||||
|
@ -71,13 +69,10 @@ async function muteAction(
|
|||
const result = await mutes.muteUser(target, durationMs, reason, { caseArgs });
|
||||
|
||||
const messageResultText = result.notifyResult.text ? ` (${result.notifyResult.text})` : "";
|
||||
const muteMessage = `Muted **${result.case.user_name}** ${durationMs ? `for ${humanizeDuration(durationMs)}` : "indefinitely"
|
||||
const muteMessage = `Muted **${result.case.user_name}** ${
|
||||
durationMs ? `for ${humanizeDuration(durationMs)}` : "indefinitely"
|
||||
} (Case #${result.case.case_number})${messageResultText}`;
|
||||
|
||||
if (evidence) {
|
||||
await updateAction(pluginData, executingMember, result.case, evidence);
|
||||
}
|
||||
|
||||
await interactionToReply
|
||||
.editReply({ content: muteMessage, embeds: [], components: [] })
|
||||
.catch((err) => logger.error(`Mute interaction reply failed: ${err}`));
|
||||
|
@ -117,15 +112,9 @@ export async function launchMuteActionModal(
|
|||
.setLabel("Reason (Optional)")
|
||||
.setRequired(false)
|
||||
.setStyle(TextInputStyle.Paragraph);
|
||||
const evidenceIn = new TextInputBuilder()
|
||||
.setCustomId("evidence")
|
||||
.setLabel("Evidence (Optional)")
|
||||
.setRequired(false)
|
||||
.setStyle(TextInputStyle.Paragraph);
|
||||
const durationRow = new ActionRowBuilder<TextInputBuilder>().addComponents(durationIn);
|
||||
const reasonRow = new ActionRowBuilder<TextInputBuilder>().addComponents(reasonIn);
|
||||
const evidenceRow = new ActionRowBuilder<TextInputBuilder>().addComponents(evidenceIn);
|
||||
modal.addComponents(durationRow, reasonRow, evidenceRow);
|
||||
modal.addComponents(durationRow, reasonRow);
|
||||
|
||||
await interaction.showModal(modal);
|
||||
await interaction
|
||||
|
@ -141,9 +130,8 @@ export async function launchMuteActionModal(
|
|||
|
||||
const duration = submitted.fields.getTextInputValue("duration");
|
||||
const reason = submitted.fields.getTextInputValue("reason");
|
||||
const evidence = submitted.fields.getTextInputValue("evidence");
|
||||
|
||||
await muteAction(pluginData, duration, reason, evidence, target, interaction, submitted);
|
||||
await muteAction(pluginData, duration, reason, target, interaction, submitted);
|
||||
})
|
||||
.catch((err) => logger.error(`Mute modal interaction failed: ${err}`));
|
||||
}
|
|
@ -15,12 +15,10 @@ import { renderUserUsername } from "../../../utils";
|
|||
import { CaseArgs } from "../../Cases/types";
|
||||
import { MODAL_TIMEOUT } from "../commands/ModMenuUserCtxCmd";
|
||||
import { ContextMenuPluginType, ModMenuActionType } from "../types";
|
||||
import { updateAction } from "./update";
|
||||
|
||||
async function warnAction(
|
||||
pluginData: GuildPluginData<ContextMenuPluginType>,
|
||||
reason: string,
|
||||
evidence: string | undefined,
|
||||
target: string,
|
||||
interaction: ButtonInteraction | ContextMenuCommandInteraction,
|
||||
submitInteraction: ModalSubmitInteraction,
|
||||
|
@ -72,10 +70,6 @@ async function warnAction(
|
|||
const messageResultText = result.notifyResult.text ? ` (${result.notifyResult.text})` : "";
|
||||
const muteMessage = `Warned **${userName}** (Case #${result.case.case_number})${messageResultText}`;
|
||||
|
||||
if (evidence) {
|
||||
await updateAction(pluginData, executingMember, result.case, evidence);
|
||||
}
|
||||
|
||||
await interactionToReply
|
||||
.editReply({ content: muteMessage, embeds: [], components: [] })
|
||||
.catch((err) => logger.error(`Warn interaction reply failed: ${err}`));
|
||||
|
@ -89,14 +83,8 @@ export async function launchWarnActionModal(
|
|||
const modalId = `${ModMenuActionType.WARN}:${interaction.id}`;
|
||||
const modal = new ModalBuilder().setCustomId(modalId).setTitle("Warn");
|
||||
const reasonIn = new TextInputBuilder().setCustomId("reason").setLabel("Reason").setStyle(TextInputStyle.Paragraph);
|
||||
const evidenceIn = new TextInputBuilder()
|
||||
.setCustomId("evidence")
|
||||
.setLabel("Evidence (Optional)")
|
||||
.setRequired(false)
|
||||
.setStyle(TextInputStyle.Paragraph);
|
||||
const reasonRow = new ActionRowBuilder<TextInputBuilder>().addComponents(reasonIn);
|
||||
const evidenceRow = new ActionRowBuilder<TextInputBuilder>().addComponents(evidenceIn);
|
||||
modal.addComponents(reasonRow, evidenceRow);
|
||||
modal.addComponents(reasonRow);
|
||||
|
||||
await interaction.showModal(modal);
|
||||
await interaction
|
||||
|
@ -111,9 +99,8 @@ export async function launchWarnActionModal(
|
|||
}
|
||||
|
||||
const reason = submitted.fields.getTextInputValue("reason");
|
||||
const evidence = submitted.fields.getTextInputValue("evidence");
|
||||
|
||||
await warnAction(pluginData, reason, evidence, target, interaction, submitted);
|
||||
await warnAction(pluginData, reason, target, interaction, submitted);
|
||||
})
|
||||
.catch((err) => logger.error(`Warn modal interaction failed: ${err}`));
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue