Add support for store channels.

This commit is contained in:
Rapptz
2019-03-17 14:32:51 -04:00
parent 4bd4c23694
commit 5061915b2a
5 changed files with 150 additions and 8 deletions

View File

@@ -187,13 +187,17 @@ class GuildChannel:
def __str__(self):
return self.name
@property
def _sorting_bucket(self):
raise NotImplementedError
async def _move(self, position, parent_id=None, lock_permissions=False, *, reason):
if position < 0:
raise InvalidArgument('Channel position cannot be less than 0.')
http = self._state.http
cls = type(self)
channels = [c for c in self.guild.channels if isinstance(c, cls)]
bucket = self._sorting_bucket
channels = [c for c in self.guild.channels if c._sorting_bucket == bucket]
if position >= len(channels):
raise InvalidArgument('Channel position cannot be greater than {}'.format(len(channels) - 1))