Let say I want to make a lock command (making only admins be able to say something in a channel) and I want a specific role to be overwrite (not @everyone). How could I do that?
To simply it. How can I disable SEND_MESSAGE for a specific role?
I already tried that:
let channel = message.mentions.channels.first()
let roles = message.guild.roles;
// Finding the locked role.
const lockRole = message.guild.id;
// Enables messages
channel.permissionOverwrites.edit(
lockRole,
{ "SEND_MESSAGES": false },
).catch(console.log);
But I am getting this error:
TypeError: Cannot read properties of undefined (reading ‘permissionOverwrites’)
Anyone know what could be the issue?