Skip to main content
Imagine a box with a name written on it. You can put something in the box, look inside it later, or swap what’s inside. That’s a variable. Your bot uses variables to remember things. Without them, your bot forgets everything the moment a command finishes. It can say “Hello!”, but it can never say “Hello, you have 250 coins!” because it does not remember any coins.

Some examples

Your bot can read a box (to show it in a message), change a box (to give someone more coins) and check a box (to see if someone has enough coins to buy something).

Three kinds of variables

DogeBot has three kinds. They all use curly brackets, like {this}.
1

Built-in variables

Ready-made. You don’t make these, they’re always there. For example {user_name} is the name of the person who used the command, and {server} is the server name.See Built-in variables.
2

Your own variables (custom variables)

You make these yourself, and the bot remembers them forever, even when it restarts. They always start with DBVAR_, like {DBVAR_coins}.See Make a variable.
3

Short-lived values

Some blocks make a value that only lasts while the command is running. For example a command input called amount gives you {option_amount}, and a Temporary value block gives you {whatever-you-named-it}. When the command ends, they’re gone.See Short-lived values.

How the bot uses them

When your bot runs a block, it first looks for anything in curly brackets and swaps it for what’s in the box. So this:
turns into this in Discord:
See {something} in Discord, with the brackets still there? The bot couldn’t find that variable. Usually it’s a spelling mistake. Check the name carefully, capital letters matter. See Find and fix variable problems.

What next?

Make a variable

Step by step.

Use variables in blocks

Save, add, take away and show them.

Lists and objects

Shops, backpacks and settings.

Daily coins

A full example that uses variables.