From 6c8f1ccbdf893597b5c8dfaea00f47a621feab72 Mon Sep 17 00:00:00 2001 From: Tyler Date: Thu, 27 May 2021 23:53:23 -0500 Subject: [PATCH] Add Role.is_assignable() --- discord/role.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/discord/role.py b/discord/role.py index a8ce4cea0..ca9991b98 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."""