Chunk all guilds on startup

This commit is contained in:
Zeva Rose 2022-08-15 19:42:23 -06:00
parent 5ad05b8837
commit 158591acac

View file

@ -82,6 +82,12 @@ class Jarvis(StatsClient):
self.phishing_domains = [] self.phishing_domains = []
self.pre_run_callback = self._prerun self.pre_run_callback = self._prerun
async def _chunk_all(self) -> None:
"""Chunk all guilds."""
for guild in self.guilds:
self.logger.debug(f"Chunking guild {guild.name} <{guild.id}>")
await guild.chunk_guild()
@Task.create(IntervalTrigger(hours=1)) @Task.create(IntervalTrigger(hours=1))
async def _update_domains(self) -> None: async def _update_domains(self) -> None:
self.logger.debug("Updating phishing domains") self.logger.debug("Updating phishing domains")
@ -137,6 +143,7 @@ class Jarvis(StatsClient):
try: try:
await self._sync_domains() await self._sync_domains()
self._update_domains.start() self._update_domains.start()
asyncio.create_task(self._chunk_all())
except Exception as e: except Exception as e:
self.logger.error("Failed to load anti-phishing", exc_info=e) self.logger.error("Failed to load anti-phishing", exc_info=e)
self.logger.info("Logged in as {}".format(self.user)) # noqa: T001 self.logger.info("Logged in as {}".format(self.user)) # noqa: T001