GuildMember
and GuildChannel
permission-based methods do not reflect permission changes on timeouts
#9730
Labels
GuildMember
and GuildChannel
permission-based methods do not reflect permission changes on timeouts
#9730
Which package is this bug report for?
discord.js
Issue description
Description
According to docs, timed out members should have lost all permissions except
VIEW_CHANNEL
andREAD_MESSAGE_HISTORY
, if they do not haveADMINISTRATOR
permission. However, the methods mentioned below do not reflect the permission changes on timeouts. I understand that we can check if a guild member is timed out withGuildMember.isCommunicationDisabled()
and many other ways, and then make a function to obtain more accurate permissions, but having a all-in-one method to check the current permissions accurately is more convenient for us.Impacts
channel.permissionsFor(client.user)?.has(['ViewChannel', 'SendMessages']) ?? false
) before requesting the API (e.g. send a message to a text channel). Without reading the code deeply and additional testing, they may not know that the methods do not support timed out member permissions (when the client user is timed out in a guild, plus having no admin permission, suppose itsGuildMember
is cached, the above example will still returntrue
if it has the permissions when timeout is not applied).Code reference
GuildChannel.permissionsFor(memberOrRole, [checkAdmin])
discord.js/packages/discord.js/src/structures/GuildChannel.js
Lines 174 to 179 in d26e022
discord.js/packages/discord.js/src/structures/GuildChannel.js
Lines 215 to 237 in d26e022
GuildMember.permissions
discord.js/packages/discord.js/src/structures/GuildMember.js
Lines 254 to 257 in d26e022
GuildMember.permissionsIn(channel)
discord.js/packages/discord.js/src/structures/GuildMember.js
Lines 320 to 324 in d26e022
Code sample
No response
Versions
Issue priority
Medium (should be fixed soon)
Which partials do you have configured?
Not applicable
Which gateway intents are you subscribing to?
Not applicable
I have tested this issue on a development release
No response
The text was updated successfully, but these errors were encountered: