Browse Source

Add Role.members to get every member with a role.

pull/447/head
Rapptz 8 years ago
parent
commit
7eb73cdc71
  1. 13
      discord/role.py

13
discord/role.py

@ -150,6 +150,19 @@ class Role(Hashable):
"""Returns a string that allows you to mention a role."""
return '<@&{}>'.format(self.id)
@property
def members(self):
"""Returns a list of :class:`Member` with this role."""
all_members = self.guild.members
if self.is_everyone:
return all_members
ret = []
for member in all_members:
if self in member.roles:
ret.append(member)
return ret
@asyncio.coroutine
def _move(self, position):
if position <= 0:

Loading…
Cancel
Save