discordjs / discord.js

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

Dispatcher catching issue after playStream() #883

Closed dayxhep closed 8 years ago

dayxhep commented 8 years ago

NPM version Hello here, Following the new syntax i have some troubles with the dispatcher catching In fact using .then( dispatcher => { does nothing (not going in the .then())

                 self.bot.user.setStatus('online')
                    .then(()=>{
                        self.bot.user.setGame(self.playing.title)
                        .then(()=>{
                            console.log("Updated tittle");
                            self.bot.voiceConnection.playStream(stream, vcOptions)
                            .then( dispatcher => {
                                console.log(dispatcher);
                                /*self.dispatcher = dispatcher;
                                self.bot.onPlay = true;
                                addMsg.target.sendMessage(npMsg).then(()=>{
                                  if (cb !== undefined) cb();
                                }).catch(err => {throwErr(err)});*/
                            }).catch((e)=>{throwErr(e)});
                        }).catch((e)=>{throwErr(e)});
                    }).catch((e)=>{throwErr(e)});

The music is playing and i got "Updated tittle" in the console

Edit, even by using :

self.bot.voiceConnection.playStream(stream, vcOptions)
.then(()=>{
    console.log("FIRE !");
}).catch((e)=>{throwErr(e)});

The anonymous function is the .then() is not fired.

Gawdl3y commented 8 years ago

playStream does not return a Promise. It just returns the dispatcher.