Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

192
Visualizações
Discord.js v13 Why is my member moving command not working?

I've made this command to "wake up" members by moving them 10 times between 2 voice channels. It's supposed to work if you have the administrator permissions (will propably change that in the future tho) and if used incorrectly return the correct usage in an embed. Everything works EXCEPT for the actual moving of users and I can't for the life of me figure out how to move members. Any help? My code:

const { Permissions,MessageEmbed } = require('discord.js')

module.exports = {
    name: 'pobudka',
    description: "Budzi gracza.",
    execute(message, args)
    {
        const target = message.mentions.members.first()
        const usageEmbed = new MessageEmbed() //the embed sent if the usage is incorrect
            .setColor('ff0004')
            .setTitle('Poprawne użycie')
            .addField('rp pobudka @user', 'zamienić @user na wzmiankę użytkownika')

        if(message.member.permissions.has(Permissions.FLAGS.ADMINISTRATOR)) //checking if the invoking member has the administrator perms to use the command
        {
            if(target)
            {
                for(let i = 10; i > 0; i--) //loop for changing the voice channels 10 times 
                { 
                    message.guild.member(target.id).voice.setChannel("940573437561303080") //moving the member to a different voice channel
                    message.guild.member(target.id).voice.setChannel("946790140003631165") //moving the member to a different voice channel
                }
            }
            else
            {
                message.reply({ embeds: [usageEmbed]}) //sending the usage embed
            }
        }
        else
        {
            message.reply("Nie możesz tego użyć.") //replying if the invoking member doesnt have administrator perms
        }
    }
}

The error I'm getting:

C:\Users\Miki\Desktop\dc bots\jajco bot smol\commands\pobudka.js:22
                    message.guild.member(target.id).voice.setChannel("940573437561303080")
                                  ^

TypeError: message.guild.member is not a function
    at Object.execute (C:\Users\Miki\Desktop\dc bots\jajco bot smol\commands\pobudka.js:22:35)
    at Client.<anonymous> (C:\Users\Miki\Desktop\dc bots\jajco bot smol\main.js:134:44)
    at Client.emit (node:events:520:28)
    at MessageCreateAction.handle (C:\Users\Miki\Desktop\dc bots\jajco bot smol\node_modules\discord.js\src\client\actions\MessageCreate.js:26:14)
    at Object.module.exports [as MESSAGE_CREATE] (C:\Users\Miki\Desktop\dc bots\jajco bot smol\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)

(and yes the response messages are in polish because this isn't just for me but for a small server which is, you guessed it - polish)

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

The reason it is erroring is because you need to look for the members from cache but as mentioned above, target is already a member object.

To find members you need to code it like this

message.guild.members.cache.get(target.id)

or like this

message.guild.members.cache.find(member => member.id === target.id)
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda