Skip to main content
OrynCloud Logo
OrynCloudDOCS
Discord & Bot Hostingpteroext-bot-env-manager v1.1.4

Environment Variables & Token Security

Store Discord bot tokens, MongoDB URIs, and API secret keys securely with our visual key-value manager featuring automatic credential masking.

1. Why Hardcoding Tokens Causes Security Leaks

Placing your bot token directly inside your code (e.g., client.login("MTE0O...")) leads to disastrous security breaches if you push code to GitHub or share screenshots in Discord. Discord actively scans public repos and immediately invalidates leaked tokens, crashing your bot.

2. Using the Visual .env Manager

  1. In panel.oryncloud.com, open your bot server and click Environment (.env).
  2. Click Add Variable.
  3. Key: DISCORD_TOKEN | Value: paste your token.
  4. Notice the eye toggle icon. Values are masked by default as •••••••••••• to prevent accidental exposure during live streams or screenshots.
  5. Click Save Environment.

3. Reading .env in Node.js & Python

Node.js Example
// Node.js (index.js)
require('dotenv').config();
const { Client } = require('discord.js');
const client = new Client({ intents: [] });

client.login(process.env.DISCORD_TOKEN);
Python Example
# Python (main.py)
import os
from dotenv import load_dotenv
import discord

load_dotenv()
TOKEN = os.getenv('DISCORD_TOKEN')

client = discord.Client(intents=discord.Intents.default())
client.run(TOKEN)

4. What to Do if Your Token is Compromised

If you suspect a token leak, immediately visit the Discord Developer Portal, click Reset Token, update your value in the Environment Manager, and restart your server.

Was this documentation page helpful?