aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bot/bot.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/bot/bot.py b/bot/bot.py
index 313652d11..b170be6d3 100644
--- a/bot/bot.py
+++ b/bot/bot.py
@@ -49,6 +49,10 @@ class Bot(commands.Bot):
self.stats = AsyncStatsClient(self.loop, statsd_url, 8125, prefix="bot")
+ async def _cache_allow_deny_list_data(self) -> None:
+ """Cache all the data in the AllowDenyList on the site."""
+ self.allow_deny_list_cache = await self.api_client.get('bot/allow_deny_lists')
+
async def _create_redis_session(self) -> None:
"""
Create the Redis connection pool, and then open the redis event gate.
@@ -159,6 +163,9 @@ class Bot(commands.Bot):
self.http_session = aiohttp.ClientSession(connector=self._connector)
self.api_client.recreate(force=True, connector=self._connector)
+ # Build the AllowDenyList cache
+ self.loop.create_task(self._cache_allow_deny_list_data())
+
async def on_guild_available(self, guild: discord.Guild) -> None:
"""
Set the internal guild available event when constants.Guild.id becomes available.