aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCapn <[email protected]>2019-08-06 15:33:42 -0500
committerRapptz <[email protected]>2019-08-27 03:49:33 -0400
commit125a5676b804970332aab8fbd3d7f72f07a07b09 (patch)
treeaac5c39c155f8a17709a85a0e9a9823e87890fd2
parentExplicitly mention discord.Object in abc.Snowflake documentation. (diff)
downloaddiscord.py-125a5676b804970332aab8fbd3d7f72f07a07b09.tar.xz
discord.py-125a5676b804970332aab8fbd3d7f72f07a07b09.zip
Add permissions_synced to abc.GuildChannel
This allows users to check whether or not the permissions for a Guild Channel are synced with the permissions for its category. Discord automatically syncs the permissions when the overwrites are equal so just checking if the two overwrites are equal will determine if they are synced.
-rw-r--r--discord/abc.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/discord/abc.py b/discord/abc.py
index b888fd01..b150b025 100644
--- a/discord/abc.py
+++ b/discord/abc.py
@@ -386,6 +386,16 @@ class GuildChannel:
"""
return self.guild.get_channel(self.category_id)
+ @property
+ def permissions_synced(self):
+ """:class:`bool`: Whether or not the permissions for this channel are synced with the
+ category it belongs to.
+
+ If there is no category then this is ``False``.
+ """
+ category = self.guild.get_channel(self.category_id)
+ return category and category._overwrites == self._overwrites
+
def permissions_for(self, member):
"""Handles permission resolution for the current :class:`~discord.Member`.