aboutsummaryrefslogtreecommitdiffstats
path: root/bot/bot.py
diff options
context:
space:
mode:
authorGravatar ks129 <[email protected]>2021-03-02 09:14:37 +0200
committerGravatar GitHub <[email protected]>2021-03-02 09:14:37 +0200
commit3ef0fdd5dd1b8b3e4a052c5ddec093747bb2b9f2 (patch)
tree7a49b9bec8c7d0029edb69beb12609af1f46f1c0 /bot/bot.py
parentMerge pull request #600 from Shivansh-007/feature/improve-wiki (diff)
parentMerge branch 'master' into startup-channel-check (diff)
Merge pull request #482 from WillDaSilva/startup-channel-check
Startup channel check
Diffstat (limited to 'bot/bot.py')
-rw-r--r--bot/bot.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/bot/bot.py b/bot/bot.py
index 97b09243..81d59706 100644
--- a/bot/bot.py
+++ b/bot/bot.py
@@ -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
@@ -71,6 +71,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(constants.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()