meew0 / lethe Goto Github PK
View Code? Open in Web Editor NEWSimple YouTube playback bot for Discord, mostly used for music playback.
License: MIT License
Simple YouTube playback bot for Discord, mostly used for music playback.
License: MIT License
Lethe should allow restricting certain commands, such as next
, to a voting mechanism so the community can vote on them instead of having one person force it. A good idea would be if over half the users in the voice channel agree on it, then do it. Other than next
, this also applies to shuffle
.
Each time Lethe switches to another track it will leave a stale ffmpeg process around:
$ ps fax
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
[...]
lethe 416 2.8 0.1 1279844 61968 ? Ssl 00:31 0:18 /usr/bin/node lethe.js
lethe 13791 0.1 0.0 475584 20816 ? Sl 00:32 0:00 \_ ffmpeg -loglevel 0 -i - -f s16le -ar 48000 -ac 2 pipe:1
lethe 29131 0.1 0.0 475340 20644 ? Sl 00:34 0:00 \_ ffmpeg -loglevel 0 -i - -f s16le -ar 48000 -ac 2 pipe:1
lethe 27834 0.2 0.0 475704 21512 ? Sl 00:36 0:01 \_ ffmpeg -loglevel 0 -i - -f s16le -ar 48000 -ac 2 pipe:1
lethe 32217 0.7 0.0 475148 20628 ? Sl 00:42 0:00 \_ ffmpeg -loglevel 0 -i - -f s16le -ar 48000 -ac 2 pipe:1
It should be terminating these child processes after the track is done.
Ideally it should replay the last played video in that case.
Currently, commands will sometimes fail if there's extra whitespace in the arguments, for example an extra whitespace after the vid in yt
. Lethe should be more lenient there.
Queuing two songs and issuing next (with processor.js left alone) causes
events.js:141
throw er; // Unhandled 'error' event
^
Error: Output stream closed
at null._onTimeout (A:\chrome\Lethe-master\Lethe-master\node_modules\fluent-ffmpeg\lib\processor.js:476:25)
at Timer.listOnTimeout (timers.js:92:15)
and with line 476 commented out
events.js:141
throw er; // Unhandled 'error' event
^
Error: ffmpeg was killed with signal SIGTERM
at ChildProcess.<anonymous> (A:\chrome\Lethe-master\Lethe-master\node_modules\fluent-ffmpeg\lib\processor.js:165:22)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
When I queue a song on windows, playback wont start.
I have ffmpeg installed and added to path.
When i start lethe, i have and error saying lethe-data.json is missing, but all commands are working.
I wanted to test out Lethe and every time I leave it to play audio, I get this error . The bot will post the message in the chat after about 5 minutes, keep playing audio for a few seconds and then stop voice chatting all together.
If I can get you any other information, let me know. Maybe it's on my end, but I am not sure.
is there a way to resolve this?
As stated in the title; not sure how difficult it would be to implement however.
As of the latest commit, it appears that the bot is not picking up my api key. Whether I input the key in the auth settings or through the cmd, it fails. I thought I should also note that I'm using windows.
This is due to the message length surpassing Discord's limit of 2000 characters. A fix would be sending the message to hastebin or a similar service if the message is too long
Saved a video, giving me this json file
{"videos":{"suika":{"vid":"Tc8iu0XFUQc","title":"WE ARE JAPANESE GOBLIN","author":"atomicpuppy2","view_count":"276289"}}}
Queuing it up with "yt suika" followed by "yt play" causes
A:\chrome\Lethe-master\Lethe-master\lethe.js:161
boundChannel.sendMessage('An error occurred while getting video information! Please try a different video.');
^
TypeError: boundChannel.sendMessage is not a function
at handleYTError (A:\chrome\Lethe-master\Lethe-master\lethe.js:161:18)
at A:\chrome\Lethe-master\Lethe-master\lethe.js:79:16
at A:\chrome\Lethe-master\Lethe-master\node_modules\ytdl-core\lib\info.js:42:21
at ClientRequest.<anonymous> (A:\chrome\Lethe-master\Lethe-master\node_modules\ytdl-core\lib\request.js:24:9)
at emitOne (events.js:77:13)
at ClientRequest.emit (events.js:169:7)
at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:421:21)
at HTTPParser.parserOnHeadersComplete (_http_common.js:88:23)
at TLSSocket.socketOnData (_http_client.js:311:20)
at emitOne (events.js:77:13)
discord.js added the ability to control the bot's volume, and it would be nice if this was implemented into Lethe as a command. However, this was implemented after the ffmpeg changes and so this will require #27 to be fixed first.
The stack trace:
events.js:141
throw er; // Unhandled 'error' event
^
Error: read ECONNRESET
at exports._errnoException (util.js:860:11)
at Pipe.onread (net.js:544:26)
A temporary workaround is commit e491d6d which forces the installed discord.js to a specific commit, however it would be best if we could use latest master as it fixed a bug that caused high memory usage.
It would probably be useful to show the total time the queue plays for in the list
command.
/home/jorge/Downloads/Lethe-master/lethe.js:17
client.on('warn', (m) => console.log('[warn]', m));
^
SyntaxError: Unexpected token >
at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:906:3
Is the error I get when trying to run Lethe.js in either node, nodejs, or npm.
I'm wondering what's wrong with it and I hope the solution is simple
I genuinely have no idea what I've done wrong here. I pulled the latest commit from my personal fork, and this error would appear when attempting to play a video.
I reset and pulled from meew0's, and got the same error. Safe to say I'm lost.
I've even gone as far as running it locally in a fresh Ubuntu VM and get the same error.
The "pl" command seems to not be working.
"There was an error finding playlist with that id."
I've tested multiple combinations, multiple playlists. Even tried adding "list=..." from the youtube source.
Hey, I just installed the bot, I can queue videos and it shows the "playing message". But I'm not hearing any audio. Basically point 2 under "troubleshooting".
But I'm not really sure which of the steps I have to do under "node-opus build dependencies" in the Beginners guide.
I used option 1, Microsoft's windows-build-tools and it said Visual C++ Build Tools installed and Python 2.7 installed. Because that didn't work I did point 3 under option 2 ("Launch cmd, npm config set msvs_version 2015"). But I still don't get any audio.
Maybe I didn't understand the instructions correctly, because I have never done anything regarding servers before and english is not my native language.
Yes, I've tried turning it off and on again.
Trying to run this from a cloud (c9.io) after having some problems with windows. Any ideas why this happened? Maybe I installed ffmpeg improperly on the cloud?
The lethe-data.json file doesn't exist! This is not an error.
Bot mention: @120426524829548544
[debug] ready packet took 9ms to process
[debug] ready with 3 servers, 23 channels and 28 users cached.
[debug] removed temporary voice websocket listeners
events.js:141
throw er; // Unhandled 'error' event
^
Error: spawn help ENOENT
at exports._errnoException (util.js:837:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:178:32)
at onErrorNT (internal/child_process.js:344:16)
at doNTCallback2 (node.js:429:9)
at process._tickCallback (node.js:343:17)
I get the following error whenever I say @botName yt SOD7Ni_3NIc and I configured the data and youtube API in lethe-auth.json
[root@cp Lethe]# node lethe.js
The lethe-data.json file doesn't exist! This is not an error.
Lethe#master@6a45cb8
[debug] bypassed direct API login, used cached token
Bot mention: <@145260374088876032>
[debug] ready packet took 5ms to process
[debug] ready with 1 servers, 5 channels and 55 users cached.
[debug] removed temporary voice websocket listeners
{ [Error: spawn help ENOENT]
code: 'ENOENT',
errno: 'ENOENT',
syscall: 'spawn help',
path: 'help',
spawnargs:
[ '-loglevel',
'0',
'-i',
'-',
'-f',
's16le',
'-ar',
'48000',
'-af',
'volume=1',
'-ac',
2,
'pipe:1' ] }
Error: spawn help ENOENT
at exports._errnoException (util.js:856:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:178:32)
at onErrorNT (internal/child_process.js:344:16)
at nextTickCallbackWith2Args (node.js:474:9)
at process._tickCallback (node.js:388:17)
I am using node v5.5.0 and npm 3.7.2.
Is it just the fact that I'm running it on a Raspberry Pi or is it a problem with the software?
It's like a square wave, turning on and off, sometimes being choppy.
An easily reproducible bug shows up when adding long videos of more than around 10 minutes.
This specifically applies to length (don't queue a video longer than the limit) but I suppose it should be generalized to other checks.
trying to queue something that returns first a channel then a video will cause the error "That video does not exist" even though it may exist after the channel
I've got this random error :
/home/musicbot/Lethe/lib/video-format.js:8
viewCount = video.view_count.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
^
TypeError: Cannot read property 'replace' of undefined
at Object.exports.prettyPrint (/home/musicbot/Lethe/lib/video-format.js:8:31)
at Object.exports.prettyPrintWithUser (/home/musicbot/Lethe/lib/video-format.js:13:18)
at Client.<anonymous> (/home/musicbot/Lethe/lethe.js:113:56)
at emitOne (events.js:77:13)
at Client.emit (events.js:169:7)
at WebSocket.websocket.onmessage (/home/musicbot/Lethe/node_modules/discord.js/lib/Client/InternalClient.js:1056:14)
at WebSocket.onMessage (/home/musicbot/Lethe/node_modules/ws/lib/WebSocket.js:414:14)
at emitTwo (events.js:92:20)
at WebSocket.emit (events.js:172:7)
at Receiver.ontext (/home/musicbot/Lethe/node_modules/ws/lib/WebSocket.js:797:10)
Don't really know what triggered the error.
Edit : Seems to be a view_count problem.
Currently, two ytdl requests are required to play a video - one when queueing it and one when playing it back. This can be reduced to one by caching the entire video info downloaded and then using ytdl downloadFromInfo
to play it. This could also be applied to saved videos, though here we have to make sure that the lethe-data.json
file doesn't get too large.
I can get the bot to start successfully, and everything seems to be working fine, but whenever I use yt is says that it queued the video and is playing it, but it won't play any audio. Upon using time, it consistently tells me that the video is at 0:00. Nothing unusual is printed to the console at all. I have done everything I can think of and have pretty much memorized certain lines of your readme. Please help?
Currently, the vid is the only consistent way to refer to a video across all commands. Saving it allows current
, queueing it allows saved video names and the link, etc. I propose allowing all of these syntaxes everywhere, possibly using a method resolveVideo
that resolves any video to its vid.
It appears that this is a feature many people need, and it should be decently easy to implement.
Currently, it will return no output at all, which is confusing. It should instead give a message like The queue is empty!
I noticed in the wiki that you said Lethe hadn't been tested on OS X before so I'd like to inform you it's the same as Linux except using Homebrew for installation (brew install [package-name]
).
Installed the latest version of node, npm & ffmpeg (which all were installed prior) and everything works as intended.
Versions:
To avoid Discord rate limiting.
Any update to ytdl after 0.7.10 seems to cause the bot to play nothing.
Tested on ubuntu and debian with discord.js 6.1.0 on the indev branch and the master branch.
ffmpeg was updated a few months ago.
https://www.youtube.com/watch?v=0itOCgJtNVU
There seems to be no error in the console. Further testing will have to be done.
Getting: An error occurred while getting video information! Please try a different video.
list saved
seems to crash the bot sometimes (roughly a 50/50 chance). I don't have a log yet, will add one at some point.
It would be nice if Lethe came with a command that shows basic usage. There's info
which links to this repo but it may not be understandable.
The lethe-data.json file doesn't exist! This is not an error. [debug] bypassed direct API login, used cached token Lethe#master@48048c6 TypeError: Cannot read property 'username' of undefined at new User (/root/Desktop/sh/CBOT_V2/MBOT/Lethe/node_modules/discord.js/lib/Structures/User.js:1:1705) at new PMChannel (/root/Desktop/sh/CBOT_V2/MBOT/Lethe/node_modules/discord.js/lib/Structures/PMChannel.js:1:2019) at /root/Desktop/sh/CBOT_V2/MBOT/Lethe/node_modules/discord.js/lib/Client/InternalClient.js:82:2221 at Array.forEach (<anonymous>) at WebSocket.websocket.onmessage (/root/Desktop/sh/CBOT_V2/MBOT/Lethe/node_modules/discord.js/lib/Client/InternalClient.js:82:2174) at WebSocket.onMessage (/root/Desktop/sh/CBOT_V2/MBOT/Lethe/node_modules/ws/lib/WebSocket.js:442:14) at emitTwo (events.js:126:13) at WebSocket.emit (events.js:214:7) at Receiver.onbinary (/root/Desktop/sh/CBOT_V2/MBOT/Lethe/node_modules/ws/lib/WebSocket.js:848:10) at /root/Desktop/sh/CBOT_V2/MBOT/Lethe/node_modules/ws/lib/Receiver.js:628:18 TypeError: Cannot read property 'username' of undefined at new User (/root/Desktop/sh/CBOT_V2/MBOT/Lethe/node_modules/discord.js/lib/Structures/User.js:1:1705) at new PMChannel (/root/Desktop/sh/CBOT_V2/MBOT/Lethe/node_modules/discord.js/lib/Structures/PMChannel.js:1:2019) at /root/Desktop/sh/CBOT_V2/MBOT/Lethe/node_modules/discord.js/lib/Client/InternalClient.js:82:2221 at Array.forEach (<anonymous>) at WebSocket.websocket.onmessage (/root/Desktop/sh/CBOT_V2/MBOT/Lethe/node_modules/discord.js/lib/Client/InternalClient.js:82:2174) at WebSocket.onMessage (/root/Desktop/sh/CBOT_V2/MBOT/Lethe/node_modules/ws/lib/WebSocket.js:442:14) at emitTwo (events.js:126:13) at WebSocket.emit (events.js:214:7) at Receiver.onbinary (/root/Desktop/sh/CBOT_V2/MBOT/Lethe/node_modules/ws/lib/WebSocket.js:848:10) at /root/Desktop/sh/CBOT_V2/MBOT/Lethe/node_modules/ws/lib/Receiver.js:628:18
Installation went very smoothly, no problems.
When running command
node lethe.js <email> <password>
I get result:
The lethe-data.json file doesn't exist! This is not an error.
Lethe#master@48048c6
Error: You entered a bad email!
I just created a fresh account, and confirmed that the email/password combination is correct. Any ideas?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.