From 167774ea84ec528845a17d41065983e3ef696d12 Mon Sep 17 00:00:00 2001 From: Shivansh-007 Date: Tue, 2 Mar 2021 15:51:56 +0530 Subject: Fix Channel Check to use channel ids instead of channel objects, and skip channel check if debug is true --- bot/bot.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'bot/bot.py') diff --git a/bot/bot.py b/bot/bot.py index 81d59706..176422aa 100644 --- a/bot/bot.py +++ b/bot/bot.py @@ -74,11 +74,16 @@ class Bot(commands.Bot): async def check_channels(self) -> None: """Verifies that all channel constants refer to channels which exist.""" await self.wait_until_guild_available() - all_channels = set(self.get_all_channels()) + + if constants.Client.debug: + log.info("Skipping Channels Check.") + return + + all_channels_ids = [channel.id for channel in set(self.get_all_channels())] for name, channel_id in vars(constants.Channels).items(): if name.startswith('_'): continue - if channel_id not in all_channels: + if channel_id not in all_channels_ids: log.error(f'Channel "{name}" with ID {channel_id} missing') async def send_log(self, title: str, details: str = None, *, icon: str = None) -> None: -- cgit v1.2.3 From 674838787fb1916dce98b50bae78159a54833c42 Mon Sep 17 00:00:00 2001 From: Shivansh-007 Date: Tue, 2 Mar 2021 16:00:24 +0530 Subject: Don't use sets --- bot/bot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bot/bot.py') diff --git a/bot/bot.py b/bot/bot.py index 176422aa..e9750697 100644 --- a/bot/bot.py +++ b/bot/bot.py @@ -79,7 +79,7 @@ class Bot(commands.Bot): log.info("Skipping Channels Check.") return - all_channels_ids = [channel.id for channel in set(self.get_all_channels())] + all_channels_ids = [channel.id for channel in self.get_all_channels()] for name, channel_id in vars(constants.Channels).items(): if name.startswith('_'): continue -- cgit v1.2.3