Reputation: 67
I tried to make a simple channel lock function in DiscordJS but I ran into a problem while trying to do so.
The problem is probably in message.channel.overwritePermissions
Here is the error
if (message.member.hasPermission("MUTE_MEMBERS")) {
let roles = message.guild.roles;
let allRole = roles.cache.find(r => r.id === '902820481110011934');
message.channel.overwritePermissions({
SEND_MESSAGES: true
});
} else {
message.channel.send("You don't have permission to do this!");
}
Upvotes: 2
Views: 878
Reputation: 9041
GuildChannel.overwritePermissions
accepts only an array or collection of OverwriteResolvable
. OverwriteResolvable
can be OverwriteData
. The id is required. This is the way to set overwrites in v12
message.channel.overwritePermissions({
id: "role_or_user_id",
allow: ["SEND_MESSAGES"]
})
Upvotes: 2