diff options
author | 2021-03-05 17:17:26 +0000 | |
---|---|---|
committer | 2021-03-05 17:17:26 +0000 | |
commit | 59220bd5f22422ea2a85eb11118fbe72a6580ea9 (patch) | |
tree | d273188e75f58ef27851f6b5d33d41639c10f200 /bot/bot.py | |
parent | Fix Pipfile merge conflicts (diff) | |
parent | Merge pull request #598 from Arez1337/trivia (diff) |
Merge branch 'master' into Enforce-image-processing-concurrency
Diffstat (limited to 'bot/bot.py')
-rw-r--r-- | bot/bot.py | 17 |
1 files changed, 16 insertions, 1 deletions
@@ -34,7 +34,7 @@ class Bot(commands.Bot): ) self._guild_available = asyncio.Event() self.redis_session = redis_session - + self.loop.create_task(self.check_channels()) self.loop.create_task(self.send_log(self.name, "Connected!")) @property @@ -91,6 +91,21 @@ class Bot(commands.Bot): else: await super().on_command_error(context, exception) + async def check_channels(self) -> None: + """Verifies that all channel constants refer to channels which exist.""" + await self.wait_until_guild_available() + + if constants.Client.debug: + log.info("Skipping Channels Check.") + return + + 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 + 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: """Send an embed message to the devlog channel.""" await self.wait_until_guild_available() |