Using Node.js To Create a Discord Bot

Josh Green Development Technologies, JavaScript, Node.js, Programming, Tutorial Leave a Comment

From Zoom to Skype to Microsoft Teams, there is an endless number of platforms to help keep you connected. One such platform is Discord – a service primarily intended for gaming that allows you to voice chat, video chat, or screen share with a community you have developed on your own hosted “server.” One of Discord’s best features is a developer portal with an open API that allows you to add bots and apps to your server, as well as write your own.

There is true beauty in the ability to create your own custom solutions to fill your needs. So in this brief tutorial, I’ll show you how to get up and running writing your own Bots and Apps for Discord with Node.js.

Using React Hooks To Save the Environment

James Bradley Node.js, Programming, React Leave a Comment

Every application has some need for environmental variables that are specific to that environment. This can be database connections strings or URL to an API that will vary between the different environments. In React, you can use .env files to define key-value pairs. Then Node will inject these at runtime to be used globally through the process.env.{variable}. In this blog, …

React with Socket.IO Messaging App

Peter Le Development Technologies, Node.js, React 2 Comments

Building a messaging app sounds complicated, but it really isn’t. With the right tools, creating one might be simpler than you think. In this post, I will show you how to accomplish this task using Socket.IO. Before we dive in, let’s get some expectations out of the way. There will not be anything fancy in this app like different channels, …

Refactoring: Ugly Code That Does Everything

Gabe Schmidt Development Technologies, JavaScript, Node.js, Programming, Tutorial Leave a Comment

If you’ve been writing code for a significant amount of time, you’re sure to have seen the—anything but godly—“God Method.” It’s a method that performs way too many processes in the system and has grown beyond all realistic logic to become “The Method That Does Everything.”

This single unsightly method can span dozens, if not hundreds, of lines. Sometimes even over 1,000! This type of “ugly code” is an unbearable beast to maintain. This is why it’s considered a “code smell” or anti-pattern.

In this tutorial, we walk through a tangible “God Method” and step through the process to refactor it into something more manageable and human-readable. Our code is written in JavaScript for a Node.js service, but the principles apply to any language.