diff options
Diffstat (limited to '')
| -rw-r--r-- | bot/bot.py | 13 | 
1 files changed, 12 insertions, 1 deletions
| @@ -34,9 +34,10 @@ 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      def member(self) -> Optional[discord.Member]:          """Retrieves the guild member object for the bot.""" @@ -71,6 +72,16 @@ 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() +        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() | 
