User Variables

Manager User Variables

If a variable is already created but hasn't been set for a specific user, when you use the getuservar endpoint, it'll grab the default value that you had set

User Variable Endpoints

Get the value of a specific users variable variable

GET https://www.charm-cord.com/database/getuservar/<userid>

Path Parameters

NameTypeDescription

userid*

Integer

The ID of the users you want grab the variable for

Query Parameters

NameTypeDescription

key*

String

Your authorization key that you recieved the first time you made a variable

variable*

String

The name of the variable

{
    "value": "String"
}

Set the value of a specific users variable variable

POST https://www.charm-cord.com/database/setuservar/<userid>

Path Parameters

NameTypeDescription

userid*

Integer

The ID of the users you want grab the variable for

Query Parameters

NameTypeDescription

key*

String

Your authorization key that you recieved the first time you made a variable

variable*

String

The name of the variable

value*

Any

The value for the user's variable

{
    "value": "Successfully updated a variable"
}

BotGhost Example

Retrieving a user variable

The Api reqest in the /money command is seen as below.

Setting a user variable

Below is the very simple command used to give a user more money

The first 2 api blocks will not be shown due to irrelevance but the requests were to:

  1. Retrieve the Original value for the variable

  2. Use CharmCord's math tool to add the given amount the old value

The final api block is used to send the new value to the database as shown below.

The Final Output

Last updated