Great, now if we run the command below, our bot should go online: node index.js Remember the token we copied in Step 1? Create an. Import the discord.js package and create a new client like so: require('dotenv').config() //initialize dotenvĬonst Discord = require('discord.js') //import discord.jsĬonst client = new Discord.Client() //create new clientĬonsole.log(`Logged in as $!`) Ĭlient.login(_TOKEN) //login bot using token The first thing we need to do to code our discord bot is to create a discord bot client and log our bot in. If you see the bot installed in your server, it is currently offline. This will create an index.js file, where our bot functions will be written at. In our project directory, run: touch index.js
0 Comments
Leave a Reply. |