discordjs / discord.js

A powerful JavaScript library for interacting with the Discord API
https://discord.js.org
Apache License 2.0
25.44k stars 3.97k forks source link

voiceConnection.playFile not working? #162

Closed kobimx closed 8 years ago

kobimx commented 8 years ago

so i'm triyng to make the bot play a mp3 file that i got on local. so far i have this code

var Discord = require("discord.js");

var bot = new Discord.Client();

bot.on('ready', function() {
    var channel = bot.servers.get('name', 'Social Life is For N00bS').channels.get('name', 'Osu');
    bot.joinVoiceChannel(channel, function(error) {
        console.log(error.message);
    });
});

bot.on("message", function(message) {
    if(message.content[0] == '!') { // Command issued
        console.log("test VoiceConnection");
        bot.voiceConnection.playFile('/root/test.mp3');
    }
});

bot.login("email", "passwd");

but i cant make it to work. ive tried both on the master and indev branch and i have also tried using a stream (fs.readFile) with playStream but still no luck. i'm on Debiam v7 with node v5.5.0, maybe it's a node version problem?

abalabahaha commented 8 years ago

Mind hopping on the Discord channel so it's easier to talk?

kobimx commented 8 years ago

sure ill'do it tomorrow since it's 2:20 AM