Subcommands in yuuko (command framework for Eris)

Antonio Wang
3 min readApr 11, 2021

Hello guys, it’s been a while not posting something here on Medium but here I am with a review about subcommands in yuuko. Let’s talk about what is yuuko first of all.

Yuuko is a command framework made for the Discord JavaScript library called Eris.

One of the reason I chose this command framework was because it offered a really user-friendly way to handle commands and events and some other extensions for the client.

Anyways let’s jump straight into how to implement subcommands in your own Discord bot made with Eris!

Note: I’m not going to teach you how to create a Discord bot because there are too many guides talking about that. This is only a review and how to use subcommands :)

(Click here for yuuko npm package page.)

Ok, so let’s install the branch for subcommands (still in phase of testing by the developer of the framework so there will be some bugs probably).

To install the branch go in the terminal and type the following:

npm i eritbh/yuuko#builds/subcommands

Let’s take the ticket command of ATN Bot and make a subcommand around it. Note that I will not leak the entire code of my project!

As you can see you will add the logic of the command without arguments in the first part of the code where it actually creates a new ticket channel and pings the user who created the ticket channel. In the second part of the command you should add .addSubCommand to add a new subcommand. In this case the subcommand will be close where it closes the ticket channel just by deleting it.

Now, let’s see how this command looks like!

After that, when I write a!ticket close the bot will delete that channel.

Finally after doing all of these here is my review about this new feature!

What I think is: this is such a nice feature to use and also a cleaner way to improve the code quality of a bot so people don’t need to add so many if/else statements in their code such as if (arguments[0] { ... } else { ... } and this is probably one of the best ways to improve it and better for developers of bigger bots of improving their commands but also for small developers of smaller bots of course! In my opinion, finally, the developer of this command framework is doing such an amazing job with that so big thumbs up for her!

Thank you guys for reading till the end! (I don’t know if there is even someone who read till here but hey!)

Anyways guys make sure to follow me here and join my Discord server and invite ATN Bot too! I’ll see ya in the future with future blogs. Bai bai 👋

--

--

Antonio Wang

~ He/Him - INTJ-T ~ TypeScript Developer ~ 16 Years Old ~ ATN Development / Tear Paradise Owner ~ Developer @ TechHost ~ Lead Mobile Developer @ Foodintab