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.jsbot.jsmain.pyindex.pyapp.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.jscommand.It is usually defined in your
package.jsonunder the"main"field.
{
"name": "my-bot",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"start": "node index.js"
}
}The main file is the one you use to start your bot:
When running the
python MainFile.pycommand.By right-clicking the file and selecting RUN in PyCharm or VS Code.
The main file is the one you use to start your bot:
When running the
java -jar MainFile.jarcommand.By double-clicking the
.jarfile.
The main file is the one you use to start your bot:
When running the
ruby MainFile.rbcommand.
The main file is the one you use to start your bot:
When running the
go run MainFile.gocommand.
The main file is the one you use to start your bot:
When running the
php MainFile.phpcommand.
In Rust projects, the main file is typically located at:
src/main.rs
🛠️ Defining it on Discloud
Once you have identified your main file, you must specify it in your discloud.config file using the MAIN property.
Last updated