From 2734172d27f070906179589bafb7148e5731983c Mon Sep 17 00:00:00 2001 From: metal Date: Mon, 6 Sep 2021 12:56:00 +0000 Subject: [PATCH] initial --- backend/src/plugins/Tags/docs.ts | 0 backend/src/plugins/Tags/templateFunctions.ts | 81 +++++++++++++++++++ backend/src/plugins/Tags/types.ts | 9 +++ 3 files changed, 90 insertions(+) create mode 100644 backend/src/plugins/Tags/docs.ts create mode 100644 backend/src/plugins/Tags/templateFunctions.ts diff --git a/backend/src/plugins/Tags/docs.ts b/backend/src/plugins/Tags/docs.ts new file mode 100644 index 00000000..e69de29b diff --git a/backend/src/plugins/Tags/templateFunctions.ts b/backend/src/plugins/Tags/templateFunctions.ts new file mode 100644 index 00000000..ac113501 --- /dev/null +++ b/backend/src/plugins/Tags/templateFunctions.ts @@ -0,0 +1,81 @@ +import { TemplateFunction } from "./types"; + +export const functions: TemplateFunction[] = [ + { + name: "info", + description: "Checks if a condition is true or false and returns the corresponding ifTrue or ifFalse", + returnValue: "boolean", + arguments: ["condition", "ifTrue", "ifFalse"], + examples: ['if(user.bot, "User is a bot", "User is not a bot")'], + }, + { + name: "and", + description: "Checks if all provided conditions are true", + returnValue: "boolean", + arguments: ["condition1", "condition2", "..."], + examples: ["and(user.bot, user.verified)"], + }, + { + name: "or", + description: "Checks if atleast one of the provided conditions is true", + returnValue: "boolean", + arguments: ["condition1", "condition2", "..."], + examples: ["or(user.bot, user.verified)"], + }, + { + name: "not", + description: "Checks if the provided condition is false", + returnValue: "boolean", + arguments: ["condition"], + examples: ["not(user.bot)"], + }, + { + name: "concat", + description: "Concatenates several arguments into a string", + returnValue: "string", + arguments: ["argument1", "argument2", "..."], + examples: ['concat("Hello ", user.username, "!")'], + }, + { + name: "concatArr", + description: "Joins a array with the provided separator", + returnValue: "string", + arguments: ["array", "separator"], + examples: ['concatArr(["Hello", "World"], " ")'], + }, + { + name: "eq", + description: "Checks if all provided arguments are equal to each other", + returnValue: "boolean", + arguments: ["argument1", "argument2", "..."], + examples: ['eq(user.id, "106391128718245888")'], + }, + { + name: "gt", + description: "Checks if the first argument is greater than the second", + returnValue: "boolean", + arguments: ["argument1", "argument2"], + examples: ["gt(5, 2)"], + }, + { + name: "gte", + description: "Checks if the first argument is greater or equal to the second", + returnValue: "boolean", + arguments: ["argument1", "argument2"], + examples: ["gte(2, 2)"], + }, + { + name: "lt", + description: "Checks if the first argument is smaller than the second", + returnValue: "boolean", + arguments: ["argument1", "argument2"], + examples: ["lt(2, 5)"], + }, + { + name: "lte", + description: "Checks if the first argument is smaller or equal to the second", + returnValue: "boolean", + arguments: ["argument1", "argument2"], + examples: ["lte(2, 2)"], + }, +]; diff --git a/backend/src/plugins/Tags/types.ts b/backend/src/plugins/Tags/types.ts index 71247dec..87d5ec9c 100644 --- a/backend/src/plugins/Tags/types.ts +++ b/backend/src/plugins/Tags/types.ts @@ -60,5 +60,14 @@ export interface TagsPluginType extends BasePluginType { }; } +export interface TemplateFunction { + name: string; + description: string; + arguments: string[]; + returnValue: string; + signature?: string; + examples?: string[]; +} + export const tagsCmd = typedGuildCommand(); export const tagsEvt = typedGuildEventListener();