mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-09-06 09:56:09 +00:00
Account for user installations in Channel.permissions_for
Co-authored-by: owocado <24418520+owocado@users.noreply.github.com>
This commit is contained in:
@ -699,6 +699,7 @@ class GuildChannel:
|
||||
- Member overrides
|
||||
- Implicit permissions
|
||||
- Member timeout
|
||||
- User installed app
|
||||
|
||||
If a :class:`~discord.Role` is passed, then it checks the permissions
|
||||
someone with that role would have, which is essentially:
|
||||
@ -714,6 +715,12 @@ class GuildChannel:
|
||||
.. versionchanged:: 2.0
|
||||
``obj`` parameter is now positional-only.
|
||||
|
||||
.. versionchanged:: 2.4
|
||||
User installed apps are now taken into account.
|
||||
The permissions returned for a user installed app mirrors the
|
||||
permissions Discord returns in :attr:`~discord.Interaction.app_permissions`,
|
||||
though it is recommended to use that attribute instead.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
obj: Union[:class:`~discord.Member`, :class:`~discord.Role`]
|
||||
@ -745,6 +752,13 @@ class GuildChannel:
|
||||
return Permissions.all()
|
||||
|
||||
default = self.guild.default_role
|
||||
if default is None:
|
||||
|
||||
if self._state.self_id == obj.id:
|
||||
return Permissions._user_installed_permissions(in_guild=True)
|
||||
else:
|
||||
return Permissions.none()
|
||||
|
||||
base = Permissions(default.permissions.value)
|
||||
|
||||
# Handle the role case first
|
||||
|
Reference in New Issue
Block a user