audio stream with auto RAM usage

Viewed 266

I'm doing a very simple BOT for discord where basically it will play my shoutcast radio in a room on the discord.

Code:

client.on('message', message => {
    let args = message.content.substring(1).split(' ')

    if (args[0] === 'play') {
        connected = message.member.voice.channel.join().then(
            connection => {
                connected = connection.play('http://mystation.com/stream.mp3')
            }
        )
    }
})

Basically the user will enter an audio room and type !play and the bot will enter that room to start playing the radio

It normally plays the radio, but the audio is constantly locking up and I noticed that there is high consumption of RAM only with this code, it is exceeding 100 MB. Does anyone have any suggestions or optimization tips to reduce this excess RAM? I would like to understand why this occurs

1 Answers

Discord music bots often take a lot of RAM. There's not much you can do about this, however, you could try switching to Eris, which is a similar library that is older and has less memory usage.

Related