Variables
Variables are storage of values that can be used in systems such as economy, or just overall setting values to store for a later purpose.

There are 6 kinds of variables:

  1. 1.
    User vars = Information saved to users in the server.
  2. 2.
    Global vars = Information saved in all servers your bot is in.
  3. 3.
    Global user vars = Information saved to users to be recovered in any server the bot is in .
  4. 4.
    Channel vars = Information saved to channels in the server.
  5. 5.
    Server vars = Information saved to the server.
  6. 6.
    Message vars - Information saved to a message.

Think of these as master reset functions. More info can be found under this category or by clicking the associated hyperlinks below:

  1. 2.
    $resetMessageVar
  2. 5.
    $resetVar
User variables
Global variables
Channel variables
Server variables
Message Variables
Storing the variables
Variables list
User variables are stored and seen on users in the current server

Setting the value of user variables:

This will set the variable value of the command author.
This will set the variable value of the user with the ID supplied in the 3rd field.

Getting the value of user variables:

This will get the variable value of the command author
This will get the variable value of the user with the ID supplied in the 2nd field
Global variables are stored and is seen throughout every server the bot is in!
$getVar can be used in bot.Status 😀

Setting the value of global variables:

This will set the new global variable value and is assigned to the user with the ID supplied in the 3rd field.
This will set the new value of the global variable to the desired value in the 2nd field and is assigned to that entire variable

Getting the value of global variables:

This will get the global variable value of the user with the ID supplied in the 2nd field.
This will get the value of the global variable itself.
Channel variables are stored and seen on channels in the current server

Setting the value of channel variables:

This will set the new value to the current channel.
This will set the new value of the specified channel with the channelID supplied in the 3rd field.

Getting the value of channel variables:

This will get the variable value of the current channel.
This will get the variable value of the specified channel with the channelID supplied in the 2nd field.
Server variables are stored and seen on the entire server

Setting the value of server variables:

This will set the value of the server variable to the desired value in the 2nd field.

Getting the value of server variables:

This will get the value of the server variable
Message variables are stored and seen in the server and on the message where the value was created.

Setting the value of message variables:

This will set the new value to the command message.
This will set the new value of a specified message with the messageID supplied in the 3rd field.

Getting the value of message variables:

This will get the variable value of the command message.
This will get the variable value of the specified message with the messageID supplied in the 2nd field.

Add this exampled format to your main file. This is your storage for all of your variables and you can add as many as you like!

Note: Be sure to add a comma , after each value as displayed below! The very last variable in the list does not need a comma ,
1
bot.Variables({
2
prefix: "!",
3
turtle: "animal",
4
apple: "food"
5
})
Copied!

User variables:

1
$getUserVar[variable]
2
$getUserVar[variable;userID]
3
$setUserVar[variable;value]
4
$setUserVar[variable;value;userID]
Copied!

Global variables:

1
$getVar[variable]
2
$getVar[variable;userID]
3
$setVar[variable;value]
4
$setVar[variable;value;userID]
Copied!

Channel variables:

1
$getChannelVar[variable]
2
$getChannelVar[variable;channelID]
3
$setChannelVar[variable;value]
4
$setChannelVar[variable;value;channelID]
Copied!

Server variables:

1
$getServerVar[variable]
2
$setServerVar[variable;value]
Copied!
Last modified 8mo ago