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

141
Visualizações
message.author.id TypeError: Cannot read properties of undefined (reading 'id')

Why i didnt get message.author.id and create the channel with special permissions?

const {SlashCommandBuilder} = require("@discordjs/builders")
const { Client, Permissions } = require('discord.js');
module.exports = {
    //Create the Command 
    data: new SlashCommandBuilder()
        .setName("veranstaltung")
        .setDescription(`erstelle eine Veranstaltung`)
        .addStringOption(option1=> option1.setName("name").setDescription("Der Name der Veranstaltung").setRequired(true))
        .addStringOption(option2=> option2.setName("datum").setDescription("Das Datum der Veranstaltung").setRequired(true)),
    async execute(message){
        const name = message.options.get("name").value
        const Datum = message.options.get("datum").value
        const userid =


            //Create the Channel with Permissions
            message.guild.channels.create('new-voice', {
                type: 'GUILD_VOICE',
                permissionOverwrites: [
                    {
                        id: message.author.id,
                        deny: [Permissions.FLAGS.VIEW_CHANNEL],
                    },
                ],
            })
            .then(
                message.reply ("Der Kanal " + name + " am " + Datum + " Wurde erfolgreich erstellt")
                )

            }

}

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

0

It looks like you are using interactions. To access the user object, use Interaction.user, not Interaction.author (this is used in message commands). So, to access the author id, use the following:

message.user.id

Docs: https://discord.js.org/#/docs/discord.js/stable/class/Interaction?scrollTo=user

about 4 years ago · Juan Pablo Isaza Relatório

0

Slash commands are not message, they are interaction. So you should use your handler as interactionCreate and in your command file you'll edit all things according to interaction. Whenever you want to get id whos used command, you'll use;

interaction.user.id

You can look docs for more info.

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