You can either follow this text guide, or follow along with the podcast episode we hosted about this topic here. It is however in Slovenian.
- Register a bot with discord here
- Grab the token
- Proceed to setup
npm init -y
If you don't have node and npm installed, you can install them from here.
After installation, verify it with node -v
and npm -v
.
2. After we initialize the node project, we create three files named: .gitignore
, .env
and index.js
.
npm install discord.js dotenv
By now our file structure should look like this:
| node_modules
| .env
| .gitignore
| index.js
| package-lock.json
| package.json
└── README.md
.env
node_modules/
TOKEN=yourDiscordBotToken
// Imports necessary libs and initializes discord client
const Discord = require('discord.js');
const client = new Discord.Client();
require('dotenv').config(); // Inits dotenv config
const TOKEN = process.env.TOKEN; // Grabs our token from the .env file
client.login(TOKEN); // Logs in the bot with our token
// Logs the tag of our bot and console logs on ready
client.on('ready', () => {
console.info(`Logged in as ${client.user.tag}`);
});
VegaHQ: Twitch, website, Instagram, Twitter, YouTube
Authors: Aiken-Twitter, Aiken-Instagram, Gašper-Twitter, Gašper-Instagram