$setUserVar
Set the value of the provided user variable in the guild the command is executed in. This variable is not global and the value can only be set for the user in the server the command is executed in.

FUNCTION USAGE

  • $setUserVar[varName;newValue]
  • $setUserVar[varName;newValue;userID]

Properties:

varName - The variable being called in the command. newValue - New value of the user variable. userID - The user ID attached to the variable (You can omit this field or leave blank to set the command authors variable value).
If no user ID is defined in the 3rd field, bot will set the command authors variable value.

Example 1: Setting the command authors bank balance (economy)

1
bot.Command({
2
name: "set-mine",
3
code:`
4
__You just set your bank balance to 500 dollars__
5
$setUserVar[bank;500]
6
`})
Copied!

Example 2: Setting another users bank balance using the 3rd field (economy)

1
bot.Command({
2
name: "set-user",
3
code:`
4
__You just set <@$mentioned[1]> bank balance to 500 dollars__
5
$setUserVar[bank;500;$mentioned[1]]
6
`})
Copied!

Example 3: Adding to the command authors balance (economy)

1
bot.Command({
2
name: "work",
3
code:`
4
__You just gained 500 dollars__
5
$setUserVar[bank;$sum[$getUserVar[bank];500]]
6
`})
Copied!

Example 4: Adding to someone else's balance using the 3rd field (economy).

1
bot.Command({
2
name: "give",
3
code:`
4
__You just gave 500 dollars to $username[$mentioned[1]]__
5
$setUserVar[bank;$sum[$getUserVar[bank];500];$mentioned[1]]
6
$setUserVar[bank;$sub[$getUserVar[bank];500]]
7
`})
Copied!
Last modified 11mo ago
Copy link
Contents
Properties: