<MoonlinkPlayer>.skip() bug

When using the skip method, the <MoonlinkPlayer>.playing is returned to false
96 Replies
제스퍼
제스퍼8mo ago
NodeLink Server Log
제스퍼
제스퍼8mo ago
When I checked about the MoonlinkPlayer by eval (two queues and skip)
제스퍼
제스퍼8mo ago
No trackStart event occurs either
fascinating-indigo
fascinating-indigo8mo ago
Coincidence, that's a bug I literally fixed some few hours ago Just update your NodeLink and it should be fine Sorry for the trouble
제스퍼
제스퍼8mo ago
Ahh i will try
fascinating-indigo
fascinating-indigo8mo ago
(For updating NL, just git pull)
제스퍼
제스퍼8mo ago
same happened
fascinating-indigo
fascinating-indigo8mo ago
Mind providing newest logs from NL? & could provide me what's the output of the command git log?
제스퍼
제스퍼8mo ago
give me second
fascinating-indigo
fascinating-indigo8mo ago
Sure
제스퍼
제스퍼8mo ago
never mind now its work 😂
fascinating-indigo
fascinating-indigo8mo ago
If you have any other bug with NodeLink, feel free to create a GitHub issue instead The logs are very useful to know if it's a NodeLink bug or a client bug. If they don't say anything, and it should, then it's NodeLink mostly LMAO Feel free to DM me for any bug confirmation, but hopefully you won't find any more :)
제스퍼
제스퍼8mo ago
Thank you for always actively helping 🙂 I thought I wrote the code wrong
fascinating-indigo
fascinating-indigo8mo ago
And thanks for supporting small projects ^^ 🤣 I'm sorry for the trouble btw
제스퍼
제스퍼8mo ago
@ThePedroo Sorry for ping When playing a song, I try to adjust the sound using <MoonlinkPlayer>.setVolume(), but it's not a NodeLink problem to return the error just because the player hasn't played yet, right?
fascinating-indigo
fascinating-indigo8mo ago
I wouldn't define it as a problem as this is made on purpose But if you either try to pause or stop a player which doesn't have a playing player, it will do that not set volume though Also, dw about pinging me, I preffer that people ping me or else I won't see it till maybe days
제스퍼
제스퍼8mo ago
The user tried to set the volume value when trying to play the song. But I don't think the player was created in the meantime
MEE6
MEE68mo ago
GG @Jasper, you just advanced to level 3!
제스퍼
제스퍼8mo ago
No description
제스퍼
제스퍼8mo ago
like that
fascinating-indigo
fascinating-indigo8mo ago
Mind enabling all logs in config.js and showing the logs?
제스퍼
제스퍼8mo ago
NodeLink ?
fascinating-indigo
fascinating-indigo8mo ago
Yes, there is a logging called all
제스퍼
제스퍼8mo ago
Are these logs correct?
fascinating-indigo
fascinating-indigo8mo ago
Kinda of, let me see the crash in the end It's weird how some people can get some issues others can't
제스퍼
제스퍼8mo ago
Sorry 😂
fascinating-indigo
fascinating-indigo8mo ago
For what? 👀
제스퍼
제스퍼8mo ago
I mean, I'm sorry that I brought so many weird errors 😭
fascinating-indigo
fascinating-indigo8mo ago
Oh, I love when people send me then Makes the project more stable
제스퍼
제스퍼8mo ago
If i provide a delay with setTimeout, there will be no problem, but if i process it with then, an error will occur
No description
fascinating-indigo
fascinating-indigo8mo ago
Anyway, this happened because the client disconnected before NodeLink could actually process the play request -- so I'm not sending it to you a fix for that right now to wait me find a proper solution and send to the repo, as it's not an urgency However we must find the reason of why the client is disconnecting Mind providing your bot logs?
제스퍼
제스퍼8mo ago
Probably can't wait on Moonlink for Player to be created
fascinating-indigo
fascinating-indigo8mo ago
Some error is causing Moonlink to disconnect in this case
제스퍼
제스퍼8mo ago
[nodemon] restarting due to changes...
[nodemon] starting `ts-node ./src/app.ts`
[info] 2024-03-10 15:10:03.707 | [EVENT HANDLER] :: Loading events from client...
[info] 2024-03-10 15:10:03.713 | [COMMAND HANDLER] :: Loading command from dev category...
[info] 2024-03-10 15:10:03.715 | [COMMAND HANDLER] :: Loading command from general category...
[info] 2024-03-10 15:10:03.716 | [COMMAND HANDLER] :: Loading command from moderator category...
[info] 2024-03-10 15:10:05.171 | [EVENT HANDLER] :: Loaded event: Debug
[info] 2024-03-10 15:10:05.172 | [COMMAND HANDLER] :: Loaded command: [dev] eval
[info] 2024-03-10 15:10:05.173 | [COMMAND HANDLER] :: Loaded command: [general] Music
[info] 2024-03-10 15:10:05.173 | [COMMAND HANDLER] :: Loaded command: [general] Ping
[info] 2024-03-10 15:10:05.174 | [COMMAND HANDLER] :: Loaded command: [moderator] Ban
[info] 2024-03-10 15:10:05.175 | [COMMAND HANDLER] :: Loaded command: [moderator] Kick
[info] 2024-03-10 15:10:05.176 | [COMMAND HANDLER] :: Loaded command: [moderator] Warn
[info] 2024-03-10 15:10:05.238 | [EVENT HANDLER] :: Loaded event: Raw
[info] 2024-03-10 15:10:05.240 | [COMMAND HANDLER] :: Started refreshing application (/) commands.
[info] 2024-03-10 15:10:05.304 | [EVENT HANDLER] :: Loaded event: Ready
[info] 2024-03-10 15:10:05.305 | [EVENT HANDLER] :: Loading events from interaction...
[info] 2024-03-10 15:10:05.474 | [EVENT HANDLER] :: Loaded event: Command
[info] 2024-03-10 15:10:05.474 | [EVENT HANDLER] :: Total loaded events: 4
[debug] 2024-03-10 15:10:05.488 | [CLIENT] :: [WS => Shard 0] Shard received all its guilds. Marking as fully ready.
[info] 2024-03-10 15:10:05.489 | [CLIENT] :: Logged in as typescript-bot#7963
[info] 2024-03-10 15:10:05.495 | [MUSIC NODE] :: 192.168.0.99 connected
[info] 2024-03-10 15:10:05.810 | [COMMAND HANDLER] :: Successfully loaded application 6 (/) commands.
[debug] 2024-03-10 15:10:05.882 | [MUSIC NODE] :: 192.168.0.99 raw data:
{ op: 'ready', resumed: false, sessionId: 'IHriKaplS7gLBkw7' }
[info] 2024-03-10 15:10:05.888 | [MUSIC NODE] :: 192.168.0.99 (IHriKaplS7gLBkw7) is ready! (resumed: false)
[debug] 2024-03-10 15:10:11.510 | [CLIENT] :: [VOICE] received voice state update: {"member":{"user":{"username":"typescript-bot","public_flags":0,"id":"1205081467277803560","global_name":null,"display_name":null,"discriminator":"7963","bot":true,"avatar_decoration_data":null,"avatar":null},"roles":["1205083491000385546"],"premium_since":null,"pending":false,"nick":null,"mute":false,"joined_at":"2024-02-08T09:31:33.697000+00:00","flags":0,"deaf":false,"communication_disabled_until":null,"avatar":null},"user_id":"1205081467277803560","suppress":false,"session_id":"17e72829edd7e3b79cb4de359327db6d","self_video":false,"self_mute":false,"self_deaf":true,"request_to_speak_timestamp":null,"mute":false,"guild_id":"1163120824975380601","deaf":false,"channel_id":"1205775495069827093"}
[debug] 2024-03-10 15:10:12.238 | [CLIENT] :: [VOICE] received voice server: {"t":"VOICE_SERVER_UPDATE","s":7,"op":0,"d":{"token":"8d90ec26a321900e","guild_id":"1163120824975380601","endpoint":"south-korea1115.discord.media:443"}}
D:\develop\typescript-bot\node_modules\moonlink.js\dist\src\@Entities\MoonlinkPlayer.js:276
throw new Error("@Moonlink(Player) - cannot change volume while the player is not playing");
^
Error: @Moonlink(Player) - cannot change volume while the player is not playing
at MoonlinkPlayer.setVolume (D:\develop\typescript-bot\node_modules\moonlink.js\dist\src\@Entities\MoonlinkPlayer.js:276:19)
at D:\develop\typescript-bot\src\commands\general\Music.ts:220:30
at processTicksAndRejections (node:internal/process/task_queues:95:5)
[nodemon] restarting due to changes...
[nodemon] starting `ts-node ./src/app.ts`
[info] 2024-03-10 15:10:03.707 | [EVENT HANDLER] :: Loading events from client...
[info] 2024-03-10 15:10:03.713 | [COMMAND HANDLER] :: Loading command from dev category...
[info] 2024-03-10 15:10:03.715 | [COMMAND HANDLER] :: Loading command from general category...
[info] 2024-03-10 15:10:03.716 | [COMMAND HANDLER] :: Loading command from moderator category...
[info] 2024-03-10 15:10:05.171 | [EVENT HANDLER] :: Loaded event: Debug
[info] 2024-03-10 15:10:05.172 | [COMMAND HANDLER] :: Loaded command: [dev] eval
[info] 2024-03-10 15:10:05.173 | [COMMAND HANDLER] :: Loaded command: [general] Music
[info] 2024-03-10 15:10:05.173 | [COMMAND HANDLER] :: Loaded command: [general] Ping
[info] 2024-03-10 15:10:05.174 | [COMMAND HANDLER] :: Loaded command: [moderator] Ban
[info] 2024-03-10 15:10:05.175 | [COMMAND HANDLER] :: Loaded command: [moderator] Kick
[info] 2024-03-10 15:10:05.176 | [COMMAND HANDLER] :: Loaded command: [moderator] Warn
[info] 2024-03-10 15:10:05.238 | [EVENT HANDLER] :: Loaded event: Raw
[info] 2024-03-10 15:10:05.240 | [COMMAND HANDLER] :: Started refreshing application (/) commands.
[info] 2024-03-10 15:10:05.304 | [EVENT HANDLER] :: Loaded event: Ready
[info] 2024-03-10 15:10:05.305 | [EVENT HANDLER] :: Loading events from interaction...
[info] 2024-03-10 15:10:05.474 | [EVENT HANDLER] :: Loaded event: Command
[info] 2024-03-10 15:10:05.474 | [EVENT HANDLER] :: Total loaded events: 4
[debug] 2024-03-10 15:10:05.488 | [CLIENT] :: [WS => Shard 0] Shard received all its guilds. Marking as fully ready.
[info] 2024-03-10 15:10:05.489 | [CLIENT] :: Logged in as typescript-bot#7963
[info] 2024-03-10 15:10:05.495 | [MUSIC NODE] :: 192.168.0.99 connected
[info] 2024-03-10 15:10:05.810 | [COMMAND HANDLER] :: Successfully loaded application 6 (/) commands.
[debug] 2024-03-10 15:10:05.882 | [MUSIC NODE] :: 192.168.0.99 raw data:
{ op: 'ready', resumed: false, sessionId: 'IHriKaplS7gLBkw7' }
[info] 2024-03-10 15:10:05.888 | [MUSIC NODE] :: 192.168.0.99 (IHriKaplS7gLBkw7) is ready! (resumed: false)
[debug] 2024-03-10 15:10:11.510 | [CLIENT] :: [VOICE] received voice state update: {"member":{"user":{"username":"typescript-bot","public_flags":0,"id":"1205081467277803560","global_name":null,"display_name":null,"discriminator":"7963","bot":true,"avatar_decoration_data":null,"avatar":null},"roles":["1205083491000385546"],"premium_since":null,"pending":false,"nick":null,"mute":false,"joined_at":"2024-02-08T09:31:33.697000+00:00","flags":0,"deaf":false,"communication_disabled_until":null,"avatar":null},"user_id":"1205081467277803560","suppress":false,"session_id":"17e72829edd7e3b79cb4de359327db6d","self_video":false,"self_mute":false,"self_deaf":true,"request_to_speak_timestamp":null,"mute":false,"guild_id":"1163120824975380601","deaf":false,"channel_id":"1205775495069827093"}
[debug] 2024-03-10 15:10:12.238 | [CLIENT] :: [VOICE] received voice server: {"t":"VOICE_SERVER_UPDATE","s":7,"op":0,"d":{"token":"8d90ec26a321900e","guild_id":"1163120824975380601","endpoint":"south-korea1115.discord.media:443"}}
D:\develop\typescript-bot\node_modules\moonlink.js\dist\src\@Entities\MoonlinkPlayer.js:276
throw new Error("@Moonlink(Player) - cannot change volume while the player is not playing");
^
Error: @Moonlink(Player) - cannot change volume while the player is not playing
at MoonlinkPlayer.setVolume (D:\develop\typescript-bot\node_modules\moonlink.js\dist\src\@Entities\MoonlinkPlayer.js:276:19)
at D:\develop\typescript-bot\src\commands\general\Music.ts:220:30
at processTicksAndRejections (node:internal/process/task_queues:95:5)
fascinating-indigo
fascinating-indigo8mo ago
Ahh, that's a internal Moonlink error I thought it was a nodelink error 🤣
제스퍼
제스퍼8mo ago
yeah thats right XD
fascinating-indigo
fascinating-indigo8mo ago
The most appropriate case for this would be listening to trackStart event and set it
제스퍼
제스퍼8mo ago
umm
fascinating-indigo
fascinating-indigo8mo ago
orrrrrrrrrrr
제스퍼
제스퍼8mo ago
I think that would be good, too
fascinating-indigo
fascinating-indigo8mo ago
sending the volume together with play Sending together is more appropriate
제스퍼
제스퍼8mo ago
If i do this, it'll be output at the default sound value for about a second
fascinating-indigo
fascinating-indigo8mo ago
Yeah I thought that first but then I realized there are better ways
제스퍼
제스퍼8mo ago
If I do this, the Player will be created late, and the same error will occur
fascinating-indigo
fascinating-indigo8mo ago
Not really It will be sent in the same payload Let me see if I can find the example which does that
제스퍼
제스퍼8mo ago
Async function included play and set volume method and exec wrong code?
fascinating-indigo
fascinating-indigo8mo ago
NodeLink accuses it to be sending volume 80% on-the-play So somewhere does that
제스퍼
제스퍼8mo ago
umm
fascinating-indigo
fascinating-indigo8mo ago
Before .play Use player.volume = selected_data?.volume || 50
제스퍼
제스퍼8mo ago
Does it mean to set the <MoonlinkPlayer>.volume property?
fascinating-indigo
fascinating-indigo8mo ago
Yes
제스퍼
제스퍼8mo ago
Its work :happypepe:
fascinating-indigo
fascinating-indigo8mo ago
@1Lucas1.apk Aliás, você tem que rever isso Porque não tem como fazer o que ele quer sem fazer dessa forma -- exceto se for assim mesmo que tu queria que fizessem
제스퍼
제스퍼8mo ago
3|NodeLink Server | [ALL]: Received a request from client.
3|NodeLink Server | Path: /v4/sessions/7Z6VSFLnEslWJ4kR/players/1163120824975380601
3|NodeLink Server | Headers: {"content-type":"application/json","accept-encoding":"br","authorization":"REDACTED","host":"REDACTED","connection":"keep-alive","transfer-encoding":"chunked"}
3|NodeLink Server | Body: "{\"voice\":{\"sessionId\":\"39b51df23fb1ecb3f9e63dd76c35d676\",\"endpoint\":\"south-korea1115.discord.media:443\",\"token\":\"7b8b0d83d5e3590e\"}}"
3|NodeLink Server | [voice]: Received a request from client.
3|NodeLink Server | Params: "/v4/sessions/7Z6VSFLnEslWJ4kR/players/1163120824975380601"
3|NodeLink Server | Headers: {"content-type":"application/json","accept-encoding":"br","authorization":"REDACTED","host":"REDACTED","connection":"keep-alive","transfer-encoding":"chunked"}
3|NodeLink Server | Body: {"voice":{"sessionId":"39b51df23fb1ecb3f9e63dd76c35d676","endpoint":"south-korea1115.discord.media:443","token":"7b8b0d83d5e3590e"}}
3|NodeLink Server | [search]: Found 19 tracks on YouTube for query 7 Years
3|NodeLink Server | [ALL]: Received a request from client.
3|NodeLink Server | Path: /v4/sessions/7Z6VSFLnEslWJ4kR/players/1163120824975380601
3|NodeLink Server | Headers: {"content-type":"application/json","accept-encoding":"br","authorization":"REDACTED","host":"REDACTED","connection":"keep-alive","transfer-encoding":"chunked"}
3|NodeLink Server | Body: "{\"track\":{\"encoded\":\"QAAAywMALUx1a2FzIEdyYWhhbSAtIDcgWWVhcnMgW09mZmljaWFsIE11c2ljIFZpZGVvXQAMTHVrYXMgR3JhaGFtAAAAAAADqYAAC0xIQ29iNzZraWdBAAEAK2h0dHBzOi8vd3d3LnlvdXR1YmUuY29tL3dhdGNoP3Y9TEhDb2I3NmtpZ0EBADRodHRwczovL2kueXRpbWcuY29tL3ZpL0xIQ29iNzZraWdBL21heHJlc2RlZmF1bHQuanBnAAAHeW91dHViZQAAAAAAAAAA\"},\"volume\":30}"
3|NodeLink Server | [play]: Received a request from client.
3|NodeLink Server | Params: "/v4/sessions/7Z6VSFLnEslWJ4kR/players/1163120824975380601"
3|NodeLink Server | Headers: {"content-type":"application/json","accept-encoding":"br","authorization":"REDACTED","host":"REDACTED","connection":"keep-alive","transfer-encoding":"chunked"}
3|NodeLink Server | Body: {"track":{"encoded":"QAAAywMALUx1a2FzIEdyYWhhbSAtIDcgWWVhcnMgW09mZmljaWFsIE11c2ljIFZpZGVvXQAMTHVrYXMgR3JhaGFtAAAAAAADqYAAC0xIQ29iNzZraWdBAAEAK2h0dHBzOi8vd3d3LnlvdXR1YmUuY29tL3dhdGNoP3Y9TEhDb2I3NmtpZ0EBADRodHRwczovL2kueXRpbWcuY29tL3ZpL0xIQ29iNzZraWdBL21heHJlc2RlZmF1bHQuanBnAAAHeW91dHViZQAAAAAAAAAA"},"volume":30}
3|NodeLink Server | [volume]: Received a request from client.
3|NodeLink Server | Params: "/v4/sessions/7Z6VSFLnEslWJ4kR/players/1163120824975380601"
3|NodeLink Server | Body: {"track":{"encoded":"QAAAywMALUx1a2FzIEdyYWhhbSAtIDcgWWVhcnMgW09mZmljaWFsIE11c2ljIFZpZGVvXQAMTHVrYXMgR3JhaGFtAAAAAAADqYAAC0xIQ29iNzZraWdBAAEAK2h0dHBzOi8vd3d3LnlvdXR1YmUuY29tL3dhdGNoP3Y9TEhDb2I3NmtpZ0EBADRodHRwczovL2kueXRpbWcuY29tL3ZpL0xIQ29iNzZraWdBL21heHJlc2RlZmF1bHQuanBnAAAHeW91dHViZQAAAAAAAAAA"},"volume":30}
3|NodeLink Server | [trackStart]: Lukas Graham - 7 Years [Official Music Video] by Lukas Graham.
3|NodeLink Server | [ALL]: Received a request from client.
3|NodeLink Server | Path: /v4/sessions/7Z6VSFLnEslWJ4kR/players/1163120824975380601
3|NodeLink Server | Headers: {"content-type":"application/json","accept-encoding":"br","authorization":"REDACTED","host":"REDACTED","connection":"keep-alive","transfer-encoding":"chunked"}
3|NodeLink Server | Body: "{\"voice\":{\"sessionId\":\"39b51df23fb1ecb3f9e63dd76c35d676\",\"endpoint\":\"south-korea1115.discord.media:443\",\"token\":\"7b8b0d83d5e3590e\"}}"
3|NodeLink Server | [voice]: Received a request from client.
3|NodeLink Server | Params: "/v4/sessions/7Z6VSFLnEslWJ4kR/players/1163120824975380601"
3|NodeLink Server | Headers: {"content-type":"application/json","accept-encoding":"br","authorization":"REDACTED","host":"REDACTED","connection":"keep-alive","transfer-encoding":"chunked"}
3|NodeLink Server | Body: {"voice":{"sessionId":"39b51df23fb1ecb3f9e63dd76c35d676","endpoint":"south-korea1115.discord.media:443","token":"7b8b0d83d5e3590e"}}
3|NodeLink Server | [search]: Found 19 tracks on YouTube for query 7 Years
3|NodeLink Server | [ALL]: Received a request from client.
3|NodeLink Server | Path: /v4/sessions/7Z6VSFLnEslWJ4kR/players/1163120824975380601
3|NodeLink Server | Headers: {"content-type":"application/json","accept-encoding":"br","authorization":"REDACTED","host":"REDACTED","connection":"keep-alive","transfer-encoding":"chunked"}
3|NodeLink Server | Body: "{\"track\":{\"encoded\":\"QAAAywMALUx1a2FzIEdyYWhhbSAtIDcgWWVhcnMgW09mZmljaWFsIE11c2ljIFZpZGVvXQAMTHVrYXMgR3JhaGFtAAAAAAADqYAAC0xIQ29iNzZraWdBAAEAK2h0dHBzOi8vd3d3LnlvdXR1YmUuY29tL3dhdGNoP3Y9TEhDb2I3NmtpZ0EBADRodHRwczovL2kueXRpbWcuY29tL3ZpL0xIQ29iNzZraWdBL21heHJlc2RlZmF1bHQuanBnAAAHeW91dHViZQAAAAAAAAAA\"},\"volume\":30}"
3|NodeLink Server | [play]: Received a request from client.
3|NodeLink Server | Params: "/v4/sessions/7Z6VSFLnEslWJ4kR/players/1163120824975380601"
3|NodeLink Server | Headers: {"content-type":"application/json","accept-encoding":"br","authorization":"REDACTED","host":"REDACTED","connection":"keep-alive","transfer-encoding":"chunked"}
3|NodeLink Server | Body: {"track":{"encoded":"QAAAywMALUx1a2FzIEdyYWhhbSAtIDcgWWVhcnMgW09mZmljaWFsIE11c2ljIFZpZGVvXQAMTHVrYXMgR3JhaGFtAAAAAAADqYAAC0xIQ29iNzZraWdBAAEAK2h0dHBzOi8vd3d3LnlvdXR1YmUuY29tL3dhdGNoP3Y9TEhDb2I3NmtpZ0EBADRodHRwczovL2kueXRpbWcuY29tL3ZpL0xIQ29iNzZraWdBL21heHJlc2RlZmF1bHQuanBnAAAHeW91dHViZQAAAAAAAAAA"},"volume":30}
3|NodeLink Server | [volume]: Received a request from client.
3|NodeLink Server | Params: "/v4/sessions/7Z6VSFLnEslWJ4kR/players/1163120824975380601"
3|NodeLink Server | Body: {"track":{"encoded":"QAAAywMALUx1a2FzIEdyYWhhbSAtIDcgWWVhcnMgW09mZmljaWFsIE11c2ljIFZpZGVvXQAMTHVrYXMgR3JhaGFtAAAAAAADqYAAC0xIQ29iNzZraWdBAAEAK2h0dHBzOi8vd3d3LnlvdXR1YmUuY29tL3dhdGNoP3Y9TEhDb2I3NmtpZ0EBADRodHRwczovL2kueXRpbWcuY29tL3ZpL0xIQ29iNzZraWdBL21heHJlc2RlZmF1bHQuanBnAAAHeW91dHViZQAAAAAAAAAA"},"volume":30}
3|NodeLink Server | [trackStart]: Lukas Graham - 7 Years [Official Music Video] by Lukas Graham.
fascinating-indigo
fascinating-indigo8mo ago
The NL logs seems fine
제스퍼
제스퍼8mo ago
Yeah 🙂
fascinating-indigo
fascinating-indigo8mo ago
Awesome! :) Lmk if you have any further issues or questions
제스퍼
제스퍼8mo ago
I'm always grateful that you've helped me in something that's not a big deal ❤️
fascinating-indigo
fascinating-indigo8mo ago
That's what I call open source community ^^
1Lucas1.apk
1Lucas1.apk8mo ago
But his If is wrong... If(player.playing) without the question mark, it will try to emit every time it is not playing
fascinating-indigo
fascinating-indigo8mo ago
Wouldn't affect anything at normal case though
1Lucas1.apk
1Lucas1.apk8mo ago
Affects
fascinating-indigo
fascinating-indigo8mo ago
Não afeta o problema que ele queria resolver Ele queria setar o volume ao tocar
1Lucas1.apk
1Lucas1.apk8mo ago
Tentar mudar um volume em um player que não tá tocando??
fascinating-indigo
fascinating-indigo8mo ago
Não Ele queria setar o volume on-the-play
1Lucas1.apk
1Lucas1.apk8mo ago
É o que o comando faz
fascinating-indigo
fascinating-indigo8mo ago
Mas a única forma de fazer isso é mudando o this.volume direto Isso não é on-the-play, ele não vai junto ao pedido pra tocar Precisa ser no mesmo payload
1Lucas1.apk
1Lucas1.apk8mo ago
Só era colocar no create
fascinating-indigo
fascinating-indigo8mo ago
Seria útil no play tu deixar a pessoa fazer on-the-play de qualquer forma É útil pra reduzir latência porque aí vai tudo no mesmo request
1Lucas1.apk
1Lucas1.apk8mo ago
Vou encher de ifs se eu fizer
fascinating-indigo
fascinating-indigo8mo ago
KKKKK é só adicionar um parâmetro no play pra enviar coisa junta
1Lucas1.apk
1Lucas1.apk8mo ago
Usa create
fascinating-indigo
fascinating-indigo8mo ago
Mas e depois no segundo play e se ele quiser alterar o volume?
1Lucas1.apk
1Lucas1.apk8mo ago
Altera o parâmetro
fascinating-indigo
fascinating-indigo8mo ago
Qual?
1Lucas1.apk
1Lucas1.apk8mo ago
volume
fascinating-indigo
fascinating-indigo8mo ago
this.volume?
1Lucas1.apk
1Lucas1.apk8mo ago
Ele é sempre acionado junto com o play
fascinating-indigo
fascinating-indigo8mo ago
Se for o this.volume foi oq foi usado mesmo
1Lucas1.apk
1Lucas1.apk8mo ago
GitHub
moonlink.js/src/@Entities/MoonlinkPlayer.ts at v3 · Ecliptia/moonli...
MoonLink.js is a simple package for lavalink client, perfect for you to create your discord bot with songs, and very simple and easy to use. - Ecliptia/moonlink.js
fascinating-indigo
fascinating-indigo8mo ago
Sim, por isso eu falei pra usar o this.volume Aliás, eu não tinha achado como alterar o volume no create
제스퍼
제스퍼8mo ago
what happened
MEE6
MEE68mo ago
GG @Jasper, you just advanced to level 4!
fascinating-indigo
fascinating-indigo8mo ago
^ Seems like you also set the volume on the create function too
제스퍼
제스퍼8mo ago
When using the command, we implemented the track to be selected and played by the user based on the search. I was just trying to adjust the volume based on the selection.
const query = interaction.options.getString("쿼리", true);

