3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-16 22:21:51 +00:00

Fixed show option for case and cases commands

This commit is contained in:
Lily Bergonzat 2024-02-26 22:23:30 +01:00
parent 408f1b9c30
commit 7eff7bcaa6
4 changed files with 9 additions and 6 deletions

View file

@ -18,7 +18,7 @@ export const CaseSlashCmd = {
], ],
async run({ interaction, options, pluginData }) { async run({ interaction, options, pluginData }) {
await interaction.deferReply({ ephemeral: true }); await interaction.deferReply({ ephemeral: options.show !== true });
actualCaseCmd(pluginData, interaction, interaction.user.id, options["case-number"], options.show); actualCaseCmd(pluginData, interaction, interaction.user.id, options["case-number"], options.show);
}, },
}; };

View file

@ -30,7 +30,7 @@ export const CasesSlashCmd = {
signature: [...opts], signature: [...opts],
async run({ interaction, options, pluginData }) { async run({ interaction, options, pluginData }) {
await interaction.deferReply({ ephemeral: true }); await interaction.deferReply({ ephemeral: options.show !== true });
return actualCasesCmd( return actualCasesCmd(
pluginData, pluginData,

View file

@ -15,7 +15,7 @@ export async function actualCaseCmd(
const theCase = await pluginData.state.cases.findByCaseNumber(caseNumber); const theCase = await pluginData.state.cases.findByCaseNumber(caseNumber);
if (!theCase) { if (!theCase) {
pluginData.getPlugin(CommonPlugin).sendErrorMessage(context, "Case not found"); pluginData.getPlugin(CommonPlugin).sendErrorMessage(context, "Case not found", undefined, undefined, show !== true);
return; return;
} }

View file

@ -77,7 +77,7 @@ async function casesUserCmd(
if (cases.length === 0) { if (cases.length === 0) {
await sendContextResponse(context, { await sendContextResponse(context, {
content: `No cases found for **${userName}**${modId ? ` by ${modName}` : ""}.`, content: `No cases found for **${userName}**${modId ? ` by ${modName}` : ""}.`,
ephemeral: true, ephemeral: !show,
}); });
return; return;
@ -88,7 +88,7 @@ async function casesUserCmd(
if (!casesToDisplay.length) { if (!casesToDisplay.length) {
await sendContextResponse(context, { await sendContextResponse(context, {
content: `No normal cases found for **${userName}**. Use "-hidden" to show ${cases.length} hidden cases.`, content: `No normal cases found for **${userName}**. Use "-hidden" to show ${cases.length} hidden cases.`,
ephemeral: true, ephemeral: !show,
}); });
return; return;
@ -160,7 +160,10 @@ async function casesModCmd(
const totalCases = await casesPlugin.getTotalCasesByMod(modId ?? author.id, casesFilters); const totalCases = await casesPlugin.getTotalCasesByMod(modId ?? author.id, casesFilters);
if (totalCases === 0) { if (totalCases === 0) {
pluginData.getPlugin(CommonPlugin).sendErrorMessage(context, `No cases by **${modName}**`); pluginData
.getPlugin(CommonPlugin)
.sendErrorMessage(context, `No cases by **${modName}**`, undefined, undefined, !show);
return; return;
} }