3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-07-08 03:27:20 +00:00

Merge master

This commit is contained in:
Dragory 2024-01-27 14:45:35 +02:00
commit e72abb05b2
No known key found for this signature in database
2 changed files with 50 additions and 43 deletions

View file

@ -4,7 +4,6 @@ import { sendErrorMessage } from "../../../pluginUtils";
import { UnknownUser, emptyEmbedValue, renderUsername, resolveMember, resolveUser, trimLines } from "../../../utils";
import { asyncMap } from "../../../utils/async";
import { createPaginatedMessage } from "../../../utils/createPaginatedMessage";
import { getChunkedEmbedFields } from "../../../utils/getChunkedEmbedFields";
import { getGuildPrefix } from "../../../utils/getGuildPrefix";
import { CasesPlugin } from "../../Cases/CasesPlugin";
import { modActionsCmd } from "../types";
@ -13,7 +12,7 @@ const opts = {
mod: ct.userId({ option: true }),
};
const casesPerPage = 5;
const casesPerPage = 10;
export const CasesModCmd = modActionsCmd({
trigger: ["cases", "modlogs", "infractions"],
@ -52,8 +51,9 @@ export const CasesModCmd = modActionsCmd({
const cases = await casesPlugin.getRecentCasesByMod(modId, casesPerPage, (page - 1) * casesPerPage);
const lines = await asyncMap(cases, (c) => casesPlugin.getCaseSummary(c, true, msg.author.id));
const isLastPage = page === totalPages;
const firstCaseNum = (page - 1) * casesPerPage + 1;
const lastCaseNum = page * casesPerPage;
const lastCaseNum = isLastPage ? totalCases : page * casesPerPage;
const title = `Most recent cases ${firstCaseNum}-${lastCaseNum} of ${totalCases} by ${modName}`;
const embed = {
@ -61,8 +61,8 @@ export const CasesModCmd = modActionsCmd({
name: title,
icon_url: mod instanceof UnknownUser ? undefined : mod.displayAvatarURL(),
},
description: lines.join("\n"),
fields: [
...getChunkedEmbedFields(emptyEmbedValue, lines.join("\n")),
{
name: emptyEmbedValue,
value: trimLines(`