discord.js - A powerful library for interacting with Discord API

Discord.Js

References: Github Repository | Website

One of the first projects attract my eyes when I was browsing on Github trending list is this one. To begin with...

What is Discord?

Discord is a social network/communication platform designed for gamers to find and join communities of fellow gamers of the same interest, as well as, to facilitate an easier, smoother collaborative experience between them in online games. It supports both desktop and mobile device and even has a browser-friendly version that runs smoothly regardless of platform.

The application has been striving in popularity among gamer and tech-savvy community for a while thanks to one special feature - the ability of the user to add plugin or "bot" into their server to automate or perform amazing tasks.

Some examples:

  • A bot that acts as a server member to remind everyone of an in-game Clan War a day/an hour/15 minutes ahead of time.
  • A bot that performs a poll for a certain matter
  • A bot that tracks a tweet and updates the whole server when new or follow-up event occurs... etc.
More importantly, Discord exposes to the community a Web API so that people can build there own bot and publish it to the community. Server owners can add those to their server from the Discord  Store and enhance their server.

Discord.Js makes the process of making a bot easier.

What is Discord.js?

Discord.js is a powerful Node.js module written in JavaScript provides the developers with an Object-Oriented method to interact with 100% of the Discord API. Therefore, it is more programmer-intuitive by giving a higher level of abstraction. Instead of interacting with endpoints with Fetch API, XMLHttpRequests object in Javascript or Axios library, Discord bot developers now only need to use Object and Method well-encapsulated in the library.

A piece of example code from the library's Github repository:

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 library also comes with very well-written documentation, guide and a Discord server dedicated to helping the community on using and potentially troubleshooting it. Check it out!

Why this tool is interesting to me?

I have been a Discord user for 2 years by today and I always love its flexibility in purpose and extensibility in functionality. I have been using Discord for school work as we have servers for my program, my class and even many of my group projects. I used Discord even more for entertaining purpose. Each server I have 1-2 bot(s) to serve small-medium tasks.

Since Discord is now a big part of my Internet habit, adding even more automation and flexibility to it makes a huge impact for me. Besides that, as a programmer, building something small but possesses hight practicality and then expanding it has always been what I aimed for. For that reason, this tool can help me a lot and is a thing that is worth looking into, so for everyone.

Comments

Popular posts from this blog

My Lightweight Noteboard 1.0

Release 0.4b: #gatsbyjs - Keep the fire burning!

Release 0.3b: #translation #maintainer - An amazing story with Gatsby.js