diff options
| author | 2020-10-04 22:44:49 -0400 | |
|---|---|---|
| committer | 2020-10-04 22:44:49 -0400 | |
| commit | 931fb3ea4a6eb767864b33df5bd17cfb48e1b919 (patch) | |
| tree | cc0fabc43c31bf19dff1009da51bcbcc48071f88 | |
| parent | Merge pull request #469 from Anubhav1603/source_cmd (diff) | |
Verify channel constants on startup
Closes #393
| -rw-r--r-- | bot/bot.py | 11 | 
1 files changed, 10 insertions, 1 deletions
@@ -45,7 +45,7 @@ class SeasonalBot(commands.Bot):              connector=TCPConnector(resolver=AsyncResolver(), family=socket.AF_INET)          )          self._guild_available = asyncio.Event() - +        self.loop.create_task(self.check_channels())          self.loop.create_task(self.send_log("SeasonalBot", "Connected!"))      @property @@ -149,6 +149,15 @@ class SeasonalBot(commands.Bot):              log.info("Nickname set successfully")              return True +    async def check_channels(self) -> None: +        await self.wait_until_guild_available() +        all_channels = set(self.get_all_channels()) +        for name, channel_id in vars(Channels).items(): +            if name.startswith('_'): +                continue +            if channel_id not in all_channels: +                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()  |