`permissions_for` returning wrong permissions
Summary
permissions_for returning wrong permissions
Reproduction Steps
When you use channel.permissions_for, and you remove the "View Channel" permission, it still returns true.
NOTE:
- Code below works with v2.4.1
- But does not work with py-cord-dev-2.5.0rc5
Minimal Reproducible Code
I created a cog with:
@slash_command()
async def test_perm(self, ctx: discord.ApplicationContext):
member = ctx.guild.get_member(self.bot.user.id)
perm = ctx.channel.permissions_for(member)
await ctx.response.send_message("🚫" if not perm.view_channel else "✅")
Expected Results
🚫if "View Channel" permission is denied. Else ✅
Actual Results
With py-cord-dev-2.5.0rc5: Always ✅ With py-cord 2.4.1: 🚫 or ✅, depending on the actual permission set
Intents
default
System Information
- Python v3.9.4-final
- py-cord-dev v2.5.None-candidate
- py-cord-dev pkg_resources: v2.5.0rc5
- aiohttp v3.8.3
Checklist
- [X] I have searched the open issues for duplicates.
- [X] I have shown the entire traceback, if possible.
- [X] I have removed my token from display, if visible.
Additional Context
No response
@Pycord-Development/contributors please work on this :)
Heyhey, after some consideration this will be held off until 2.6 as it's rather intricate. Instead of ctx.channel.permissions_for(member) (where member is the bot), you should use ctx.app_permissions.
Do you know if there's an alternative to interaction.app_permissions that does not require coming from a slash command event? I use permissions_for a lot so this is keeping me in 2.4
This issue only affects interactions; you can safely use permissions_for elsewhere
(To elaborate, the issue is specifically because we update permissions from interaction.channel incorrectly; you could circumvent this again by using bot.get_channel, assuming you haven't disabled cache)