3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-17 15:15:02 +00:00

WIP ModActions

This commit is contained in:
Dragory 2020-07-23 00:37:33 +03:00
parent a3d0ec03d9
commit ebcb28261b
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
25 changed files with 1162 additions and 6 deletions

View file

@ -0,0 +1,22 @@
import { PluginData } from "knub";
import { CasesPluginType } from "../types";
import { CaseTypes } from "../../../data/CaseTypes";
export async function getCaseTypeAmountForUserId(
pluginData: PluginData<CasesPluginType>,
userID: string,
type: CaseTypes,
): Promise<number> {
const cases = (await pluginData.state.cases.getByUserId(userID)).filter(c => !c.is_hidden);
let typeAmount = 0;
if (cases.length > 0) {
cases.forEach(singleCase => {
if (singleCase.type === type.valueOf()) {
typeAmount++;
}
});
}
return typeAmount;
}