What is discord.js

What is discord.js?

Discord.js is a node module that you can use to easily access discord API There are over 1 million downloads of discord.js There are over 100 contributions to discord.js And there are over 2 thousand stars on discord.js

An example of what discord.js is would be the following

const Discord = require('discord.js');
const client = new Discord.Client();

client.on('ready', () => {
  console.log(`Logged in as ${client.user.tag}!`);
});

client.on('message', msg => {
  if (msg.content === 'ping') {
    msg.reply('Pong!');
  }
});

client.login('token');

The above code does the following When the bot logs on successfully it will send a message to the console saying “Logged in as {bot name}” furthermore, if someone says the message ping in a channel the bot will reply with “Pong!”

How to install discord.js

Firstly make sure you have Node js installed. You can install it (Here)[https://nodejs.org/en/download/]

Your next step is to create a new folder and type the following If you want to install discord.js without voice support npm install discord.js If you want to install discord.js with voice support npm install discord.js node-opus

Then you have successfully installed discord.js

Coding bots

Alongside with discord.js, you are able to code discord bots using programming languages. some of the programming languages I have seen people use to make discord bots is below Javascript, This is the most common programming language I have seen people use to make discord bots Python, This in my opinion is the second popular programming language that people use to make discord bots Ruby, This is probably the most uncommon programming language I have seen people use to code discord bots. But I have seen a few people use it

Discord.js Documentation is located Here

The main website for discord.js is located Here

The repository for discord.js is located Here

The main website for node js is located Here