Closed NedcloarBR closed 1 year ago
Hello.
First before I suggest you how to solve the problem, some improvement "advices"
client.on("raw", data => {
switch (data.t) {
case "VOICE_SERVER_UPDATE":
case "VOICE_STATE_UPDATE":
this.sendRawData(data.d);
break;
}
});
The raw event, doesn't just require the base raw message for voice changes, also all raw event datas for stuff like channeldelete recognition, therfore you don't have to handle that!
client.on("raw", data => this.sendRawData(data.d));
Next the "playerCreate" function, returns getPlayer if players.has(playerGuildId)
const player = MusicTools.createPlayer(
client,
message.member.voice.channel as VoiceChannel,
message.channelId);
Aka you can just do this and it will be fine
I think something's wrong with the raw listener / shard sending data, as player.voice is all null..
Could you edit node_modules / src for debug logs so you can see if the "raw" data surpasses the following things:
Just go to lavalinkmanager -> sendRawData function, alocate this:
await player.node.updatePlayer({
guildId: player.guildId,
playerOptions: {
voice: {
token: update.token,
endpoint: update.endpoint,
sessionId: player.voice?.sessionId,
}
}
});
add a console.log infront, if you never see the console log, your raw event isn't working...
If that's not the problme, then sending data to shards might not work on your end, i don't know what discord client library you are using
It says "not paused" cause it prolly never said "starting to play" aka player.paused = false player.playing = false
the problem of searching working but no audio either comes from raw event wrong / shards sending not working
Good afternoon! Thanks for the reply. I changed the raw event and the sendRawData function and it continues without playing the audio in the call but when I use my nowPlaying command it shows the progress of the song so the audio is being sent but not playing in the call
I didn't understand the part of editing the node_modules allocating the code and logging to see if the raw event is working properly
Edit: even with the status of the song being played and having changes in the progressbar of my nowplaying the trackStart event does not fire
I'm using Discord.js v14.13.0, lavalink-client github source, typescript v5.1.6
Sorry for my bad english 😵💫
do
lavalink.nodeManager.on("raw", (node, payload) => console.log(payload));
or try to figure out the problem by adding:
new Manager({
...
debugOptions: { noAudio: true }
})
maybe it's because you didn't provide the proper: managerOptions#client.id
raw event returns when th bot is ready
{ op: 'ready', resumed: false, sessionId: 'nosidru2opc3n9yc' }
{
op: 'stats',
frameStats: null,
players: 0,
playingPlayers: 0,
uptime: 299407,
memory: {
free: 47397584,
used: 63751472,
allocated: 111149056,
reservable: 4183818240
},
cpu: { cores: 12, systemLoad: 0.09708139865441107, lavalinkLoad: 0 }
}
when I use an command that uses player.search
{
op: 'playerUpdate',
state: { time: 1692815747471, position: 0, connected: true, ping: 0 },
guildId: '679066351456878633'
}
debug: noAudio Bot is starting
Lavalink-Client-Debug | NO-AUDIO [::] sendRawData function, manager is not initated yet (20+x)
when I use an command that uses player.search
Lavalink-Client-Debug | NO-AUDIO [::] sendRawData function, Sent updatePlayer for voice token session {
voice: {
token: '93fc83eb7b******',
endpoint: 'buenos-aires4905.discord.media:443',
sessionId: '94205ce9831c8b6ac011160**********'
}
}
when bot is disconected and auto reconects to a VoiceChannel
Lavalink-Client-Debug | NO-AUDIO [::] sendRawData function, No Lavalink Player found via key: 'guild_id' of update-data: {
member: {
user: {
username: 'N-D-B',
public_flags: 0,
id: '708822043420000366',
global_name: null,
display_name: null,
discriminator: '9904',
bot: true,
avatar_decoration_data: null,
avatar: 'b594f185569555b706f32a0fcd5bef74'
},
roles: [ '796380206721794089', '748269739859509300' ],
premium_since: null,
pending: false,
nick: '[&] N-D-B',
mute: false,
joined_at: '2020-08-26T19:56:48.233000+00:00',
flags: 0,
deaf: true,
communication_disabled_until: null,
avatar: null
},
user_id: '708822043420000366',
suppress: false,
session_id: '94205ce9831c8b6ac011160fdd1f90f8',
self_video: false,
self_mute: false,
self_deaf: true,
request_to_speak_timestamp: null,
mute: false,
guild_id: '679066351456878633',
deaf: true,
channel_id: '796380288200474624'
}
Lavalink-Client-Debug | NO-AUDIO [::] sendRawData function, No Lavalink Player found via key: 'guild_id' of update-data: {
token: 'fbdab7002b******',
guild_id: '679066351456878633',
endpoint: 'buenos-aires4905.discord.media:443'
}
Still no audio returning? Do you init the manager?
Is the code of your bot open source, so i can reproduce it?
Do you have the voice intents provided
audio is still not being returned I started the manager at my bot's ready event yes my bot is open source The master branch does not have the current code using with the bot using lavalink-client. I'll create another branch with the current code All intents are active
Edit: Branch created
Since you are using discord.js, do the followings:
instead of doing this
sendToShard(id, payload) {
return client.ws.shards
.get(client.guilds.cache.get(id)!.shardId)!
.send(payload);
},
do this:
sendToShard(id, payload) {
return client.guilds.cache.get(id)?.shard?.send(payload);
},
make sure to use latest Lavalink.jar version, and latest lavasrc version.
I can't really test it hence your to make your project "working" in my windows environment i have to tweak so many things..
If you want, we can hop in a discord voice call. simply dm me: chrissy8283
.
I really wanna know why it's not working.
No audio beeing plaid really has only one of those reasons:
After a conversation on Discord testing some things in the bot and lib was found the bug that has already been fixed in version 1.1.10
I migrated my bot from your fork of Erela.js to this new package and I'm experiencing some problems When I use my play command to play the music the bot connects to the voice channel but does not start playing the music, but if I check if the player is paused or not it says no, and if I check if it is connected returns false
TestPlay Command
Lavalink Manager
Get/Create Player functions
console.log(player)