Skip to content

Shared Templates

Shared Templates guide for advanced users


Bonus Feature

This feature is only available for servers with bonus!

How it is useful?#

Shared Templates are utility message templates that you can use to write a reusable template code. It can be executed by other message templates.

Shared Templates can be created and configured at the server's dashboard in the tab called "Commands".


Example#

For example, you have an identical macro in many custom commands. You can move that macro into a single Shared Template:

  1. Go to server's dashboard, navigate to Shared Templates page and click "Add new template" button;

  2. Enter template name (remember it), description and the definition of your macro into template field;

  3. Save template.

  4. In every custom command where this macro is used, fully replace macro definition with include tag:

    {% include 'name' %}
    
    Replace name with the name of template you specified earlier.

This way, moving marco into Shared Template will let you edit it in one single place instead of doing that for your every custom command where you need this macro.


Recommendations#

Make Shared Templates short and simple, keep only needed code and optimize it nicely.

For example, you shouldn't create a single "master-template" with complete collection of your macros that you use for your commands. Every macro that is defined in shared template but not used in specific command, will still take time to compile and execute, increasing the response time for this command.


Limitations#

Limitations

Shared Templates have some limitations:

  1. Up to 5 includes per command execution;

  2. A single template can be included only once;