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