Guichaguri / DiscordDJ

Discord DJ Bot. Play music in your server. Inspired by PlugDJ
http://guichaguri.github.io/DiscordDJ/
GNU Lesser General Public License v2.1
200 stars 49 forks source link

Error #68

Open FatBoyXPC opened 8 years ago

FatBoyXPC commented 8 years ago

DiscordDJ Crash Log

Message: write EPIPE
Code: EPIPE

Error: write EPIPE
    at exports._errnoException (util.js:890:11)
    at WriteWrap.afterWrite (net.js:767:14)% 

This happens when I add a song to the queue.

Specs: Ubuntu 14.04 Kernel 4.0 Nodejs v5.10.1

FatBoyXPC commented 8 years ago

I read through one of the other issues and noticed that using the master branch was a bad idea, so I grabbed the latest tagged release. I still get various errors when trying to add music.

When I try to add a youtube video (via /add youtubelink) I get this error:

events.js:154
      throw er; // Unhandled 'error' event
      ^

Error: read ECONNRESET
    at exports._errnoException (util.js:890:11)
    at Pipe.onread (net.js:550:26)

npm ERR! Linux 4.5.1-040501-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "start"
npm ERR! node v5.10.1
npm ERR! npm  v3.8.3
npm ERR! code ELIFECYCLE
npm ERR! discord-dj@0.0.5 start: `node ./runtime/DiscordDJ.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the discord-dj@0.0.5 start script 'node ./runtime/DiscordDJ.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the discord-dj package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node ./runtime/DiscordDJ.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs discord-dj
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls discord-dj
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/james/Downloads/DiscordDJ-0.0.5/npm-debug.log

Note: I upgraded my kernel between now and when I opened the issue, so I'm aware of the 4.5.1 kernel here but 4.0 posted in the OP.

Guichaguri commented 8 years ago

The kernel and the linux shouldn't make any difference. The issue is with DiscordDJ itself 0.0.5 is known to be bugged, try 0.0.4 instead

Sorry for the inconvenience, DiscordDJ is still WIP and not released yet. It's highly recommended to only use it for testing.

FatBoyXPC commented 8 years ago

I didn't think changing the kernel would change anything, I was just clarifying because in my OP I had kernel 4.0, but the error output showed kernel 4.5.1. I was just trying to prevent a nitpick before it happened (I've dealt with some really lame people I guess).

So I tried 0.0.4, and I get this instead:

➜  DiscordDJ-0.0.4 ./start-bot.sh 
fs.js:584
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^

Error: ENOENT: no such file or directory, open '/home/james/Downloads/DiscordDJ-0.0.4/node_modules/discordie/lib/core../deps/cas/addtrustexternalcaroot.crt'
    at Error (native)
    at Object.fs.openSync (fs.js:584:18)
    at Object.fs.readFileSync (fs.js:431:33)
    at Array.module.exports.addFile (/home/james/Downloads/DiscordDJ-0.0.4/node_modules/ssl-root-cas/ssl-root-cas.js:4518:30)
    at /home/james/Downloads/DiscordDJ-0.0.4/node_modules/discordie/lib/core/SSLCA.js:10:7
    at Array.forEach (native)
    at Object.<anonymous> (/home/james/Downloads/DiscordDJ-0.0.4/node_modules/discordie/lib/core/SSLCA.js:9:9)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
Press [Enter] to close...

I'm aware this is still a WIP, but I'm super excited to try it out! I'll go grab all the other tagged releases and see if maybe I get lucky!

Guichaguri commented 8 years ago

So Discord has updated several times since 0.0.4 and 0.0.5, both of them are broken now. At least, now they released a new official API, and I will use it. It will take some time to implement that, and I don't know exactly how much.

FatBoyXPC commented 8 years ago

If you'd like to point me in a direction of how to help, I'd be glad to, but I'd want some sort of primer on how everything worked first (if you'd be so kind)

Guichaguri commented 8 years ago

The first thing that needs to be done is to implement the authentication. I would like to implement support for both user and bot accounts The second thing that needs to be done is to implement a opus encoder. That is the hard part of the whole implementation and it will probably be based on #q's opus implementation. The third part is to implement some functions and events (like chat) After everything is done, the bot should run again.

I was planning on a "library handler", where I could use DiscordDJ on top of other libraries (discordie, discord.io and discord.js). But the plan now is to make it work with pure Discord API.

I know some libraries are catching up on the new API, and I'll probably use them for reference and examples.

FatBoyXPC commented 8 years ago

Oh wow, that authentication stuff looks pretty cool, actually (separating out bots from normal accounts). Warning: The page makes it clear that user accounts should not be used as bots, or they'll be suspended and forced to be changed to bot accounts.

The Oauth part of all this I assume will be the easiest.

Also - bots apparently don't have the same limitations that user accounts have (not limited to 100 guilds, for example). You might be able to run a website where people can request the bot be placed in their server, rather than just find a server to run this little bot package on.

Guichaguri commented 8 years ago

Yes, but the problem is that the majority of people try to run this bot in a regular user account just for one guild. I don't want to force anyone to create a bot account.

My plan, in the future, is to host the bot and make it similar to Airhorn Bot, but I still have to look into server costs and performance

FatBoyXPC commented 8 years ago

Is there a way to specify a bot account in the config? I'm totally game to try that and see if that would fix this problem. The setup script didn't mention any sort of key/token for the bot, but I remember an issue in here about soundcloud needing an API key and it can be hardcoded somewhere.

Either way - I'll happily keep a heads up on the repo and I am more than glad to test things for you!

If by chance I can get around to it before you, I'll see if I can't get some discord authentication proof of concept coded up and sent via PR.

Guichaguri commented 8 years ago

In the current version, you can only specify an user account. Here's how the config file had for authentication:

{
    "email": "",
    "password": "",
    "token": "",
    "keys": {
        "youtube": "",
        "soundcloud": ""
    }
}
FatBoyXPC commented 8 years ago

Ah, wow. I actually looked at config.json before and remember a lot of it now that you broke it up. My bad!

RandomMan25XX commented 8 years ago

I think the self hosting aspect works well, no need to worry about anything extra and it seems to work well for other bots that have self hosting as either a main or secondary option

Guichaguri commented 8 years ago

@RandomMan25XX but having to download youtube/soundcloud/spotify/etc content, convert it to PCM to convert it to libopus packets and then send them to a Discord voice server is quite performance-heavy happening at the same time for 50 guilds. I've already heard a lot of problems with other audio-based bots :/ Also, the Airhorn Bot just play local files for less than 5 seconds and it still have a lot of issues.

RandomMan25XX commented 8 years ago

what about each user of the bot hosting their own iterations of the bot using their own computers, would that still be performance heavy as someone who locally hosts multiple iterations on one pc or would said self hosting still cause issues?

Guichaguri commented 8 years ago

@RandomMan25XX Sorry, I didn't fully understand. Do you mean people hosting the bot for their own guilds in their own computers/servers?

RandomMan25XX commented 8 years ago

yeah, from what i've seen using nadekobot, which has a function like that seems to work quite well