Embed Builder
With LoggerBot Premium, you can customise every log embed to how you like it! However, customising it can be easy, but the snippets make be a little complicated at first.
If Statements
If statements can not be nested inside each other.
You must use '
to declare a string in the if statements. You can use ^^
to display a ' in your text. You may use snippets within your truthy/falsy strings.
In order to ensure maximum customizability for our premium servers, we have added the capability of introducing "if" like statements which follows a similar syntax to JavaScript ternary operators..
If statements are declared by using {{{
at the start, and }}}
at the end. Here's an example:
{{{ if (condition) ? 'This will be shown if true' : 'This will be shown if false' }}}
If statements will only return a value and not perform any sort of action. For example, as used in default embeds, when a regular text channel is created, the embed will say "Text channel", however if a category is created, the embed will only say "Category". This is achieved by the following;
{{{ if (channel.type == 'Category') ? 'Category' : '{{channel.type}} channel' }}}
Another example, when a role is created, we use if statements in the embed builder to check whether it was a user who had created a role, or if Discord created the role (examples are bot roles, nitro booster role, other integrated roles). Without checking for this, your embed will return "null" because there would not be any moderator creating a role made by Discord.
{{{ if (role.managed) ? 'Discord' : '{{moderator.name}}' }}}
If you would not like to return a value from your if statement, like in some of the default embeds, then you can simply leave the string empty ''
.
For a bigger oversight for the generic idea of LoggerBot's if statements, you can read this JavaScript documentation of ternary operators, as it's the same concept.
Snippets
Snippets serve as dynamic variable, adapting to changing values. They're used to display values variables that are unknown in advance.
For example, when a channel is created, using the snippet {{channel.name}}
allows you to display the name of the newly created channel. This snippet dynamically adjusts, getting replaced by LoggerBot when it logs the channel creation, with the corresponding name.
Last updated