Entity Info
authorUsername
$authorUsername
The variable $authorUsername returns the username (account name) of the author who triggered the command.
Syntax
$authorUsername
Return value
- Type: Character string
- The username of the author, read from the command context (
author.username, oruser.usernameif absent) - An empty string if the context holds neither
Behavior
$authorUsernametakes no arguments (passing one is an error).- It is the account username, not the server nickname. No request is made to Discord.
$usernamereads the same two context values in the opposite order (user.username, thenauthor.username) when called without argument, and accepts an optional user ID.
Examples
Message from the author
$title[Command executed]
$author[$authorUsername;$authorAvatar]
$description[
**Author:** $authorUsername#$discriminator[$authorID]
**ID:** $authorID
]
$color[#5865F2]
Notes
- To get the server nickname of the author, use
$nickname;$displayNamegives the global display name of a user. $authorUsernameis useful for explicitly referencing the author of the message in logs or embeds.- In most cases,
$usernameand$authorUsernameare interchangeable.
Try it
Paste an example into the playground to preview its message (functions that act on Discord are not run), or build the same thing with blocks.