Adding an "enabled" attribute to templates

This commit is contained in:
Zef Hemel
2024-01-11 14:06:24 +01:00
parent 154d9a8ce9
commit 509ece91f0
9 changed files with 43 additions and 11 deletions
+5 -2
View File
@@ -51,8 +51,11 @@ export async function templateSlashComplete(
completeEvent: CompleteEvent,
): Promise<SlashCompletion[]> {
const allTemplates = await queryObjects<TemplateObject>("template", {
// Only return templates that have a trigger
filter: ["attr", "trigger"],
// Only return templates that have a trigger and are not expliclty disabled
filter: ["and", ["attr", "trigger"], ["!=", ["attr", "enabled"], [
"boolean",
false,
]]],
});
return allTemplates.map((template) => ({
label: template.trigger!,