Skip to content

Member Attributes ​

Member Attributes is a data storage used to store any information related to a specific member.

They are represented by getAttribute method and attributes property of Member data type.

WARNING

You can only access 5 attributes in single message template.

Active Bonus on the server increases this limit up to 10 attributes.

Saving Data ​

In order to save any data into attributes, you should use update method:


JuniperBot Template
{% do member.getAttribute('example').update('Hello World!') %}

You can increment or decrement attribute's number value by specified amount using increment and decrement methods:


Incrementing value:

JuniperBot Template
{% do member.getAttribute('example').increment(1) %}

Decrementing value:

JuniperBot Template
{% do member.getAttribute('example').decrement(1) %}

INFO

If you want to store data that isn't tied to a specific member, you can use the bot's own attributes. They can be accessed through the predefined bot variable instead of member.

Accessing Data ​

Attributes are stored indefinitely and can be accessed as follows:


JuniperBot Template
{{ member.getAttribute('example').value }}

Clearing Data ​

In order to clear attribute use clear method:


JuniperBot Template
{% do member.getAttribute('example').clear() %}

You can also clear attributes with specified key for all members on the server using clearAttributes method of Guild data type:

JuniperBot Template
{% do guild.clearAttributes('example') %}

If you want to clear every single attribute from the server, use clearAllAttributes method of Guild data type:

JuniperBot Template
{% do guild.clearAttributes() %}

All rights sniffed.