aboutsummaryrefslogtreecommitdiff
path: root/discord/role.py
diff options
context:
space:
mode:
authorTyler <[email protected]>2021-05-27 23:53:23 -0500
committerGitHub <[email protected]>2021-05-28 00:53:23 -0400
commit6c8f1ccbdf893597b5c8dfaea00f47a621feab72 (patch)
treedb1fa4c5e541aaceddf561c8bce9e1e23ee960a1 /discord/role.py
parentAdd a way to wait for a view to finish its interactions (diff)
downloaddiscord.py-6c8f1ccbdf893597b5c8dfaea00f47a621feab72.tar.xz
discord.py-6c8f1ccbdf893597b5c8dfaea00f47a621feab72.zip
Add Role.is_assignable()
Diffstat (limited to 'discord/role.py')
-rw-r--r--discord/role.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/discord/role.py b/discord/role.py
index a8ce4cea..ca9991b9 100644
--- a/discord/role.py
+++ b/discord/role.py
@@ -258,6 +258,13 @@ class Role(Hashable):
"""
return self.tags is not None and self.tags.is_integration()
+ def is_assignable(self):
+ """:class:`bool`: Whether the role is able to be assigned or removed by the bot.
+
+ .. versionadded:: 2.0
+ """
+ return not self.is_default() and not self.managed and self.guild.me.top_role > self
+
@property
def permissions(self):
""":class:`Permissions`: Returns the role's permissions."""