|
|
@ -26,6 +26,7 @@ from __future__ import annotations |
|
|
|
|
|
|
|
import copy |
|
|
|
from datetime import datetime |
|
|
|
from operator import attrgetter |
|
|
|
import unicodedata |
|
|
|
from typing import ( |
|
|
|
Any, |
|
|
@ -764,7 +765,7 @@ class Guild(Hashable): |
|
|
|
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, c.id)) |
|
|
|
r.sort(key=attrgetter('position', 'id')) |
|
|
|
return r |
|
|
|
|
|
|
|
@property |
|
|
@ -776,7 +777,7 @@ class Guild(Hashable): |
|
|
|
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, StageChannel)] |
|
|
|
r.sort(key=lambda c: (c.position, c.id)) |
|
|
|
r.sort(key=attrgetter('position', 'id')) |
|
|
|
return r |
|
|
|
|
|
|
|
@property |
|
|
@ -841,7 +842,7 @@ class Guild(Hashable): |
|
|
|
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, c.id)) |
|
|
|
r.sort(key=attrgetter('position', 'id')) |
|
|
|
return r |
|
|
|
|
|
|
|
@property |
|
|
@ -851,7 +852,7 @@ class Guild(Hashable): |
|
|
|
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, CategoryChannel)] |
|
|
|
r.sort(key=lambda c: (c.position, c.id)) |
|
|
|
r.sort(key=attrgetter('position', 'id')) |
|
|
|
return r |
|
|
|
|
|
|
|
@property |
|
|
@ -863,7 +864,7 @@ class Guild(Hashable): |
|
|
|
.. versionadded:: 2.0 |
|
|
|
""" |
|
|
|
r = [ch for ch in self._channels.values() if isinstance(ch, ForumChannel)] |
|
|
|
r.sort(key=lambda c: (c.position, c.id)) |
|
|
|
r.sort(key=attrgetter('position', 'id')) |
|
|
|
return r |
|
|
|
|
|
|
|
@property |
|
|
@ -875,7 +876,7 @@ class Guild(Hashable): |
|
|
|
.. versionadded:: 2.1 |
|
|
|
""" |
|
|
|
r = [ch for ch in self._channels.values() if isinstance(ch, DirectoryChannel)] |
|
|
|
r.sort(key=lambda c: (c.position, c.id)) |
|
|
|
r.sort(key=attrgetter('position', 'id')) |
|
|
|
return r |
|
|
|
|
|
|
|
@property |
|
|
@ -920,7 +921,7 @@ class Guild(Hashable): |
|
|
|
as_list: List[ByCategoryItem] = [(_get(k), v) for k, v in grouped.items()] # type: ignore |
|
|
|
as_list.sort(key=key) |
|
|
|
for _, channels in as_list: |
|
|
|
channels.sort(key=lambda c: (c._sorting_bucket, c.position, c.id)) |
|
|
|
channels.sort(key=attrgetter('_sorting_bucket', 'position', 'id')) |
|
|
|
return as_list |
|
|
|
|
|
|
|
def _resolve_channel(self, id: Optional[int], /) -> Optional[Union[GuildChannel, Thread]]: |
|
|
|