aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--discord/abc.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/discord/abc.py b/discord/abc.py
index dc69ff27..983c323f 100644
--- a/discord/abc.py
+++ b/discord/abc.py
@@ -202,9 +202,6 @@ class GuildChannel:
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))
-
channels.sort(key=lambda c: c.position)
try:
@@ -214,8 +211,9 @@ class GuildChannel:
# not there somehow lol
return
else:
+ index = next((i for i, c in enumerate(channels) if c.position >= position), -1)
# add ourselves at our designated position
- channels.insert(position, self)
+ channels.insert(index, self)
payload = []
for index, c in enumerate(channels):
@@ -259,7 +257,7 @@ class GuildChannel:
options['permission_overwrites'] = [c._asdict() for c in category._overwrites]
else:
await self._move(position, parent_id=parent_id, lock_permissions=lock_permissions, reason=reason)
-
+
overwrites = options.get('overwrites', None)
if overwrites:
perms = []