Streaming station audio on Discord

heartlandnewsfeed

New Member
I've noticed that some Internet radio stations are broadcasting their streams to chat servers like Discord.

However, despite being a techie, I have the slightest idea of how to make this happen.

Any insight from those who have done it would be greatly appreciated.
 

SDR Talent Scout

Active Member
I've noticed that some Internet radio stations are broadcasting their streams to chat servers like Discord.

However, despite being a techie, I have the slightest idea of how to make this happen.

Any insight from those who have done it would be greatly appreciated.
Discord bots some are better than others.
 

heartlandnewsfeed

New Member
I would give you a good example, but the Liberty Radio Network/LRN.FM was recently deplatformed from Discord. They had some sort of Discord bot which would play their 24-hour network stream. If it wasn't one of the widely publicized Discord bots, it was likely a bot that came from GitHub with intention of use for Discord.

Discord bots some are better than others.
Yeah, but I've yet to see a Discord bot that has been able to do this successfully. Unless it's a rarely used bot.
 

boxfrank

New Member
Without a working example it´s difficult to find out, how this works exactly.
But if you know your REAL radio-streaming-link

Yours is:

you can feed the stream to a chat-service as normal user-audio.
But if they find out, that this is not a talking gamer, they will delete it, I think.
 

heartlandnewsfeed

New Member
you can feed the stream to a chat-service as normal user-audio.
But if they find out, that this is not a talking gamer, they will delete it, I think.

Actually, Discord allows this, so the reasoning a station was de-platformed had nothing to do with streaming audio.
 

SDR Talent Scout

Active Member
I would give you a good example, but the Liberty Radio Network/LRN.FM was recently deplatformed from Discord. They had some sort of Discord bot which would play their 24-hour network stream. If it wasn't one of the widely publicized Discord bots, it was likely a bot that came from GitHub with intention of use for Discord.


Yeah, but I've yet to see a Discord bot that has been able to do this successfully. Unless it's a rarely used bot.
Try 24/7 sits in voice channel 24/7 premium is probably better, but I use the free one.

Jump onto my discord and try it out.
 

Demo

Active Member
Answer is simple don't use Discord with all its third party bots!
Depends how it is coded because you don't have to use a third party bot.
If coded correct you can get a Discord Bot to link interaction direct to website (Top 20 , Requests etc)
But if someone wishes to just play the radio stream without any form of interaction then a simple bot like FocaBot will work :)
 

Pretmaker

New Member
I've programmed about 5 different Discord bots, and to be totally honest, my implementations continue to evolve and change. As it's all custom coding. Especially with the new library updates that have been implemented that I use.

But I will be able to give you a rough rundown of how it works.

I primarily use node.js and discord.js. But it is possible to program a Discord bot in C#/.NET, Go, C++, Perl, Python. So if you know one of those languages already, I suggest you stick to that language to make it easier.

To stream the audio to a voice channel, a few things are needed:
An audio stream obviously.
A channel to stream into.
An intermediate program that pushes the audio to the Discord bot program (discord.js uses ffmpeg for allot of things for example).
A discord bot.

I assume you don't have problems getting the first 3 things. So the last thing will be the challenge. You can download pre-fab bots on the internet that do stuff for you like play YT links or other stuff and sometimes it's easy to change a few options.

But my code to simply play the audio stream is as follows:


JavaScript:
const streamOptions = {seek: 0, volume: false, fec: true, bitrate: 320, highWaterMark: 24}   
const broadcast = client.voice.createBroadcast();
broadcast.play(`{streamlink}`, streamOptions);
for (const connection of client.voice.connections.values()) {
    connection.play(broadcast);
}

After that when my bot joins the voice channel, I loop over the broadcasts and then play them back. There is only 1 broadcast running so I feel safe to do this :p

JavaScript:
voiceChannels.join().then(connection => {
    client.voice.broadcasts.forEach(broadcast => {
        connection.play(broadcast, streamOptions);
    })
})

https://discordjs.guide/voice/voice-broadcasts.html#example-usage Here is some more explanations about what is shown here. But this is about all you need if you've got the rest of the bot setup already :)
 
Top