time to open blogs...

Muffinwoman: A simple discord music bot

Here's the repo

Short but sweet today. My friend wanted a discord bot that emulated an old music bot called HimeBot. It could play any .mp4 link, which is something we miss with new bots like Groovy and Rythm. I wanted to learn discord.py and make a bot using youtube-dl since it has a ton of supported sites.

The first choice: discord.py

My CS friends know that I'm not the biggest Python guy. Although it is easy to use, I find idiomatic Python to be less readable than it could be. That's not to say it's bad, but it's not something I've put time into understanding and practicing.

That being said, the discord.py is something I've never used in a language I don't often use, so why not?

The Setup

The top level dependencies are of course discord.py to connect to Discord, youtube-dl to fetch audio, python-dotenv, and PyNaCl.

Set up a Discord application and put the application token in the DISCORD_TOKEN environment variable. I recommend making a file called .env in the root directory of the project. Add DISCORD_TOKEN=<token> and save it.

I also recommend using Python venv to avoid messing with the system python modules. It keeps everything contained and nice.

Run python src/main to get started

The commands

Choices

  1. Host it yourself - Who has servers, amirite?
  2. Keep it simple - Someone suggested using lavalink to stream the audio. That brings in Java 11 as a dependency. No thank you.
  3. No volume controls - My users like adjusting the bot's volume themselves, because everyone want's the sound at a different level.

I hope that people use this bot if they have the means to host it themselves. It's insanely simple, and I'm more than willing to add features to it if I have the time.

Further Reading

Already linked the repo :/

discord.py
youtube-dl in python

#100DaysToOffload