mirror of
https://github.com/brandons209/Red-bot-Cogs.git
synced 2024-06-17 09:54:49 +12:00
fix bug with inital setting of channel pos
This commit is contained in:
parent
0472fec4f3
commit
81f9769f88
|
@ -54,14 +54,12 @@ class ChannelControl(commands.Cog):
|
||||||
# update channel positions for new channels
|
# update channel positions for new channels
|
||||||
for guild in self.bot.guilds:
|
for guild in self.bot.guilds:
|
||||||
locked = await self.config.guild(guild).locked()
|
locked = await self.config.guild(guild).locked()
|
||||||
if not locked:
|
|
||||||
continue
|
|
||||||
all_channels = guild.text_channels + guild.voice_channels
|
all_channels = guild.text_channels + guild.voice_channels
|
||||||
for channel in all_channels:
|
for channel in all_channels:
|
||||||
curr = await self.config.channel(channel).pos()
|
curr = await self.config.channel(channel).pos()
|
||||||
if curr == -1:
|
if curr == -1:
|
||||||
await self.config.channel(channel).pos.set(channel.position)
|
await self.config.channel(channel).pos.set(channel.position)
|
||||||
elif curr != channel.position:
|
elif curr != channel.position and locked:
|
||||||
# channel moved while bot was down, need to fix
|
# channel moved while bot was down, need to fix
|
||||||
try:
|
try:
|
||||||
await channel.edit(position=curr)
|
await channel.edit(position=curr)
|
||||||
|
|
Loading…
Reference in a new issue