Nexus
Discord
  • 📗Getting Started
    • Nexus Website
  • 👥Contributors
  • 🤝Code of Conduct
  • 🚨License
  • 📔Contributing
  • git
    • 🍎Installing Git on MacOS
    • 🪟Installing Git on Windows
    • 🐧Installing Git on Linux
    • 🛠️Git Guide
  • Building the Bot
    • Before you begin
    • First Steps
    • The .env file
    • Custom Bot Functions
  • Commands
    • Creating Commands
    • Creating User Installed Commands
    • Creating Developer Commands
    • Developer Guild Commands
    • Autocomplete
  • Client Modifications
    • client.m
  • handler
    • Handling Discord Events
    • Handling Components
  • Scripts
    • Our customs scripts
    • package.json
    • cleardb
    • db
    • client
    • fetch
    • reset
  • Database
    • MongoDB Connection
    • MongoDB Schemas
  • Resources
    • Privacy Policy
    • Terms of Service
    • NodeJS Download
    • Discord.js
    • Discord.js v14 Guide
    • Discord.js v14 Docs
  • Code Editors
    • Finding your best Code editor
    • Visual Studio IDE Download
    • Visual Studio Code Download
    • VS Code Insiders Download
    • Jetbrains WebStorm Download
    • Jetbrains Fleet Download
    • Jetbrains Aqua Download
Powered by GitBook
On this page
  • THE FILE WILL BE CREATED AUTOMATICALLY BY THE FIRST START OF THE BOT! DO NOT CREATE IT BY YOURSELF!
  • The variables described:
  1. Building the Bot

The .env file

THE FILE WILL BE CREATED AUTOMATICALLY BY THE FIRST START OF THE BOT! DO NOT CREATE IT BY YOURSELF!

Benefits of Using .env Files

Using a .env file in the development of Discord bots offers several key advantages:

  1. Security:

    • Keeps sensitive information like bot tokens, database passwords, and API keys out of the main codebase.

    • Reduces the risk of accidentally sharing sensitive information when publishing or sharing your code.

    • Essential for preventing unauthorized access and maintaining the integrity of your bot.

  2. Configuration Management:

    • Allows for easy management and switching between different configurations without code changes.

    • Facilitates separate configurations for different environments (e.g., development vs. production), helping maintain a clean and manageable codebase.

Using .env files helps maintain a clear separation of configuration and code, which is a best practice in software development, especially in projects involving multiple environments or developers.

The variables described:

ID= //your discord bot id
SECRET= //your discord bot secret
TOKEN=M //your discord bot token
MONGOURI= //your MongoDB Database token
MAINGUILDID= //your test/main/support server
TOS= //your tos url (tos.domain.com for example)
PRIVACY= //your privacy policy url (privacy.domain.com for example)
CMDLOG= //a channel for logged interactions
OPENAI= //your openai API key
REPLICATE= //your replicate ai API key
TWITCHID= //your twitch app developer id
TWITCHSECRET= //your twitch developer secret
OLTOKEN= //your OmenList API Token
OL_VOTE_ROLE= //your role ID for voters
OLAPIKEY= //Your OmenList API Key
TOPGG= //your top.gg API key
TOPGG_VOTE_ROLE= //your top.gg voters role, can be the same as OL_VOTE_ROLE
WHSTK_API_KEY= //your weatherstack api key
INFLUX= //your influx.vision api key
VIRUS_KEY= //your virustotal API key
OWNERID=[ //an array with all owner ids from discord
    "931870926797160538", #toowake
    "998540329995227266", #.soydaddy
    "375276980028833792", #soydaddy
    "822111322548076624" #justin
]
PORT= //the port the website will run on
SITE_SECRET= //your website secret
DOMAIN= //the domain for the website (use localhost:// if you dont have one)
SITE= //if site enabled (type ON or OFF!)
PreviousFirst StepsNextCustom Bot Functions

Last updated 11 months ago