mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-21 00:07:51 +00:00
Sort Guild.text_channels and Guild.voice_channels in UI order.
This commit is contained in:
parent
959c60543d
commit
9fcbe5c678
@ -262,8 +262,13 @@ class Guild(Hashable):
|
||||
|
||||
@property
|
||||
def voice_channels(self):
|
||||
"""List[:class:`VoiceChannel`]: A list of voice channels that belongs to this guild."""
|
||||
return [ch for ch in self._channels.values() if isinstance(ch, VoiceChannel)]
|
||||
"""List[:class:`VoiceChannel`]: A list of voice channels that belongs to this guild.
|
||||
|
||||
This is sorted by the position and are in UI order from top to bottom.
|
||||
"""
|
||||
r = [ch for ch in self._channels.values() if isinstance(ch, VoiceChannel)]
|
||||
r.sort(key=lambda c: c.position)
|
||||
return r
|
||||
|
||||
@property
|
||||
def me(self):
|
||||
@ -275,8 +280,13 @@ class Guild(Hashable):
|
||||
|
||||
@property
|
||||
def text_channels(self):
|
||||
"""List[:class:`TextChannel`]: A list of text channels that belongs to this guild."""
|
||||
return [ch for ch in self._channels.values() if isinstance(ch, TextChannel)]
|
||||
"""List[:class:`TextChannel`]: A list of text channels that belongs to this guild.
|
||||
|
||||
This is sorted by the position and are in UI order from top to bottom.
|
||||
"""
|
||||
r = [ch for ch in self._channels.values() if isinstance(ch, TextChannel)]
|
||||
r.sort(key=lambda c: c.position)
|
||||
return r
|
||||
|
||||
def get_channel(self, channel_id):
|
||||
"""Returns a :class:`abc.GuildChannel` with the given ID. If not found, returns None."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user