TypeError [InvalidType]: Supplied parameter is not a User nor a Role.

Why am I getting this error?
6 Replies
d.js toolkit
d.js toolkit2y ago
• What's your exact discord.js npm list discord.js and node node -v version? • Post the full error stack trace, not just the top part! • Show your code! • Explain what exactly your issue is. • Not a discord.js issue? Check out #useful-servers.
Iced Queen
Iced QueenOP2y ago
let staffs = [
{
id: staffRole0.id,
allow: [Discord.PermissionFlagsBits.ViewChannel, Discord.PermissionFlagsBits.SendMessages],
},
{
id: staffRole1.id,
allow: [Discord.PermissionFlagsBits.ViewChannel, Discord.PermissionFlagsBits.SendMessages],
},
{
id: staffRole2.id,
allow: [Discord.PermissionFlagsBits.ViewChannel, Discord.PermissionFlagsBits.SendMessages],
}
]
let staffs = [
{
id: staffRole0.id,
allow: [Discord.PermissionFlagsBits.ViewChannel, Discord.PermissionFlagsBits.SendMessages],
},
{
id: staffRole1.id,
allow: [Discord.PermissionFlagsBits.ViewChannel, Discord.PermissionFlagsBits.SendMessages],
},
{
id: staffRole2.id,
allow: [Discord.PermissionFlagsBits.ViewChannel, Discord.PermissionFlagsBits.SendMessages],
}
]
staffs.push(
{
id: staffRole3.id,
allow: [
Discord.PermissionFlagsBits.ViewChannel,
Discord.PermissionFlagsBits.SendMessages
],
},
{
id: staffRole4.id,
allow: [
Discord.PermissionFlagsBits.ViewChannel,
Discord.PermissionFlagsBits.SendMessages
],
},
)
staffs.push(
{
id: staffRole3.id,
allow: [
Discord.PermissionFlagsBits.ViewChannel,
Discord.PermissionFlagsBits.SendMessages
],
},
{
id: staffRole4.id,
allow: [
Discord.PermissionFlagsBits.ViewChannel,
Discord.PermissionFlagsBits.SendMessages
],
},
)
Look at the title Ofc
Iced Queen
Iced QueenOP2y ago
Iced Queen
Iced QueenOP2y ago
That was server.channels.create({ Literally what I was about to type xD But if I do staffs[0] it only takes the first object in there So what do I do instead?
d.js docs
d.js docs2y ago
mdn Spread syntax (...) The spread (...) syntax allows an iterable, such as an array or string, to be expanded in places where zero or more arguments (for function calls) or elements (for array literals) are expected. In an object literal, the spread syntax enumerates the properties of an object and adds the key-value pairs to the object being created.
Iced Queen
Iced QueenOP2y ago
Not familiar with the spread syntax. Would that be ...staffs? Articles are not that easy to understand for everyone when English isn't their first language m8... but thanks They aren't "explaining" the code in JS 😅 That ain't an array with objects though is it? And I guess I wasn't really thinking straight, but no need to get rude about that 😄 I did look at it. Therefore all I needed was a "yes" 🙂
Want results from more Discord servers?
Add your server