-
Clone the repository
-
Create file named
.env
in the root directory of the project -
Paste the following code to the
.env
fileTOKEN= CLIENT_ID= GOOGLE_API= MONGODB_URI= DB_NAME=<database name>
- Create name for the database and replace
<database name>
with it atDB_NAME
- Create name for the database and replace
-
Create an account on MongoDB Atlas
- Follow MongoDB Atlas Getting Started
- Copy the connection string for Node.js 4.1 or later and paste it to
MONGO_URI
in.env
file - Remember to replace
<password>
with the password you created for the user in the connection string
-
Create discord application and bot
- Create application
- Click New Application in the upper right corner
- Enter a name for your app, then click Create.
- Create bot
- On the left hand sidebar click Bot, then the Add Bot button
- Update the username and icon for your bot
- Press
Reset Token
button to generate a new token
- Copy the bot token and paste it to
TOKEN
in.env
file - Navigate to the General Information page
- Copy the application id and paste it to
CLIENT_ID
in.env
file
- Copy the application id and paste it to
- Create API Key to Google Custom Search Engine
- Copy the API key and paste it to
GOOGLE_API
in.env
file
- Create application
-
Invite the bot to your server
- Navigate to the OAuth2 page
- Select bot from the scopes
- Select the permissions you want to give the bot
- Copy the generated link and open it in your browser
- Select the server you want to add the bot to
- Click Authorize
-
Configure presence of the bot
- Open
json/config.json
file - There you can change bot's Activity status and message
- Activity status:
online
,idle
,dnd
(do not disturb),invisible
- To change bot's Activity type open
events/ready.js
file- In line 9 you can change the type of the Activity example ActivityType.Playing to ActivityType.Watching
- Activity types are:
Playing
,Streaming
,Listening
,Watching
,Competing
- Open
-
To start the bot run the following command in the root directory of the project
docker compose up -d --no-deps --build
- To restart the bot run the following command in the root directory of the project
docker compose up -d --no-deps --build
- To stop the bot run the following command in the root directory of the project
docker compose down
-
To add new commands
- Create new file in
commands
directory - Copy the following code to the file
const { EmbedBuilder, ApplicationCommandType } = require('discord.js'); module.exports = { name: '', description: "", type: ApplicationCommandType.ChatInput, run: async (client, interaction) => { } };
- Replace
name
with the name of the command - Replace
description
with the description of the command - Add options if you want to under
type
options: [ { name: '', description: '', required: true or false, } ],
-
Put the code you want to execute when the command is called in the
run
function -
Save the file
-
Restart the bot to apply the changes (see Usage step 1)
- Create new file in