briantanner / lavalink.js

A lavalink client for discord.js
https://briantanner.github.io/lavalink.js/index.html
MIT License
6 stars 0 forks source link

WIP: Cleaning code (See description) #1

Open MrJacz opened 6 years ago

MrJacz commented 6 years ago

Done: PlayerManager#Join function returns promise off the bat

Todo: Better error handling and type checking

briantanner commented 6 years ago

I don't think there's any need for a PlayerManager.add method, the only reason it existed in eris-lavalink was because it was extending Eris.Collection and there was some code reuse, by adding that method you'll only save 1 line of code.

Also, regarding _ private methods, I think the @private distinction in the jsdoc should be enough.

MrJacz commented 6 years ago

Im not taking the idea for the add method from Eris#Collection but its would be handy considering then

      player = player || new this.baseObject(data.guild_id, { // eslint-disable-line
        client: this.client,
        guildId: data.guild_id,
        sessionId: data.session_id,
        channelId: this.pendingGuilds[data.guild_id].channelId,
        hostname: this.pendingGuilds[data.guild_id].hostname,
        node: this.pendingGuilds[data.guild_id].node,
        options: this.pendingGuilds[data.guild_id].options,
        event: data,
        manager: this
      });

      this.set(data.guild_id, player);

could be reduced to

player = player || this.add(data here);

and for the _ private methods, I do agree

briantanner commented 6 years ago

We'll never use that method again, just to save one line of code.