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

Fixed race condition

This commit is contained in:
Lily Bergonzat 2024-02-18 01:23:25 +01:00
parent ba65ecb48f
commit e4e7e1c695

View file

@ -88,7 +88,7 @@ async function casesUserCmd(
} }
if (expand) { if (expand) {
sendExpandedCases(pluginData, context, casesToDisplay.length, casesToDisplay, show); await sendExpandedCases(pluginData, context, casesToDisplay.length, casesToDisplay, show);
return; return;
} }
@ -131,7 +131,7 @@ async function casesUserCmd(
fields: [...(isLastChunk ? [footerField] : [])], fields: [...(isLastChunk ? [footerField] : [])],
} satisfies APIEmbed; } satisfies APIEmbed;
sendContextResponse(context, { embeds: [embed], ephemeral: !show }); await sendContextResponse(context, { embeds: [embed], ephemeral: !show });
} }
} }
@ -164,11 +164,11 @@ async function casesModCmd(
// Expanded view (= individual case embeds) // Expanded view (= individual case embeds)
const cases = totalCases > 8 ? [] : await casesPlugin.getRecentCasesByMod(modId ?? author.id, 8, 0, casesFilters); const cases = totalCases > 8 ? [] : await casesPlugin.getRecentCasesByMod(modId ?? author.id, 8, 0, casesFilters);
sendExpandedCases(pluginData, context, totalCases, cases, show); await sendExpandedCases(pluginData, context, totalCases, cases, show);
return; return;
} }
createPaginatedMessage( await createPaginatedMessage(
pluginData.client, pluginData.client,
context, context,
totalPages, totalPages,
@ -257,8 +257,19 @@ export async function actualCasesCmd(
} }
user user
? casesUserCmd(pluginData, context, author.user, modId!, user, modName, typesToShow, hidden, expand, show === true) ? await casesUserCmd(
: casesModCmd( pluginData,
context,
author.user,
modId!,
user,
modName,
typesToShow,
hidden,
expand,
show === true,
)
: await casesModCmd(
pluginData, pluginData,
context, context,
author.user, author.user,