Permissions overwrites does not give access to the user in channel

Hello :PU_PepeWave: , we have been using our bot for quite a while to grant users access to the channels (user selects in dropdown channels he wants to access and bot grants him permissions). This is done with this snippet:
if (userCanRead) {
logger.info(`Removing access to channel ${textChannel.name}`);
await textChannel.permissionOverwrites.delete(
interaction.member.user.id
);
if (subjectRole) {
await roleManager.member.roles.remove(subjectRole);
}
} else {
logger.info(`Giving access to channel ${textChannel.name}`);
await textChannel.permissionOverwrites.create(
interaction.member.user.id,
{
ViewChannel: true,
SendMessages: true,
SendMessagesInThreads: true,
}
);
if (userCanRead) {
logger.info(`Removing access to channel ${textChannel.name}`);
await textChannel.permissionOverwrites.delete(
interaction.member.user.id
);
if (subjectRole) {
await roleManager.member.roles.remove(subjectRole);
}
} else {
logger.info(`Giving access to channel ${textChannel.name}`);
await textChannel.permissionOverwrites.create(
interaction.member.user.id,
{
ViewChannel: true,
SendMessages: true,
SendMessagesInThreads: true,
}
);
This approach worked for roughly 2 years, but recently we received reports that it stopped working. I've tested it and found following behavior: Some channels are added as expected (user can access them after selecting), but some are accessible at all. What is weird is that in the audi log of discord for the server I can see that overwrite happened, meaning I can see following for the channel:
Granted permissions for mimotej#0000
View Channel
Send Messages
Send Messages in Threads
Granted permissions for mimotej#0000
View Channel
Send Messages
Send Messages in Threads
Also no error is thrown. I've also noticed that if I try it on my testing server (which is setup similarly to main server) everything works ok, only difference is that testing channel does not have Discord's native Browse channels picker. We are running following versions of discord packages:
"discord-api-types": "0.38.20",
"discord.js": "14.21.0",
"@discordjs/rest": "2.5.1",
"discord-api-types": "0.38.20",
"discord.js": "14.21.0",
"@discordjs/rest": "2.5.1",
on node 22.17 Thank you for any help :z_thanks:
8 Replies
d.js toolkit
d.js toolkit6d ago
Amgelo
Amgelo6d ago
can you see the expected permission overwrites in the channel's settings?
mimotej
mimotejOP6d ago
Yep they are there, I can see the permissions but user does not have access (or at least does not see it in the menu
Amgelo
Amgelo6d ago
maybe it isn't in their channel list? the client side setting if the overwrites show as expected in the channel settings, it's not an issue with the bot
mimotej
mimotejOP6d ago
so basically they might have to go Channel list and pick it there as well correct? :PES_Think:
Amgelo
Amgelo6d ago
yeah, I'm not sure if there's a way to force or at least suggest it
mimotej
mimotejOP6d ago
Alright after some testing seems like it, ok that works for me for the moment, I will try to look into it later if there is a way how to force it. For now knowing it is ok for me :z_thanks: .
d.js toolkit
d.js toolkit6d ago
The thread owner has marked this issue as solved.

Did you find this page helpful?