mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-14 13:55:03 +00:00
feat: update knub; update public interfaces for new knub
This commit is contained in:
parent
c2ae6d53d8
commit
c89c5ea430
15 changed files with 193 additions and 241 deletions
|
@ -1,10 +1,8 @@
|
|||
import { guildPlugin } from "knub";
|
||||
import { CaseTypes } from "../../data/CaseTypes";
|
||||
import { GuildArchives } from "../../data/GuildArchives";
|
||||
import { GuildCases } from "../../data/GuildCases";
|
||||
import { GuildLogs } from "../../data/GuildLogs";
|
||||
import { Case } from "../../data/entities/Case";
|
||||
import { mapToPublicFn } from "../../pluginUtils";
|
||||
import { makePublicFn } from "../../pluginUtils";
|
||||
import { InternalPosterPlugin } from "../InternalPoster/InternalPosterPlugin";
|
||||
import { TimeAndDatePlugin } from "../TimeAndDate/TimeAndDatePlugin";
|
||||
import { createCase } from "./functions/createCase";
|
||||
|
@ -15,7 +13,7 @@ import { getCaseTypeAmountForUserId } from "./functions/getCaseTypeAmountForUser
|
|||
import { getRecentCasesByMod } from "./functions/getRecentCasesByMod";
|
||||
import { getTotalCasesByMod } from "./functions/getTotalCasesByMod";
|
||||
import { postCaseToCaseLogChannel } from "./functions/postToCaseLogChannel";
|
||||
import { CaseArgs, CaseNoteArgs, CasesPluginType, zCasesConfig } from "./types";
|
||||
import { CasesPluginType, zCasesConfig } from "./types";
|
||||
|
||||
// The `any` cast here is to prevent TypeScript from locking up from the circular dependency
|
||||
function getLogsPlugin(): Promise<any> {
|
||||
|
@ -40,36 +38,17 @@ export const CasesPlugin = guildPlugin<CasesPluginType>()({
|
|||
configParser: (input) => zCasesConfig.parse(input),
|
||||
defaultOptions,
|
||||
|
||||
public: {
|
||||
createCase(pluginData) {
|
||||
return (args: CaseArgs) => {
|
||||
return createCase(pluginData, args);
|
||||
};
|
||||
},
|
||||
|
||||
createCaseNote(pluginData) {
|
||||
return (args: CaseNoteArgs) => {
|
||||
return createCaseNote(pluginData, args);
|
||||
};
|
||||
},
|
||||
|
||||
postCaseToCaseLogChannel(pluginData) {
|
||||
return (caseOrCaseId: Case | number) => {
|
||||
return postCaseToCaseLogChannel(pluginData, caseOrCaseId);
|
||||
};
|
||||
},
|
||||
|
||||
getCaseTypeAmountForUserId(pluginData) {
|
||||
return (userID: string, type: CaseTypes) => {
|
||||
return getCaseTypeAmountForUserId(pluginData, userID, type);
|
||||
};
|
||||
},
|
||||
|
||||
getTotalCasesByMod: mapToPublicFn(getTotalCasesByMod),
|
||||
getRecentCasesByMod: mapToPublicFn(getRecentCasesByMod),
|
||||
|
||||
getCaseEmbed: mapToPublicFn(getCaseEmbed),
|
||||
getCaseSummary: mapToPublicFn(getCaseSummary),
|
||||
public(pluginData) {
|
||||
return {
|
||||
createCase: makePublicFn(pluginData, createCase),
|
||||
createCaseNote: makePublicFn(pluginData, createCaseNote),
|
||||
postCaseToCaseLogChannel: makePublicFn(pluginData, postCaseToCaseLogChannel),
|
||||
getCaseTypeAmountForUserId: makePublicFn(pluginData, getCaseTypeAmountForUserId),
|
||||
getTotalCasesByMod: makePublicFn(pluginData, getTotalCasesByMod),
|
||||
getRecentCasesByMod: makePublicFn(pluginData, getRecentCasesByMod),
|
||||
getCaseEmbed: makePublicFn(pluginData, getCaseEmbed),
|
||||
getCaseSummary: makePublicFn(pluginData, getCaseSummary),
|
||||
};
|
||||
},
|
||||
|
||||
afterLoad(pluginData) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue