Exporting your bot
When your bot is ready, export it as a ZIP file and run it. Everything you built is turned into a self-contained bot project.
Before you export
Section titled “Before you export”- Save every graph. Export uses the last saved version of each graph.
- Turn on at least one event or command. A bot with only a main file has nothing to respond to.
- Check each event is switched on. Events you turned off are left out.
Select Export bot on the overview, events or commands page. The ZIP is named after your bot.
What’s in the ZIP
Section titled “What’s in the ZIP”| File | What it is |
|---|---|
index.js |
The bot’s starting point |
events/ |
One file per event you turned on |
commands/ |
One file per slash command you created |
package.json |
The list of things the bot needs to run |
.env.example |
A template for your bot token |
README.md |
A short reminder of these steps |
Run your bot
Section titled “Run your bot”You need Node.js 18 or newer installed on the computer or server that will run the bot.
-
Unzip the file.
-
Open a terminal in the unzipped folder.
-
Install the bot’s dependencies:
Terminal window npm install -
Copy
.env.exampleto.env. -
Open
.envand add your bot token:DISCORD_TOKEN=your-bot-token -
Start the bot:
Terminal window npm start
The bot is online as long as that command is running.
Keeping your bot online
Section titled “Keeping your bot online”If you close the terminal, the bot stops. For a bot that stays online all the time, see Keeping your bot online.
Making changes
Section titled “Making changes”Your exported bot does not update itself. To change your bot:
- Edit and save the graph in DisFlow.
- Export a new ZIP.
- Replace the files on your host and start the bot again.