if (!voiceChannel.joinable)
return interaction.reply({
content: `봇이 해당 음성채널에 입장할 수 있는 권한이 없습니다.`
});

const player = client.music.player.players.create({
guildId: interaction.guild.id,
voiceChannel: voiceChannel.id,
textChannel: interaction.channel.id,
autoPlay: selected_data ? Boolean(selected_data.autoPlay) : true,
autoLeave: selected_data ? Boolean(selected_data.autoLeave) : false
});

player.volume = selected_data ? selected_data.volume : 50;

if (!player.connected) {
player.connect({
setDeaf: true,
setMute: false
});
}

const res = await client.music.player.search({
query,
source: "youtube",
requester: interaction.user.id
});

if (res.loadType === "error") {
return interaction.reply({
content: `어라.. 현재 시스템이 원활하지 않은 모양이에요. 시간 지나고 다시 시도해 보면 될 거예요!`
});
} else if (res.loadType === "empty") {
return interaction.reply({
content: `\`${query}\`에 대해 검색해봤는데 찾을 수 없어요.`
});
}

if (res.loadType === "playlist") {
interaction.reply({
content: `\`${res.playlistInfo?.name}\` 해당 플레이리스트에 대해 대기열에 추가했어요.`
});

for (const track of res.tracks) {
player.queue.add(track);
}
} else {
const selectMenu = new StringSelectMenuBuilder()
.setCustomId("select_track")
.setPlaceholder("노래를 선택해주세요.")
.addOptions(
res.tracks.slice(0, 25).map((track) => ({
label:
track.title.length > 100
? track.title.slice(0, 97) + "..."
: track.title,
description:
track.author.length > 50
? track.author.slice(0, 47) + "..."
: track.author,
value: track.identifier
}))
);

const row =
new ActionRowBuilder<StringSelectMenuBuilder>().addComponents(
selectMenu
);

const response = await interaction.reply({
content:
"입력하신 쿼리를 기반으로 아래의 검색 결과를 출력하였습니다.",
components: [row]
});

const collectorFilter = (i: { user: { id: string } }) =>
i.user.id === interaction.user.id;
try {
const confirmation = await response.awaitMessageComponent({
filter: collectorFilter,
time: 30_000,
componentType: ComponentType.StringSelect
});

if (confirmation.customId === "select_track") {
const selectedTrack = res.tracks.find(
(track) => track.identifier === confirmation.values[0]
);

if (selectedTrack) {
player.queue.add(selectedTrack);
await confirmation.update({
content: `\`${selectedTrack.title} - ${await client.date.millisecondsToDuration(selectedTrack.duration)}\` 해당 노래를 대기열에 추가했어요.`,
components: []
});
if (!player.playing) {
player.play();
// player.setVolume();
}
}
}
} catch (e) {
await interaction.editReply({
content: "제한 시간 내에 버튼을 누르지 않아 취소되었습니다.",
components: []
});
}
}
const query = interaction.options.getString("쿼리", true);

