3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-25 10:25:01 +00:00

Update createCase.ts

This commit is contained in:
srqc 2023-02-09 20:00:44 -05:00 committed by GitHub
parent 59a597739e
commit 05df7646ba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -44,7 +44,10 @@ export async function createCase(pluginData: GuildPluginData<CasesPluginType>, a
is_hidden: Boolean(args.hide), is_hidden: Boolean(args.hide),
}); });
if (!casesTypesWithoutArchive.includes(args.type)) { if (!casesTypesWithoutArchive.includes(args.type)) {
const messagesToArchive = await pluginData.state.savedMessages.getUserMessages(user.id, 50); const messagesToArchive = Array.from(await pluginData.state.savedMessages.getUserMessages(user.id, 50)).sort(
(a, b) => (a.posted_at > b.posted_at ? 1 : -1),
);
const archiveId = await pluginData.state.archives.createFromSavedMessages(messagesToArchive, pluginData.guild); const archiveId = await pluginData.state.archives.createFromSavedMessages(messagesToArchive, pluginData.guild);
const baseUrl = getBaseUrl(pluginData); const baseUrl = getBaseUrl(pluginData);
await createCaseNote(pluginData, { await createCaseNote(pluginData, {