#musicbot help

1 messages · Page 1 of 1 (latest)

proud wyvern
#

alright so i am using djs to code a music bot, specifically using djs/voice to help with this. idk if you guys can help me with this, but my bot is not joining nor leaving. (it has joined before but now just... is not..) i can send my code, but the error that shows every time says that the message.guild.id is undefined. ill send it more specifically after this msg

#

any time i say "Sophia join", it used to join, but now displays this : (sorry btw im new)

 channelId: message.member.voice.channel.id,
                                                    ^

TypeError: Cannot read properties of null (reading 'id')
opal pond
#

If the member wasn't in a dm, .voice.channel would be null

proud wyvern
#

what do you mean?

opal pond
#

Vc sorry
Not dm

proud wyvern
#

let me try again, because when i was in vc it didnt work

opal pond
#

If the member was and you're sure
Enable the GUILD_VOICE_STATES Intent

proud wyvern
#

wait nvm

#

okay you were right sorry about that one, was something small i wanted to bring up, but the real issue is trying to get it to leave.

#

it joins, but does not leave

#
client.on('messageCreate', message => {
    if(message.content === 'Sophia join'){
        joinVoiceChannel({
            channelId: message.member.voice.channel.id,
            guildId: message.guild.id,
            adapterCreator: message.guild.voiceAdapterCreator
        })
    }
});

client.on('messageCreate', message => {
    if (message.content === 'Sophia leave'){
        if(!message.guild.me.voice.channel){
            return message.reply("I'm not in a voice channel!")
        } else {
            client.leaveVoiceChannel(message.member.voiceState.channelID);
            message.channel.createMessage(`Thanks for tuning in!`);
        }
    }
});
opal pond
#

Client.leaveVoiceChannel?

proud wyvern
#

saw a tut, tried changing that several times

opal pond
#

#archive-voice
There, there's a guide pinned
It explains how to disconnect/destroy the connection