This is a Discord bot project based on Discord.js, using Docker for containerized deployment. The bot can respond to simple commands such as /ping
and display its online status. In the future, it will support the creation of Todolist and time notifications.
- Docker or Docker Desktop
- Node.js 16
- Create an Application on Discord Dev
- Record the following parameters
- Get Discord Channel ID Follow this guide to get your Channel Guild.
-
change parameters
- your_discord_token
- client ID
- guild ID
-
docker build and run
docker build -t my-discord-bot .
docker-compose up -d
After compose, you can see the container execution in Docker. And your Discord Bot is online.
If docker-compose not work, try the command below.
docker run -d --name discord-bot -e DISCORD_TOKEN=your_discord_token my-discord-bot
Or check docker logs to fix problems.
docker-compose logs
-
index.js
The main application file containing the bot's startup and command handling logic.
-
deploy.js
A script used to register bot commands, which runs automatically during deployment.
-
Dockerfile
Defines the Docker image build process, including dependency installation and application startup steps.
-
docker-compose.yml
Defines the Docker Compose services to simplify running and managing the container.
discord.js