What is the main file?

Learn what the main file is and how to identify it in your project.

📂 General Main Files

The main file is the fundamental code of your application. It is the entry point that makes your bot go online or your website start running. Depending on the language and how you named it, common examples include:

  • index.js

  • bot.js

  • main.py

  • index.py

  • app.js


⚠️ Exceptions (Defaults)

Some bot-making software, such as Discord Bot Maker (DBM) and Discord Bot Controls, have a default main file already set up, which is usually:

  • bot.js


🔍 How do I know my main file?

The main file is the one you use to start your application locally. If you are unsure, check the common methods for each language below:

The main file is the one you use to start your bot:

  • When running the node MainFile.js command.

  • It is usually defined in your package.json under the "main" field.

{
  "name": "my-bot",
  "version": "1.0.0",
  "main": "index.js",
  "scripts": {
    "start": "node index.js"
  }
}

🛠️ Defining it on Discloud

Once you have identified your main file, you must specify it in your discloud.config file using the MAIN property.

The name MainFile.* used in the examples above is just a placeholder. Your file can have any name you choose, as long as it is the entry point of your application.

Last updated