mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 20:35:02 +00:00
Add pagination to !cases -mod
This commit is contained in:
parent
0c6ec9cef0
commit
5056b4376a
5 changed files with 87 additions and 31 deletions
|
@ -14,6 +14,8 @@ import { trimPluginDescription } from "../../utils";
|
|||
import { getCaseSummary } from "./functions/getCaseSummary";
|
||||
import { TimeAndDatePlugin } from "../TimeAndDate/TimeAndDatePlugin";
|
||||
import { mapToPublicFn } from "../../pluginUtils";
|
||||
import { getTotalCasesByMod } from "./functions/getTotalCasesByMod";
|
||||
import { getRecentCasesByMod } from "./functions/getRecentCasesByMod";
|
||||
|
||||
const defaultOptions = {
|
||||
config: {
|
||||
|
@ -64,6 +66,9 @@ export const CasesPlugin = zeppelinGuildPlugin<CasesPluginType>()("cases", {
|
|||
};
|
||||
},
|
||||
|
||||
getTotalCasesByMod: mapToPublicFn(getTotalCasesByMod),
|
||||
getRecentCasesByMod: mapToPublicFn(getRecentCasesByMod),
|
||||
|
||||
getCaseEmbed: mapToPublicFn(getCaseEmbed),
|
||||
getCaseSummary: mapToPublicFn(getCaseSummary),
|
||||
},
|
||||
|
|
12
backend/src/plugins/Cases/functions/getRecentCasesByMod.ts
Normal file
12
backend/src/plugins/Cases/functions/getRecentCasesByMod.ts
Normal file
|
@ -0,0 +1,12 @@
|
|||
import { GuildPluginData } from "knub";
|
||||
import { CasesPluginType } from "../types";
|
||||
import { Case } from "../../../data/entities/Case";
|
||||
|
||||
export function getRecentCasesByMod(
|
||||
pluginData: GuildPluginData<CasesPluginType>,
|
||||
modId: string,
|
||||
count: number,
|
||||
skip = 0,
|
||||
): Promise<Case[]> {
|
||||
return pluginData.state.cases.getRecentByModId(modId, count, skip);
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
import { GuildPluginData } from "knub";
|
||||
import { CasesPluginType } from "../types";
|
||||
|
||||
export function getTotalCasesByMod(pluginData: GuildPluginData<CasesPluginType>, modId: string): Promise<number> {
|
||||
return pluginData.state.cases.getTotalCasesByModId(modId);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue