- What's your exact discord.js
npm list discord.jsand nodenode -vversion? - 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
#js
17 messages · Page 1 of 1 (latest)
you tell us
i literally cannot see anything of that screenshot
ReferenceError: "x" is not defined: learn moreTypeError: Cannot read properties of undefined/null (reading "x"): learn more
you havent required ActionRowBuilder
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);
you were answered
this?
yes
thanks
I read this but I don't understand what to do