Add support for hiding cases with !hidecase

This commit is contained in:
Dragory 2019-01-13 17:56:14 +02:00
parent ab71481b8f
commit 8de31844d5
6 changed files with 105 additions and 13 deletions

View file

@ -19,7 +19,7 @@ const CLEAN_COMMAND_DELETE_DELAY = 5000;
const activeReloads: Map<string, TextChannel> = new Map();
export class UtilityPlugin extends ZeppelinPlugin {
public static pluginName = 'utility';
public static pluginName = "utility";
protected logs: GuildLogs;
protected cases: GuildCases;
@ -292,9 +292,12 @@ export class UtilityPlugin extends ZeppelinPlugin {
return a.created_at < b.created_at ? 1 : -1;
});
const caseSummary = cases.slice(0, 3).map(c => {
return `${CaseTypes[c.type]} (#${c.case_number})`;
});
const caseSummary = cases
.filter(c => !c.is_hidden)
.slice(0, 3)
.map(c => {
return `${CaseTypes[c.type]} (#${c.case_number})`;
});
const summaryText = cases.length > 3 ? "Last 3 cases" : "Summary";