A Progress Report (Coding Blog) — Week 4

So I’ll be honest. I don’t have an interview problem prepared for this week.

“Wow! What a slacker!!” — you (probably)

I have a legit excuse though!

I’ve been working on something big and bad these past 2ish weeks, and I want to share it with you all!

Everyone, meet MewSick! (he only talks if you tell him to)

MewSick is my discord music and trivia bot that I’ve been creating over the past week, and I wanted to use this blog to share my progress and the challenges I worked through creating it. Just a note, this blog will probably be very jumbled as I don’t really have a game-plan going into it — I just want to share.

So without further ado, here we go!

What is MewSick?

MewSick is a music and trivia bot I made for my discord channel. Discord is a program similar to Ventrillo and TeamSpeak, where there are channels that you and a bunch of friends can enter and talk on.

What does MewSick do?

MewSick uses commands such as !play, !pause, !resume, !skip, etc. to allow you to stream the audio from a YouTube video and play it to the channel you’re currently in, all through the bot! It’s super cool because you can use it to listen to a song with friends, or you can set up a playlist of songs by queuing them and having a music night with your friends. It’s really fun, and it’s something my friends and I use pretty often.

How’d you Code it?

So I’ll be honest — coding this thing was a HASSLE. I actually started by just playing around with the discord python api and just seeing the limitations of it. But after I started to get a solid understanding, I knew that I would have to make classes (something I’m not TOO confident in, but am a lot more confident in now) to organize the code properly. About 10 hours later, I had 10 or so functions and so much spaghetti code, I decided I needed to delve into using classes.

After I spent a solid few hours reorganizing my code, I worked towards creating a bunch of a commands to actually utilize the bot.

I used discord’s commands extension and asyncio to create a bunch of functions such as: play, pause, resume, queue, skip, stop, summon, disconnect and more. I used these to call and use the bot.

What About the Trivia Part?

I’ll be honest here, it’s not working yet! But it’s definitely on my to do list for the near future. But as of right now, the music part is working 99% how I intend! The only issue I have is a QoL change I want to push. Currently, if you use the play command to search for a song to play, you must use quotations around your query (for example, !play “walk it talk it”). If you don’t, the bot ends up playing Walk by Pantera instead, which is definitely not what I wanted. After that issue is resolved, I’ll be a happy camper when it comes to the music portion of the bot.

You can check out the code on GitHub. Instructions on how to use are also included in the README.md!

Now, onto coding the trivia part of it! ;)

Until next week (I promise there will be another coding blog) ❤