$setVar
Set the value of the global variable. You can provide a user ID in the 3rd field to set the global variable value of the specific user. This variable can be seen in every guild the bot is in!

FUNCTION USAGE

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

Properties:

varName - The variable being called in the command. newValue - New value of the global variable. userID - The user ID attached to the global variable. (You can omit this field or leave blank to get the global variable value).
This function can be used to manipulate values of $getVar in bot.Status as of package version 1.8.4

Example 1: Setting the global variable value. This value can be seen in every server the bot is in

1
bot.Command({
2
name: "set",
3
code:`
4
__Set the new total messages sent to $message[]__
5
$numberSeparator[$setVar[Messages;$message[]];,]
6
`})
Copied!

Example 2: Setting another users global variable value. This value can be seen in every server the bot is in

1
bot.Command({
2
name: "set",
3
code:`
4
__Set $username[$mentioned[1]]'s message counter to $message[]__
5
6
$numberSeparator[$setVar[Messages;$message[];$mentioned[1]];,]
7
$onlyIf[$userExists[$mentioned[1]];That user doesn't exist!]
8
`})
Copied!
Last modified 4mo ago
Copy link
Contents
Properties: