0

DiscordBot

A chatbot that primarily focuses on music and moderation. Highly customizable and easy to use.

Long Story About My Learning Journey - Blog

I created a chatbot to have fun with my friends on Discord. It was a basic calculator that had few commands: /add /subtract /multiply /divide

I wanted to add more features to it, so I started learning about the Discord API and how to use it. I learned about the discord.py library and started working on it. 4 commands were not enough, so I added reactions (auto messages for special keywords). I added a few reactions like lol xd bruh and so on.

At the time there was musicbots that were popular, so I decided to add music features to my bot. I used the youtube-dl + ffmpeg combo to download the audio from YouTube videos to my server and then play it. It was a very basic music bot, but it was enough for me and my friends.

I wanted to grow more users, for example i shared my bot to a few Discord servers which were my friends' servers. But i learned something very important thing: Race Conditions. I didn't know what it was at the time, but i learned it the hard way. I had a command called /play which played music from YouTube. I had a few users in my server and i was playing music for them. But when i shared my bot to other servers, i had more users. When i played music for them, it stopped playing music for the users in my server. I didn't know what was happening, so i started debugging. I found out that the music was playing for the users in my server, but it was not playing for the users in other servers. When the song ends, bot tries to delete the downloaded audio file from the server, which causes the bug. I had to delete artifacts from the server in order to operate.

Found a solution to my custom music player. I used the lavalink API to play music. Connecting and playing music was very easy, but i had to learn how to use the API in order to customize my experience. Made my own Queue system and added a few commands like /skip /skipto /forward /volume /seek /equalizer. Added a fancy UI to the music player and it was ready to go.

UI

In a week it was my birthday, i wanted to give myself a gift. I wanted to make my bot reach 200 users, so i shared my bot to a few websites that lists Discord bots. Bot reached 200 users in a day! I was very happy, in a week bot reached 500 users. Insane! 🎊🎉🥳

Today

As of today, my bot operates on 300_000! users which includes some of Discord employees 😎

My main and only goal is to make user experience better. That's why i'm always working on new features and improving the existing ones.

Features

Media Controls

I created a web application that is dashboard for my bot. Designed to use media controls in background. You can control the music player from the dashboard with just signing in with discord. You open the dashboard in your browser and you will see mutual guilds with the bot, play or browse however you want. You can even minimize the browser and it will still work. You can even control the music player from your phone.

MediaControls

Media Commands: Play/Pause Previous Next Stop

That way, you can use the music player with playing games without commanding in Discord Chat.

MediaControls

Autocomplete

When you type a song name, it will autocomplete the song name for you. You can select the song you want to play from the list.

AutoComplete

Moderation

Bot has autorole command that can be used to give roles to new members. You can set a role for new members and bot will give that role to new members.

Miscellaneous

  • TFT (Teamfight Tactics) - League of Legends
  • Roblox Stats
  • Currency Updates
  • Reminder opensource

For developers

TBD: Diagram/Architecture - Code structure / Command Count - Logging

  • Audio System supports YouTube, SoundCloud, Spotify, Twitch, Vimeo, Bandcamp, Mixer, HTTP, Local Files, HTTP Live Streaming.

Thanks to my friends for all the support and help.