#js

17 messages · Page 1 of 1 (latest)

smoky schoonerBOT
#
  • What's your exact discord.js npm list discord.js and node node -v version?
  • Not a discord.js issue? Check out #1081585952654360687.
  • Consider reading #how-to-get-help to improve your question!
  • Explain what exactly your issue is.
  • Post the full error stack trace, not just the top part!
  • Show your code!
  • Issue solved? Press the button!
  • Marked as resolved by OP
inner vapor
#

you tell us

steep ferryBOT
#

To share long code snippets, use a service like gist, sourcebin, starbin, or similar instead of posting them as large code blocks or files.

inner vapor
#

i literally cannot see anything of that screenshot

steep ferryBOT
#
  • ReferenceError: "x" is not defined: learn more
  • TypeError: Cannot read properties of undefined/null (reading "x"): learn more
glass drift
#

you havent required ActionRowBuilder

gusty barn
# inner vapor i literally cannot see anything of that screenshot
const {Client , IntentsBitField} = require ('discord.js');


const client = new Client({
    intents: [
        IntentsBitField.Flags.Guilds,
        IntentsBitField.Flags.GuildMembers,
        IntentsBitField.Flags.GuildMessages,
        IntentsBitField.Flags.MessageContent,
    ]
});

const roles = [
    {
        id: '1151582609768468480',
        label: 'Red',
    },
    {
        id: '1151582689879675011',
        label: 'Blue',
    }
    ,{
        id: '1151582764320182342',
        label: 'Green',
    }
];

client.on('ready' , async (c) => {
    try {
        const channel = await client.channels.cache.get('1150331485052739596');
        if (!channel) return;

        const row = new ActionRowBuilder();

        roles.forEach((role) => {
            row.components.push(
                new ButtonBuilder().setCustomId(role.id).setLabel(role.label).setStyle(ButtonStyle.Primary)
            )
        })

        channel.send({
            content: 'Clime or remove a role below.',
            components: [row],
        });

    process.exit();
    } catch (error) {
        console.log(error);
    }
});

client.login(process.env.TOKEN);
inner vapor
#

you were answered

gusty barn
inner vapor
#

you were answered

#

ignoring anything you are being told isnt gonna help you

inner vapor
#

yes

gusty barn
#

thanks

gusty barn
inner vapor
#

you have to define ActionRowBuilder

#

aka import it