diff options
| -rw-r--r-- | bot/cogs/help_channels.py | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/bot/cogs/help_channels.py b/bot/cogs/help_channels.py index f7af5d3be..3d7ece909 100644 --- a/bot/cogs/help_channels.py +++ b/bot/cogs/help_channels.py @@ -1,6 +1,7 @@ import asyncio import json import logging +import random import typing as t from collections import deque from pathlib import Path @@ -64,8 +65,20 @@ class HelpChannels(Scheduler, commands.Cog): """Cancel the init task if the cog unloads.""" self.init_task.cancel() - async def create_channel_queue(self) -> asyncio.Queue: - """Return a queue of dormant channels to use for getting the next available channel.""" + def create_channel_queue(self) -> asyncio.Queue: + """ + Return a queue of dormant channels to use for getting the next available channel. + + The channels are added to the queue in a random order. + """ + channels = list(self.get_category_channels(self.dormant_category)) + random.shuffle(channels) + + queue = asyncio.Queue() + for channel in channels: + queue.put_nowait(channel) + + return queue async def create_dormant(self) -> discord.TextChannel: """Create and return a new channel in the Dormant category.""" |