Developer
Settings

Settings

In this part, we will add our environmental variables and TypeScript configurations!

Setting up tsconfig.json

Now we have to set up the TypeScript configuration for compiling our TypeScript code into JavaScript!

tsconfig.json
{
  "compilerOptions": {
    "target": "es2017",
    "module": "commonjs",
    "strict": true,
    "resolveJsonModule": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true,
    "outDir": "./dist",
    "rootDir": "./src",
    "sourceMap": true,
    "declaration": true,
    "declarationDir": "./types"
  },
  "include": ["src/**/*"],
  "exclude": ["node_modules", "dist"]
}

You can add more compiler options from here (opens in a new tab)

Setting up .env

Now, this part is very crucial. Here we will set up our environmental variables, such as the app ID, client ID, etc.

🚫

Never include your .env variables to public, Make sure you have put this on your git ignore file.

So here is the setup needed for our Discord app project!

Fisrt install dotenv

npm i dotenv

Then add an .env file out of your src directory!

.env
   AUTH_TOKEN=YOUR-DISCORD-BOT-TOKEN
   CLIENT_ID=YOUR-DISCORD-BOT-ID
   DEVELOPER_IDS=YOUR-DISCORD-ID
   SERVER_ID=YOUR-DEV-SERVER-ID
   ERROR_CHANNEL_ID=YOUR-ERROR-CHANNEL-ID

Okay, now our basic configuration setup is done!