if (!voiceChannel.joinable)
return interaction.reply({
content: `봇이 해당 음성채널에 입장할 수 있는 권한이 없습니다.`
});

const player = client.music.player.players.create({
guildId: interaction.guild.id,
voiceChannel: voiceChannel.id,
textChannel: interaction.channel.id,
autoPlay: selected_data ? Boolean(selected_data.autoPlay) : true,
autoLeave: selected_data ? Boolean(selected_data.autoLeave) : false
});

player.volume = selected_data ? selected_data.volume : 50;

if (!player.connected) {
player.connect({
setDeaf: true,
setMute: false
});
}

const res = await client.music.player.search({
query,
source: "youtube",
requester: interaction.user.id
});

if (res.loadType === "error") {
return interaction.reply({
content: `어라.. 현재 시스템이 원활하지 않은 모양이에요. 시간 지나고 다시 시도해 보면 될 거예요!`
});
} else if (res.loadType === "empty") {
return interaction.reply({
content: `\`${query}\`에 대해 검색해봤는데 찾을 수 없어요.`
});
}

if (res.loadType === "playlist") {
interaction.reply({
content: `\`${res.playlistInfo?.name}\` 해당 플레이리스트에 대해 대기열에 추가했어요.`
});

for (const track of res.tracks) {
player.queue.add(track);
}
} else {
const selectMenu = new StringSelectMenuBuilder()
.setCustomId("select_track")
.setPlaceholder("노래를 선택해주세요.")
.addOptions(
res.tracks.slice(0, 25).map((track) => ({
label:
track.title.length > 100
? track.title.slice(0, 97) + "..."
: track.title,
description:
track.author.length > 50
? track.author.slice(0, 47) + "..."
: track.author,
value: track.identifier
}))
);

const row =
new ActionRowBuilder<StringSelectMenuBuilder>().addComponents(
selectMenu
);

const response = await interaction.reply({
content:
"입력하신 쿼리를 기반으로 아래의 검색 결과를 출력하였습니다.",
components: [row]
});

const collectorFilter = (i: { user: { id: string } }) =>
i.user.id === interaction.user.id;
try {
const confirmation = await response.awaitMessageComponent({
filter: collectorFilter,
time: 30_000,
componentType: ComponentType.StringSelect
});

if (confirmation.customId === "select_track") {
const selectedTrack = res.tracks.find(
(track) => track.identifier === confirmation.values[0]
);

if (selectedTrack) {
player.queue.add(selectedTrack);
await confirmation.update({
content: `\`${selectedTrack.title} - ${await client.date.millisecondsToDuration(selectedTrack.duration)}\` 해당 노래를 대기열에 추가했어요.`,
components: []
});
if (!player.playing) {
player.play();
// player.setVolume();
}
}
}
} catch (e) {
await interaction.editReply({
content: "제한 시간 내에 버튼을 누르지 않아 취소되었습니다.",
components: []
});
}
}
For now, I wrote the code as above.
fascinating-indigo
fascinating-indigo8mo ago
To change the volume on-the-play, seems like this is the only way
제스퍼
제스퍼8mo ago
i think so
fascinating-indigo
fascinating-indigo8mo ago
@1Lucas1.apk ?
제스퍼
제스퍼8mo ago
It's been a while since I've studied typescript, so the code can be terrible 😂
1Lucas1.apk
1Lucas1.apk8mo ago
GitHub
moonlink.js/src/@Entities/MoonlinkPlayer.ts at v3 · Ecliptia/moonli...
MoonLink.js is a simple package for lavalink client, perfect for you to create your discord bot with songs, and very simple and easy to use. - Ecliptia/moonlink.js
1Lucas1.apk
1Lucas1.apk8mo ago
Tudo que vem do construtor é usado Desde autoPlay até node Se quiser colocar que ele já venha com connected e playing pode até colocar 😘
fascinating-indigo
fascinating-indigo8mo ago
ATA Por isso que não vi explicitamente As long as it works -- but it's always important to keep the code clean
제스퍼
제스퍼8mo ago
I'll do my best. 🙂
fascinating-indigo
fascinating-indigo8mo ago
If you need any help with making a code more readable, count on us too :)
Want results from more Discord servers?
Add your server