Change Role.is_everyone to Role.is_default.
This commit is contained in:
parent
e77012f4d9
commit
81baafa1e2
@ -73,7 +73,7 @@ class Guild(Hashable):
|
|||||||
will be a ``str`` if the value is not recognised by the enumerator.
|
will be a ``str`` if the value is not recognised by the enumerator.
|
||||||
afk_timeout: int
|
afk_timeout: int
|
||||||
The timeout to get sent to the AFK channel.
|
The timeout to get sent to the AFK channel.
|
||||||
afk_channel: :class:`Channel`
|
afk_channel: Optional[:class:`VoiceChannel`]
|
||||||
The channel that denotes the AFK channel. None if it doesn't exist.
|
The channel that denotes the AFK channel. None if it doesn't exist.
|
||||||
icon: str
|
icon: str
|
||||||
The guild's icon.
|
The guild's icon.
|
||||||
@ -265,7 +265,7 @@ class Guild(Hashable):
|
|||||||
return [ch for ch in self._channels.values() if isinstance(ch, TextChannel)]
|
return [ch for ch in self._channels.values() if isinstance(ch, TextChannel)]
|
||||||
|
|
||||||
def get_channel(self, channel_id):
|
def get_channel(self, channel_id):
|
||||||
"""Returns a :class:`Channel` with the given ID. If not found, returns None."""
|
"""Returns a :class:`abc.GuildChannel` with the given ID. If not found, returns None."""
|
||||||
return self._channels.get(channel_id)
|
return self._channels.get(channel_id)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -280,12 +280,12 @@ class Guild(Hashable):
|
|||||||
@utils.cached_slot_property('_default_role')
|
@utils.cached_slot_property('_default_role')
|
||||||
def default_role(self):
|
def default_role(self):
|
||||||
"""Gets the @everyone role that all members have by default."""
|
"""Gets the @everyone role that all members have by default."""
|
||||||
return utils.find(lambda r: r.is_everyone, self.roles)
|
return utils.find(lambda r: r.is_default(), self.roles)
|
||||||
|
|
||||||
@utils.cached_slot_property('_default_channel')
|
@utils.cached_slot_property('_default_channel')
|
||||||
def default_channel(self):
|
def default_channel(self):
|
||||||
"""Gets the default :class:`Channel` for the guild."""
|
"""Gets the default :class:`TextChannel` for the guild."""
|
||||||
return utils.find(lambda c: c.is_default, self.channels)
|
return utils.find(lambda c: c.is_default(), self.text_channels)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def owner(self):
|
def owner(self):
|
||||||
|
@ -135,8 +135,8 @@ class Role(Hashable):
|
|||||||
self.mentionable = data.get('mentionable', False)
|
self.mentionable = data.get('mentionable', False)
|
||||||
self.color = self.colour
|
self.color = self.colour
|
||||||
|
|
||||||
def is_everyone(self):
|
def is_default(self):
|
||||||
"""Checks if the role is the @everyone role."""
|
"""Checks if the role is the default role."""
|
||||||
return self.guild.id == self.id
|
return self.guild.id == self.id
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -153,7 +153,7 @@ class Role(Hashable):
|
|||||||
def members(self):
|
def members(self):
|
||||||
"""Returns a list of :class:`Member` with this role."""
|
"""Returns a list of :class:`Member` with this role."""
|
||||||
all_members = self.guild.members
|
all_members = self.guild.members
|
||||||
if self.is_everyone():
|
if self.is_default():
|
||||||
return all_members
|
return all_members
|
||||||
|
|
||||||
ret = []
|
ret = []
|
||||||
@ -167,7 +167,7 @@ class Role(Hashable):
|
|||||||
if position <= 0:
|
if position <= 0:
|
||||||
raise InvalidArgument("Cannot move role to position 0 or below")
|
raise InvalidArgument("Cannot move role to position 0 or below")
|
||||||
|
|
||||||
if self.is_everyone():
|
if self.is_default():
|
||||||
raise InvalidArgument("Cannot move default role")
|
raise InvalidArgument("Cannot move default role")
|
||||||
|
|
||||||
if self.position == position:
|
if self.position == position:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user