Building a Discord bot in Node or Python.

Libraries You need to make it.

Soyokaze

--

Create discord bot in JavaScript and Python.

Ever thought 🤔that those awesome bots you use daily on your discord server to listen music, request memes, take help for moderation purpose and so much more 🤩.

Well this blog is not a step by step guide to create one but will try to help you in choosing the right library for your build. So hang tight and read to the end.

The purpose of this blog is not to compare discords library in these two languages but to explain what they have to offer you and how you can get access to their documentation for your build.

Javascript

JavaScript ( The soul of the internet ).

I’ve found about Discord.js recently when I thought of creating a bot in Node.js — yes you’ll be creating JS bot in Node, so obvious — to improve my Js skills, but that’s not the point.

Link to the repo here.

So coming back to Discord.js, you can visit it’s documentation here.

I created my first discord bot in python but creating it in Js was a total different experience. Documentation is so nicely written, a ton of classes to create from and on top of it it was much easier, easier than python I’d say 🤷‍♀️.

discord.js

Pros.

  • Nicely documented Library
  • Easy to use (All you need to know is function, require(), if-else, and classes)
  • Ton of classes and methods to use.

Cons

  • A dedicated class for command handler is not present like we have in Discord.py

Python ( Simplicity with power ).

Python was the language in which I created my first discord bot.

To create a bot in python you should have a little experience with decorators, functions, if-else and classes ( OOP ).

Link to the repo here.

If you choose python to create a discord bot, well, I’d say you like power and want to achieve the great😎. Since python is recommended for ML/AI you can add some real brains to your bot too, and don’t forget the data processing facilities you have ( numpy, pandas).

But with great power comes great complexity.
~Soyokaze

Ya I know I ruined the quote but that’s not the point, Python is powerful, YES, but with this power comes the complexity of the documentation. It too have a well written doc (much upgraded since my first time 😐), but decorators a bit tricky sometimes and async-await are like chilly on top🌶.

If you are okay with these challenges Discord.py is the best for ya.

Pros

  • Power
  • Can use the buffs of data-processing, ML and numpy.
  • It’s Python.
  • It has a dedicated framework for Command handling. ( i.e. discord.ext.commands link here ).

Cons

  • A little complex.
  • Decorators and Async-await gives a hard time.

There you go, now you know where to start your journey of building your own discord bot. Also head over to discords site for developers to Get the key for your bot, Like how else will you get the access to their API, DUH!!…
LINK HERE.

Thanks for reading. If you like reading stuff like this consider following. And yeah, do let me know in the comments below if you want to have a blog on a step by step guide to create your first discord bot.

Signing off Soyokaze ❤.

--

--