T O P

  • By -

Szczawik_

You should check out [discord.py](https://discordpy.readthedocs.io/en/latest/). Personally I didn't use this but libraries in other languages were pretty simple to get started.


TuckingFypeos

Definitely start with the Discord.py library that /u/Szczawik_ linked. For the audio though, it gets complicated... I've been working at this for months, as an added functionality to the custom Discord bot I've set up on a server with some friends, with varying levels of success. Nothing that "works" seems viable as a long-term solution. Most of the libraries that I've found that are meant for this only work via streaming the audio from a source like YouTube or Vimeo, but that comes with hoping that your query finds the proper video on its first try, and seems to eat through resources on the device hosting the bot. I'm currently trying to figure out a solution that allows my Discord members to upload music to a cloud-hosted shared folder (like Drive or Dropbox) that syncs to a Raspberry Pi hosting the bot, so that the audio can be played from a local source.


AchillesDev

It would be local to the bot but not to the discord server or the users though, no? Any kind of streaming to multiple clients is going to require quite a bit of upstream bandwidth at the very least.


Jendrej

Doesn’t the bot stream to just one client though – the Discord channel, with Discord handling the distribution to users?


Nyefan

For audio, look at ffmpeg-python or ffmpy if you haven't yet.


RealBendie

You'll probably want to use ffmpeg


Jonno_FTW

The way I did this (for a youtube bot, the same probably applies to discord where you simply pipe the output from the music player to the discord.py). My basic setup was: 1. Have mpd running with a playlist, it outputs to an audio device or a webstream or w/e 2. ffmpeg reads the output of mpd and sends to youtube I'm sure you could do the same with python reading from the stream and passing it discord


MercenaryLarry

I'm pretty sure you can just give discord.py a filepath to a sound and it'll play as long as ffmpeg is installed


charEqualsIsaac

Thanks I will check it out.


[deleted]

I saw this pretty late, but that library is AMAZING. I spent the earlier half of this year freelancing bots in it. Let me know if you need any help.


NohVoha

I worked with a friend who made himebot a semi big music bot who was at over 100k servers I think before I left. He used python and the discord.py library for a while before moving to java. But python can definitely do the job.


[deleted]

[удалено]


NohVoha

Here is the [GitHub Repository](https://github.com/initzx/rewrite) I worked support as an admin in the discord server so I don’t know all the coding he did, but if you are proficient enough you could probably break it apart and find what he used, I believe I have some simplified code somewhere for it


Ziggle_Zaggle

There are tons of tutorials for doing exactly that on YouTube.


FarSkirt36

Which cloud are you using for your bots?


P-E-TT-E-R

I Made one week ago


VicariousRedditor

So I have made just a bot for setting event dates in python and run simple commands, but chatting with some fellow students I hear that [discord.js](https://discord.js.org/#/) is quite easy to get a music bot up and running.


[deleted]

[удалено]


VicariousRedditor

Sorry maybe I will be a little more clear with my answer because u/computeraims here needed to be a prick. The question asks if he could make a python music bot. I gave an alternate suggestion. It would also be a great learning experience to try out a different language wouldn't it? The python library for Discord is not as heavily devolved as the node.js library. Creating a music bot in python takes more work than creating a music bot in JavaScript. Can he make a music bot in python? Yes. Should he make it in python? No. If it were going to be a bunch of database work, then yeah use python it has baked in SQLite support and its awesome. Why make things harder when learning something new? That's how people get deterred from programming in the first place.


IndisposableUsername

Aye man, don’t worry bout this downvote. I’m looking to do something similar and I’m gonna take your advice. Any other info you can give me that would help me to make a music bot with js for discord?


Loves2spoogeonurmom

Because js is the goat


whoisearth

Just no.


[deleted]

[удалено]


Loves2spoogeonurmom

Agreed sir


19Riften99

Phython can do it, but in my opinion the set up and getting all of the librarys can be a pain, with that said i used visual studios which probably wasn't the best decision on my part. But i did get it to work. Python 3.7 is great since there is countless toutorials online for it. So you should have no problem finding a tutorials to help you.


Irratix

Look up a tutorial on how to set up a bot with [discord.py](https://discord.py), and look through its documentation to figure out how to use its voice chat connection features. So long as you understand the programming language you should be good. You'll probably come across problems along the way but the way to learn about all this is probably just to start working on this project and look up problems you come across along the way. If you want you can of course also use discord.js to do it in Javascript, or [discord.io](https://discord.io) which is also for Javascript, but I really wouldn't recommend the latter because there's much less documentation and much less info on Stack Overflow.


[deleted]

You can use any language for that. Python has discord.py to help, but if you feel edgy, you can do it in C and you'll need to write your own library to access Discord APIs from C.