Folder Structures
How to properly setup file structure and environment variables.
Before we start, this tutorial assumes you know how to create an application on the Discord Developer Portal. If you do not, please visit and read this tutorial by Discord to learn how to do so.
The first thing we are going is setup file structures and define our token variable. For this, we will be using a .json file.
Setting up File Structure
The first thing we will be doing is creating a source file to store all of our bot commands, events, and more.
Now create this folder and name is source, as stated here.
Environment Variables
Now inside your ROOT directory (not the source folder you just created), create a file and name it default.json
Just that, nothing else.
And now inside the default.json file, you want to add an entree called token. This is where you will store your bot token
The line should look as follows:
{
"token": "Paste Token Here"
}Remember to keep your token PRIVATE. If you plan on pushing your project to GitHub, remember to create a .gitignore file and adddefault.jsonto stop it from leaking your bot token.
Obviously replacing the "Paste Token Here" with the actual token of your bot.
Save this file and continue following the tutorial.
Main FileLast updated