Asagi
  • Home
  • Guides
    • How to use the Asagi bot?
    • Configuring Bot Features
      • Interactive Messages
      • Moderation
      • Love Rooms
    • JSON Builder in the Asagi bot
    • Verification
    • Prices and Features of Asagi Premium
  • Other
    • Message Templates
      • Color Names
      • Variables
      • Mentions and Custom Emojis
      • Timestamps
Powered by GitBook
On this page
  • User
  • Member
  • Guild
  • Roles
  • Timestamp
  • Color
  • Handling Conditional Expressions with || and ? Operators

Was this helpful?

  1. Other
  2. Message Templates

Variables

User

Variable
Description

{{ user.id }}

The unique identifier of the user

{{ user.username }}

The username of the user

{{ user.mention }}

A mention of the user, which can be used to notify them in a message

{{ user.avatarUrl }}

The URL of the user's avatar

{{ user.bannerColor }}

The color of the user's banner

{{ user.globalName }}

The global name of the user

These variables can be used in the following modules: Automatic Moderation, Interactive Messages, Love Rooms, Notifications, Private Rooms.

For Love Rooms, use user1 and user2 variables.

Member

Variable
Description

{{ member.nickname }}

The nickname of the member on the server

{{ member.displayName }}

The display name of the member, which is their nickname if they have one, or their username otherwise

{{ member.serverAvatarUrl }}

The URL of the member's server avatar

{{ member.roles.highest.name }}

The name of the member's highest role on the server

These variables can be used in the following modules: Automatic Moderation, Interactive Messages, Love Rooms, Notifications, Private Rooms.

For Love Rooms, use member1 and member2 variables.

Guild

Variable
Description

{{ guild.id }}

The unique identifier of the server

{{ guild.name }}

The name of the server

{{ guild.iconUrl }}

The URL of the server's icon

{{ guild.bannerUrl }}

The URL of the server's banner

{{ guild.memberCount }}

The number of the members on the server

{{ guild.nameAcronym }}

The abbreviated form of the server's name

{{ guild.boostsCount }}

The number of server boosts

These variables can be used in the following modules: Automatic Moderation, Interactive Messages, Love Rooms, Notifications, Private Rooms, Starboard.

Roles

Variable
Description

{{ roles.added }}

The roles that were added to the member

{{ roles.removed }}

The roles that were removed from the member

These variables can be used only in the Interactive Messages module!

Timestamp

Variable
Description

{{ timestamp.now }}

The current Unix timestamp

{{ timestamp.userCreatedAt }}

The Unix timestamp for the date and time when the user's account was created

{{ timestamp.memberJoinedAt }}

The Unix timestamp for the date and time when the member joined the server

{{ timestamp.guildCreatedAt }}

The Unix timestamp for the date and time when the server was created

These variables can be used in the following modules: Automatic Moderation, Interactive Messages, Notifications.

Color

Variable
Description

{{ color.default }}

The default color of the embed, set in the bot's configuration for system messages

{{ color.embed }}

The color of the embed, taken from the bot settings

{{ color.error }}

The error color of the embed, set in the bot's configuration for error messages

These variables can be used in the following modules: Automatic Moderation, Interactive Messages, Notifications, Starboard.

Handling Conditional Expressions with || and ? Operators

  • ||: This operator is used to handle expressions of the form {{ identifier || 'default' }}. If identifier is defined and not null, it is replaced with the corresponding value. If identifier is undefined or null, it is replaced with 'default'.

  • ?: This operator is used to handle ternary expressions of the form {{ identifier ? 'value if true' : 'value if false' }}. If identifier is defined and not null, it is replaced with 'value if true'. If identifier is undefined or null, it is replaced with 'value if false'.

  1. {{ roles.added || 'No roles have been added.' }}

  1. {{ roles.added ? 'New roles have been added: {{ roles.added }}' : 'No roles have been added.' }}

  1. {{ roles.added ? 'Role has been added: {{ roles.added }}' : '' }}{{ roles.removed ? 'Role has been removed: {{ roles.removed }}' : '' }}

Note: You can use both single ' and double quotes " for strings in these expressions. Additionally, it is possible to include variables inside these conditional expressions.

Last updated 7 months ago

Was this helpful?