Dahl99 / discordbot

A personal discord bot developed in Go
6 stars 3 forks source link

Doesn't play music #16

Open constantitus opened 1 year ago

constantitus commented 1 year ago

I'm just trying out the bot, it doesn't seem to work for me.

When I use the play command, it joins and prints the following:

[Music] Aloo!? hangs up has added Rick Astley - Never Gonna Give You Up (Official Music Video) to the queue
[Music] Now playing: Rick Astley - Never Gonna Give You Up (Official Music Video)
[Music] End of queue

The terminal log on my server:

2023/09/16 05:14:04 INFO processing command command="-play https://www.youtube.com/watch?v=dQw4w9WgXcQ"
2023/09/16 05:14:04 INFO bot is not in a voice channel, joining now userId=280831141945016321 username=constantitus
2023/09/16 05:14:05 INFO new voice instance created
2023/09/16 05:14:05 INFO finding video by ID videoID=dQw4w9WgXcQ
2023/09/16 05:14:06 INFO adding song to queue song="{ChannelID:693147376352755742 UserName:Aloo!? *hangs up* ID:280831141945016321 VideoID:dQw4w9WgXcQ Title:Rick Astley - Never Gonna Give You Up (Official Music Video) VideoURL:https://rr4---sn-gqn-vu2e7.googlevideo.com/videoplayback?expire=1694852045&ei=bQ8FZcmSM8qUgAfv8p2YCg&ip=2a02%3A2f0c%3A560d%3A3400%3A24e%3A1ff%3Afe9d%3A5d5c&id=o-AOT_yrwU3t-eY8B3khlI3lVuogOVDaUvi_8JLyIAO2Mv&itag=249&source=youtube&requiressl=yes&mh=7c&mm=31%2C29&mn=sn-gqn-vu2e7%2Csn-c0q7lnse&ms=au%2Crdu&mv=m&mvi=4&pl=40&initcwndbps=1316250&vprv=1&svpuc=1&mime=audio%2Fwebm&gir=yes&clen=1232413&dur=212.061&lmt=1694040798737498&mt=1694829714&fvip=5&keepalive=yes&fexp=24007246%2C24362685&beids=24350018&c=ANDROID&txp=4532434&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Csvpuc%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRAIgH2h0b_MUtAvWZIkxGrjbNvgVlM69-zDM8gWlfbVxumUCIFcLnJx23gV0uOK1_r8jRb3W6pcdJCc6Q-1Xy0CD_y1u&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIgOfYSIYOGNVhAAA2-PAy43LsVRVDc85QpLNTKic4EQFQCIQDC9WkgjlvhaU5rWN1rhIyDq7tUj74NFbpKRDhFGl6e_Q%3D%3D}"
2023/09/16 05:14:06 INFO Getting first song from queue
2023/09/16 05:14:06 INFO song queue is empty

Also, trying to exit with Ctrl + C throws a segmentation violation

^Cpanic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0xd0 pc=0x755d53]

goroutine 1 [running]:
github.com/notnil/chess/uci.(*Engine).processCommandLocked(0x0, {0x10016b8, 0xc000590498})
    /home/lambda/go/pkg/mod/github.com/notnil/chess@v1.9.0/uci/engine.go:157 +0x33
github.com/notnil/chess/uci.(*Engine).Run(0xe04820?, {0xc00050ae50?, 0x1, 0xc0000964e0?})
    /home/lambda/go/pkg/mod/github.com/notnil/chess@v1.9.0/uci/engine.go:133 +0x9d
github.com/notnil/chess/uci.(*Engine).Close(0x0)
    /home/lambda/go/pkg/mod/github.com/notnil/chess@v1.9.0/uci/engine.go:144 +0x58
github.com/Dahl99/discord-bot/internal/commands/chess.StopChessAi(...)
    /home/lambda/Downloads/DiscordBot/internal/commands/chess/ai.go:24
github.com/Dahl99/discord-bot/internal/bot.Start()
    /home/lambda/Downloads/DiscordBot/internal/bot/bot.go:39 +0x205
main.main()
    /home/lambda/Downloads/DiscordBot/cmd/discordbot/main.go:6 +0xf
exit status 2
Dahl99 commented 1 year ago

Hi @constantitus!

I've tried to reproduce the problem, but I haven't been able to successfully do so. Was docker used and was it from the latest commit (40afb57)?

Thanks for a reminder on the segmentation error. I`m currently in the process of rewriting the chess module from using a MySQL database (a bit of overengineering...) to be using a more lightweight database instead. This will be addressed in the same release and is completely harmless.

constantitus commented 1 year ago

I have not used docker, I just ran the bot with go run cmd/discordbot/main.go. It will probably run with docker, but I don't like using it. I've eventually found another bot that works with yt-dlp, which I prefer over setting up youtube api keys, so I'm going to stick with that one. If you need help with adressing this issue tho, I'm willing to help you debug it, but it's likely to be an issue on my end. Otherwise, I'm fine with closing the issue.