As we've seen, we're able to assign values to names with the {% assign %}
and {% capture %}
blocks. Those are called variables.
You can create new variables, or use those that come bundled with the command system.
Throughout this file, we'll use the "type" term. The type of a variable is simply whether its value is a number, a boolean, a string, etc...
The types are:
string
Simply text
number
A number, whether it be an integer (1, 7, 42) or floating-point (1.2, 3.14, 8.8888).
boolean
Either true
or false
.
object
A more complex type that includes more data within, that you can access with dot notation (object.property
).
array<type>
A list of values, all with the type inside the angle brackets <>
. To access an element inside you can use array[index]
. The index is always a number. You can also use array.length
to get the count of elements.
map<type, type>
A group of values that you can reference by a key. The key and value's types are indicated within the angle brackets <>
: the key's is the first and the value's is the last. To access an element inside it you can use map[key]
.
null
, undefined
: They both represent something that doesn't exist or isn't defined. They're both types and values.
any
: Can be any of the other types.
Properties:
name
: The name of the role. (string
)
id
: The ID of the role. (string
)
color
: The color of the role, as a base-10 number. (number
)
managed
: Whether this role is managed by an integration (ie. a bot) or not. (boolean
)
hoist
: Whether members of this role are shown separately from online users. (boolean
)
createdAt
: Timestamp of the role's creation. (number
)
mention
: The mention of the role (basically <@&ROLE_ID>
). (string
)
Properties:
name
: The name of the channel
topic
: The topic of the channel
position
: The position of the channel as it's received from the API
parentID
: The ID of the category (or null
if the channel's an orphan or if it's a category itself).
The arguments as they were passed to the command.
Type: string
Example: If the command were called like pl.command 12 3 a bc
, it would be 12 3 a bc
.
All the roles in the server.
Type: map<string, Role>
A list of roles mapped by ID
Example: Prints every role of a user:
{% for role in author.roles %}{{ roles[role].mention }}{% endfor %}