From 11c8b257d196e8992c107a3c762c0989e5e59aa6 Mon Sep 17 00:00:00 2001 From: Adrian Edwards <17362949+MoralCode@users.noreply.github.com> Date: Sun, 18 Oct 2020 16:45:38 -0700 Subject: [PATCH] fix duplicate channels in channel list for one guild --- discover_overlay/text_settings.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/discover_overlay/text_settings.py b/discover_overlay/text_settings.py index cfa92c0..3464e36 100644 --- a/discover_overlay/text_settings.py +++ b/discover_overlay/text_settings.py @@ -56,17 +56,20 @@ class TextSettingsWindow(SettingsWindow): self.guild_lookup.append(guild) g_model.append([guild_name, True]) - guilds_by_id = "0" + # if no guild is specified, poulate channel list with every channel from each guild if self.guild == GUILD_DEFAULT_VALUE: c_model.append([guild_name, False]) - guilds_by_id = guild_id - else: - guilds_by_id = self.guild - - + for c in self.list_channels_keys: + chan = self.list_channels[c] + if chan['guild_id'] == guild_id: + c_model.append([chan["name"], True]) + self.channel_lookup.append(c) + + # if a guild is specified, poulate channel list with every channel from *just that guild* + if self.guild != GUILD_DEFAULT_VALUE: for c in self.list_channels_keys: chan = self.list_channels[c] - if chan['guild_id'] == guilds_by_id: + if chan['guild_id'] == self.guild: c_model.append([chan["name"], True]) self.channel_lookup.append(c)