Discord.js changing perms

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
        { "SEND_MESSAGES": false },

But I am getting this error:

TypeError: Cannot read properties of undefined (reading ‘permissionOverwrites’)

Anyone know what could be the issue?

Is a channel being specified in the message? It would appear that channel is undefined.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.