Fix channel deletion tracking
This commit is contained in:
parent
1340e8d49a
commit
4743d14e35
1 changed files with 4 additions and 4 deletions
|
|
@ -141,7 +141,7 @@ class Bot:
|
|||
self.logger.debug('Deleting duplicated text channels')
|
||||
channel_names: list[str] = [c.name for c in self.guild_text_channels if c.name is not None]
|
||||
unique_names: set[str] = set(channel_names)
|
||||
deleted_channels: set[TextChannel] = set()
|
||||
deleted_channels: list[TextChannel] = []
|
||||
try:
|
||||
for name in unique_names:
|
||||
occurence = 0
|
||||
|
|
@ -152,7 +152,7 @@ class Bot:
|
|||
self.logger.debug('Deleting duplicate channel: %d -> %s', channel.id, name)
|
||||
self.discord_manager.delete_text_channel(
|
||||
channel.id, request_timeout=self.config.request_timeout)
|
||||
deleted_channels.add(channel)
|
||||
deleted_channels.append(channel)
|
||||
finally:
|
||||
self.guild_text_channels = [c for c in self.guild_text_channels if c not in deleted_channels]
|
||||
|
||||
|
|
@ -228,13 +228,13 @@ class Bot:
|
|||
|
||||
def _clean_category(self, category: ChannelCategory):
|
||||
self.logger.info('Cleaning category "%s" (%d)', category.name, category.id)
|
||||
deleted_channels: set[TextChannel] = set()
|
||||
deleted_channels: list[TextChannel] = []
|
||||
try:
|
||||
for channel in self.guild_text_channels:
|
||||
if channel.parent_id == category.id:
|
||||
self.logger.debug('Cleaning category -> deleting channel "%s"', channel.name)
|
||||
self.discord_manager.delete_text_channel(channel.id, request_timeout=self.config.request_timeout)
|
||||
deleted_channels.add(channel)
|
||||
deleted_channels.append(channel)
|
||||
finally:
|
||||
self.guild_text_channels = [c for c in self.guild_text_channels if c not in deleted_channels]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue