Updated Warn Threshold to work with latest release

This commit is contained in:
Dark 2020-01-28 23:17:09 +01:00
parent 77e5f429c5
commit 0ee942728c
2 changed files with 54 additions and 10 deletions

View file

@ -244,6 +244,21 @@ export class CasesPlugin extends ZeppelinPlugin<TConfigSchema> {
return { embed };
}
public async getCaseTypeAmountForUserId(userID: string, type: CaseTypes): Promise<number> {
const cases = (await this.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;
}
/**
* A helper for posting to the case log channel.
* Returns silently if the case log channel isn't specified or is invalid.