mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-05-12 00:39:56 +00:00
Better detection for the @everyone role.
This commit is contained in:
parent
ba978cc988
commit
a9fd4fc4e3
@ -197,7 +197,8 @@ class Role(object):
|
||||
A boolean representing if the role will be displayed separately from other members.
|
||||
.. attribute:: position
|
||||
|
||||
The position of the role.
|
||||
The position of the role. This number is usually positive. A non-positive value indicates that
|
||||
this is the `@everyone` role.
|
||||
.. attribute:: managed
|
||||
|
||||
A boolean indicating if the role is managed by the server through some form of integration
|
||||
@ -211,8 +212,12 @@ class Role(object):
|
||||
self.id = kwargs.get('id')
|
||||
self.name = kwargs.get('name')
|
||||
self.permissions = Permissions(kwargs.get('permissions', 0))
|
||||
self.position = kwargs.get('position', -1)
|
||||
self.position = kwargs.get('position', 0)
|
||||
self.colour = Colour(kwargs.get('color', 0))
|
||||
self.hoist = kwargs.get('hoist', False)
|
||||
self.managed = kwargs.get('managed', False)
|
||||
self.color = self.colour
|
||||
|
||||
def is_everyone(self):
|
||||
"""Checks if the role is the @everyone role."""
|
||||
return self.position == -1
|
||||
|
@ -151,5 +151,5 @@ class Server(object):
|
||||
def get_default_role(self):
|
||||
"""Gets the @everyone role that all members have by default."""
|
||||
for role in self.roles:
|
||||
if role.name == '@everyone':
|
||||
if role.is_everyone():
|
||||
return role
|
||||
|
Loading…
x
Reference in New Issue
Block a user