3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-23 09:35:02 +00:00
This commit is contained in:
metal 2021-09-06 14:43:10 +00:00 committed by GitHub
parent 43e42ba7c7
commit 45c16ea48f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View file

@ -69,7 +69,6 @@ export const TagsPlugin = zeppelinGuildPlugin<TagsPluginType>()({
You can use these functions to render dynamic content, or to access information from the message and/or user calling the tag.
You use them by adding a \`{}\` on your tag.
### Available Functions
Here are the functions you can use in your tags:
${generateTemplateMarkdown(TemplateFunctions)}

View file

@ -1,11 +1,17 @@
import { trimPluginDescription } from "src/utils";
import { TemplateFunction } from "./types";
export function generateTemplateMarkdown(definitions: TemplateFunction[]): string {
return definitions
.map(def => {
const usage = def.signature ?? `(${def.arguments.join(", ")})`;
const exampl = def.examples ? def.examples.map(ex => `> ${ex}`).join("\n") : "";
return `#### ${def.name}\n\`{${def.name}${usage}}\`\n**${def.description}**\n${exampl}`;
const exampl = def.examples ? def.examples.map(ex => `> \`{${ex}}\``).join("\n") : null;
return trimPluginDescription(`
## ${def.name}
**${def.description}**\n
__Usage__: \`{${def.name}${usage}}\`\n
${exampl ? `__Examples__:\n${exampl}` : ""}\n\n
`);
})
.join("\n\n");
}