UserUpdateCommand
An event that fires when a user updates their account(like carl bots user update logs). Placeholders can be used to return the old and new data.

This event will be fired when the bot sees any changes made to any of the following attributes:

  • avatar
  • username
  • discriminator

See the examples below on how to limit the command from being fired on every event.

This event uses gateway privileges. Be sure to have your intents enabled before attempting to use this event. Otherwise, you'll receive no output.

Placeholders: 10

  1. 1.
    {oldname} - old username before the update
  2. 2.
    {newname} - new username now
  3. 3.
    {olddiscrim} - old discriminator before the update
  4. 4.
    {newdiscrim} - new discriminator now
  5. 5.
    {oldavatar} - old avatar before the update
  6. 6.
    {newavatar} - new avatar now
  7. 7.
    {tag} - The users tag
  8. 8.
    {id} - The users ID
  9. 9.
    {mention} - The users discord mention
  10. 10.
    {isbot} - true if the user is a bot

Example 1: The event placed in the main file.

1
bot.UserUpdateCommand({
2
name: "$getServerVar[channel]",
3
description: "username update event",
4
code:`
5
{mention} updated their username!
6
$title[User - {tag}]
7
$color[$getVar[color]]
8
$thumbnail[$userAvatar[{id}]]
9
$description[
10
old - {oldname}
11
new - {newname}
12
]
13
14
$onlyIf[$checkCondition[{olddiscrim}!={newdiscrim}]==true;]
15
$onlyIf[$checkCondition[{oldavatar}!={newavatar}]==true;]
16
`
17
})
18
bot.onUserUpdate()
Copied!

Example 2: The event placed in the event handler (its own file)

bot.onUserUpdate() - Goes in the main file to be able to call the event!
1
module.exports.UserUpdateCommand = ({
2
name: "$getServerVar[channel]",
3
description: "username update event",
4
code:`
5
{mention} updated their username!
6
$title[User - {tag}]
7
$color[$getVar[color]]
8
$thumbnail[$userAvatar[{id}]]
9
$description[
10
old - {oldname}
11
new - {newname}
12
]
13
14
$onlyIf[$checkCondition[{olddiscrim}!={newdiscrim}]==true;]
15
$onlyIf[$checkCondition[{oldavatar}!={newavatar}]==true;]
16
`
17
})
Copied!
Last modified 5mo ago
Copy link