简体   繁体   中英

Is it possible to play music/sounds by discord bot installed on Heroku?

I created a Discord bot in Discord.js. One of the options is joining a channel and playing a sound. Everything works fine when I launch the bot on my computer. However, if I try to launch the bot and play a sound on Heroku, the bot joins the channel, sends the message, and momentarily leaves without any sound/errors or information in the logs.

I tried editing the script and installing everything needed in Heroku through the console, but it still doesn't work.

const commands = {
    "data": {
        process: function (msg, suffix) {
            if (!msg.member.voiceChannel) return msg.channel.send('**TEXT \n**' + (emoji.convert(licznik + " days")));

                msg.member.voiceChannel.join().then((connection) => { 
                msg.channel.send("**TEXT**");
                msg.channel.send(emoji.convert(licznik + " days"));     
                const dispatcher = connection.playFile('msc/samurai.mp3');
                dispatcher.on("end", end => {
                msg.member.voiceChannel.leave();
                }
                )
        }
            )
    }
},

I don't have any errors in the logs or console. Any ideas?

It may be possible, I don't personally use Heroku however from what I've herd it has certain limitations that would not allow certain things to work. With the way that FFMPEG works, it may not install or work correctly because Heroku has a configuration that restricts access to certain memory.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM