TypeError: Cannot read properties of undefined (reading 'guildId')

Hello. Im getting the TypeError: Cannot read properties of undefined (reading 'guildId') error but i cant get why. I have 3 buttons and the 1st and the 2nd button works fine but the 3th not and im confused because i used the client.moon.players.get() exactly like i did at the 1st and the 2nd button. this is how i used to get the player:
const player = client.moon.players.get(guild_id);
const player = client.moon.players.get(guild_id);
(the guild_id is a let value and it is working its not undefined or null because at the 1st and the 2nd button it works too.)
73 Replies
1Lucas1.apk
1Lucas1.apk2y ago
Hello Could you give me the complete error that appears in the console, there are important parts below that show where it went This can help us find the error
adverse-sapphire
adverse-sapphireOP2y ago
Sure! I know its important but i can only send it tomorrow. I didnt sent the entire error because idk why.
1Lucas1.apk
1Lucas1.apk2y ago
maybe, the daytime developers will help you when you submit the full bug, if you want to wait until nighttime to provide you with better support
adverse-sapphire
adverse-sapphireOP2y ago
C:\Users\janjy\OneDrive\Dokumente\Soundpro\node_modules\moonlink.js\@Moonlink\MoonlinkPlayer.js:230
...player[this.infos.guildId]
^

TypeError: Cannot read properties of undefined (reading 'guildId')
at MoonPlayer.setLoop (C:\Users\janjy\OneDrive\Dokumente\Soundpro\node_modules\moonlink.js\@Moonlink\MoonlinkPlayer.js:230:30)
at InteractionCollector.<anonymous> (C:\Users\janjy\OneDrive\Dokumente\Soundpro\src\events\moonlink\trackStart.js:452:56)
at InteractionCollector.emit (node:events:525:35)
at InteractionCollector.handleCollect (C:\Users\janjy\OneDrive\Dokumente\Soundpro\node_modules\discord.js\src\structures\interfaces\Collector.js:133:14)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
C:\Users\janjy\OneDrive\Dokumente\Soundpro\node_modules\moonlink.js\@Moonlink\MoonlinkPlayer.js:230
...player[this.infos.guildId]
^

TypeError: Cannot read properties of undefined (reading 'guildId')
at MoonPlayer.setLoop (C:\Users\janjy\OneDrive\Dokumente\Soundpro\node_modules\moonlink.js\@Moonlink\MoonlinkPlayer.js:230:30)
at InteractionCollector.<anonymous> (C:\Users\janjy\OneDrive\Dokumente\Soundpro\src\events\moonlink\trackStart.js:452:56)
at InteractionCollector.emit (node:events:525:35)
at InteractionCollector.handleCollect (C:\Users\janjy\OneDrive\Dokumente\Soundpro\node_modules\discord.js\src\structures\interfaces\Collector.js:133:14)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Additional informations: Nodejs: v18.15.0 Discordjs: v14.8.0 Moonlink.js: v1.10.70 wait let me try updating to the latest moonlink version.
1Lucas1.apk
1Lucas1.apk2y ago
You will have to update parts of your scripts if you update updateVoiceState is now packetUpdate
adverse-sapphire
adverse-sapphireOP2y ago
i got got the error about that right now. but i suggest you to update the README of the package if you change such stuff.
MEE6
MEE62y ago
GG @WhiteHell, you just advanced to level 1!
1Lucas1.apk
1Lucas1.apk2y ago
I changed
adverse-sapphire
adverse-sapphireOP2y ago
no see the "Getting started" of the readme
adverse-sapphire
adverse-sapphireOP2y ago
updating the package version didnt helped wait so i guess its a issue with npm since the entire readme is gone now
1Lucas1.apk
1Lucas1.apk2y ago
I'm checking the codes if there are any errors
adverse-sapphire
adverse-sapphireOP2y ago
npm and its issues :/
No description
adverse-sapphire
adverse-sapphireOP2y ago
alright, thank you.
1Lucas1.apk
1Lucas1.apk2y ago
Oh my god I didn't update the package readme
adverse-sapphire
adverse-sapphireOP2y ago
happened to me and my package yesterday too lol
1Lucas1.apk
1Lucas1.apk2y ago
Did you check if the guildId property has a value in the players get?
adverse-sapphire
adverse-sapphireOP2y ago
yes wait i have 3 buttons. the "loop song", the "loop queue" and the "disable loop" button. all of them works with guild_id but the "disable loop" not. i have checked my code it should be all right on my side
1Lucas1.apk
1Lucas1.apk2y ago
Could you provide the part of the code that calls the players to execution? to know if in this case it is the class or event that is not receiving the value
adverse-sapphire
adverse-sapphireOP2y ago
im confused. so you want to know if the guild value works?
1Lucas1.apk
1Lucas1.apk2y ago
In place of event is function*
adverse-sapphire
adverse-sapphireOP2y ago
wait so the event "trackStart" ?
1Lucas1.apk
1Lucas1.apk2y ago
I'm doing a check I just wanted the code part
adverse-sapphire
adverse-sapphireOP2y ago
it has 500+ lines. which one exactly? the part where it has the buttons function?
1Lucas1.apk
1Lucas1.apk2y ago
A from setLoop
adverse-sapphire
adverse-sapphireOP2y ago
wait
1Lucas1.apk
1Lucas1.apk2y ago
?play depois do universo
adverse-sapphire
adverse-sapphireOP2y ago
here is the collector:
collector.on('collect', async i => {
if (i.customId === 'enable_song_loop-' + guild_id) {
const player = client.moon.players.get(guild_id);

player.setLoop(1);

message_1.edit({ embeds: [embed5], components: [row1, row2, row3] });
i.update({ embeds: [
new EmbedBuilder()
.setTitle('✅ Successfully enabled the \`\`song\`\` loop mode.')
.setColor('#2f3136')
], components: [], ephemeral: true });

collector.stop();
}
if (i.customId === 'enable_queue_loop-' + guild_id) {
const player = client.moon.players.get(guild_id);

player.setLoop(2);

message_1.edit({ embeds: [embed6], components: [row1, row2, row3] });
i.update({ embeds: [
new EmbedBuilder()
.setTitle('✅ Successfully enabled the \`\`queue\`\` loop mode.')
.setColor('#2f3136')
], components: [], ephemeral: true });

collector.stop();
}

if (i.customId === 'disable_loop-' + guild_id) {
console.log(guild_id);
const player = client.moon.players.get(guild_id);

if (!player.loop === 1 || !player.loop === 2) return i.reply({ embeds: [
new EmbedBuilder()
.setTitle('❌ The loop mode is already disabled.')
.setColor('#2f3136')
], components: [], ephemeral: true });

player.setLoop(null);

message_1.edit({ embeds: [embed7], components: [row1, row4, row3] });
i.update({ embeds: [
new EmbedBuilder()
.setTitle('✅ Successfully disabled the loop mode.')
.setColor('#2f3136')
], components: [], ephemeral: true });

collector.stop();
}
});
collector.on('collect', async i => {
if (i.customId === 'enable_song_loop-' + guild_id) {
const player = client.moon.players.get(guild_id);

player.setLoop(1);

message_1.edit({ embeds: [embed5], components: [row1, row2, row3] });
i.update({ embeds: [
new EmbedBuilder()
.setTitle('✅ Successfully enabled the \`\`song\`\` loop mode.')
.setColor('#2f3136')
], components: [], ephemeral: true });

collector.stop();
}
if (i.customId === 'enable_queue_loop-' + guild_id) {
const player = client.moon.players.get(guild_id);

player.setLoop(2);

message_1.edit({ embeds: [embed6], components: [row1, row2, row3] });
i.update({ embeds: [
new EmbedBuilder()
.setTitle('✅ Successfully enabled the \`\`queue\`\` loop mode.')
.setColor('#2f3136')
], components: [], ephemeral: true });

collector.stop();
}

if (i.customId === 'disable_loop-' + guild_id) {
console.log(guild_id);
const player = client.moon.players.get(guild_id);

if (!player.loop === 1 || !player.loop === 2) return i.reply({ embeds: [
new EmbedBuilder()
.setTitle('❌ The loop mode is already disabled.')
.setColor('#2f3136')
], components: [], ephemeral: true });

player.setLoop(null);

message_1.edit({ embeds: [embed7], components: [row1, row4, row3] });
i.update({ embeds: [
new EmbedBuilder()
.setTitle('✅ Successfully disabled the loop mode.')
.setColor('#2f3136')
], components: [], ephemeral: true });

collector.stop();
}
});
("enable_queue_loop" and "enable_song_loop" works fine)
Blobit - Moonlink.js
discordlogo Music.
<:Nota_Musica__Mlink:960665601574055966>╺╸Title:
<:Estrela_Mlink:960660485999587348>╺╸Uri:
<:emoji_21:967836966714503168>╺╸Author:
GIULIA BE
<:emoji_23:967837516558393365>╺╸Duration:
0 Days, 0 Hours, 3 Minutes, 188 Seconds
From An unknown user
Request for: 1Lucas1.apk
Blobit - Moonlink.js
GIULIA BE - DEPOIS DO UNIVERSO (official music video) is playing now
1Lucas1.apk
1Lucas1.apk2y ago
?eval client.moon.players.get(message.guild.id).setLoop(1)
Blobit - Moonlink.js
undefined
undefined
1Lucas1.apk
1Lucas1.apk2y ago
?eval client.moon.players.get(message.guild.id).setLoop(null)
Blobit - Moonlink.js
TypeError: Cannot read properties of undefined (reading 'guildId')
TypeError: Cannot read properties of undefined (reading 'guildId')
1Lucas1.apk
1Lucas1.apk2y ago
Internal error even in the disabling part
adverse-sapphire
adverse-sapphireOP2y ago
but setLoop(1 - 2) works for me so
MEE6
MEE62y ago
GG @WhiteHell, you just advanced to level 2!
1Lucas1.apk
1Lucas1.apk2y ago
?play depois do universo
Blobit - Moonlink.js
discordlogo Music.
<:Nota_Musica__Mlink:960665601574055966>╺╸Title:
<:Estrela_Mlink:960660485999587348>╺╸Uri:
<:emoji_21:967836966714503168>╺╸Author:
GIULIA BE
<:emoji_23:967837516558393365>╺╸Duration:
0 Days, 0 Hours, 3 Minutes, 188 Seconds
From An unknown user
Request for: 1Lucas1.apk
Blobit - Moonlink.js
GIULIA BE - DEPOIS DO UNIVERSO (official music video) is playing now
1Lucas1.apk
1Lucas1.apk2y ago
?eval client.moon.players.get(message.guild.id).setLoop(1)
Blobit - Moonlink.js
undefined
undefined
1Lucas1.apk
1Lucas1.apk2y ago
?eval client.moon.players.get(message.guild.id).setLoop(null)
Blobit - Moonlink.js
TypeError: [ MoonlinkJs ]: loop accept only numbers in strings.
TypeError: [ MoonlinkJs ]: loop accept only numbers in strings.
1Lucas1.apk
1Lucas1.apk2y ago
?play depois do universo
Blobit - Moonlink.js
discordlogo Music.
<:Nota_Musica__Mlink:960665601574055966>╺╸Title:
<:Estrela_Mlink:960660485999587348>╺╸Uri:
<:emoji_21:967836966714503168>╺╸Author:
GIULIA BE
<:emoji_23:967837516558393365>╺╸Duration:
0 Days, 0 Hours, 3 Minutes, 188 Seconds
From An unknown user
Request for: 1Lucas1.apk
Blobit - Moonlink.js
GIULIA BE - DEPOIS DO UNIVERSO (official music video) is playing now
1Lucas1.apk
1Lucas1.apk2y ago
?eval client.moon.players.get(message.guild.id).setLoop(1)
Blobit - Moonlink.js
undefined
undefined
1Lucas1.apk
1Lucas1.apk2y ago
?eval client.moon.players.get(message.guild.id).setLoop()
Blobit - Moonlink.js
TypeError: [ MoonlinkJs ]: loop accept only numbers in strings.
TypeError: [ MoonlinkJs ]: loop accept only numbers in strings.
1Lucas1.apk
1Lucas1.apk2y ago
?play depois do universo
Blobit - Moonlink.js
discordlogo Music.
<:Nota_Musica__Mlink:960665601574055966>╺╸Title:
<:Estrela_Mlink:960660485999587348>╺╸Uri:
<:emoji_21:967836966714503168>╺╸Author:
GIULIA BE
<:emoji_23:967837516558393365>╺╸Duration:
0 Days, 0 Hours, 3 Minutes, 188 Seconds
From An unknown user
Request for: 1Lucas1.apk
Blobit - Moonlink.js
GIULIA BE - DEPOIS DO UNIVERSO (official music video) is playing now
1Lucas1.apk
1Lucas1.apk2y ago
?eval client.moon.players.get(message.guild.id).setLoop(1)
Blobit - Moonlink.js
true
true
1Lucas1.apk
1Lucas1.apk2y ago
?eval client.moon.players.get(message.guild.id).setLoop(null)
Blobit - Moonlink.js
TypeError: [ MoonlinkJs ]: loop accept only numbers in strings.
TypeError: [ MoonlinkJs ]: loop accept only numbers in strings.
1Lucas1.apk
1Lucas1.apk2y ago
?eval typeof null
Blobit - Moonlink.js
'object'
'object'
1Lucas1.apk
1Lucas1.apk2y ago
?eval 'null' == null
Blobit - Moonlink.js
false
false
1Lucas1.apk
1Lucas1.apk2y ago
?eval null == null
Blobit - Moonlink.js
true
true
1Lucas1.apk
1Lucas1.apk2y ago
?play depois do universo
Blobit - Moonlink.js
discordlogo Music.
<:Nota_Musica__Mlink:960665601574055966>╺╸Title:
<:Estrela_Mlink:960660485999587348>╺╸Uri:
<:emoji_21:967836966714503168>╺╸Author:
GIULIA BE
<:emoji_23:967837516558393365>╺╸Duration:
0 Days, 0 Hours, 3 Minutes, 188 Seconds
From An unknown user
Request for: 1Lucas1.apk
Blobit - Moonlink.js
GIULIA BE - DEPOIS DO UNIVERSO (official music video) is playing now
1Lucas1.apk
1Lucas1.apk2y ago
?eval client.moon.players.get(message.guild.id).setLoop(1)
Blobit - Moonlink.js
true
true
1Lucas1.apk
1Lucas1.apk2y ago
?eval client.moon.players.get(message.guild.id).setLoop(null)
Blobit - Moonlink.js
true
true
Lewis Capaldi - Someone You Loved is playing now Halsey - Without Me is playing now
1Lucas1.apk
1Lucas1.apk2y ago
@WhiteHell New version has been published with the fix I think it should take a little while for the version to be available
adverse-sapphire
adverse-sapphireOP2y ago
alright thank you!

Did you find this page helpful?