I set chunk_guilds_at_startup=False in my Bot but now i still want to access the users.
so my idea would be a task that fetches every n minutes guilds like this? is this the way to go or are there better ways?
chunked_guilds = set()
@tasks.loop(minutes=10)
async def fetch_members_task(self):
"""Periodically fetch members for guilds that haven't been chunked yet"""
for guild in self.bot.guilds:
if guild.id not in chunked_guilds and not guild.chunked:
try:
await guild.chunk()
chunked_guilds.add(guild.id)
await asyncio.sleep(2) # Add delay between requests to avoid rate limits
except Exception as e:
pass
