aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar MarkKoz <[email protected]>2020-02-24 12:43:57 -0800
committerGravatar MarkKoz <[email protected]>2020-03-22 15:54:34 -0700
commit0e1f40b1b0155cc16529bb13585021789695e2db (patch)
treecd57ac707502d7a575ea62c53d21a62d1caca754
parentHelpChannels: add a function to return used channel names (diff)
HelpChannels: implement create_name_queue
It returns a queue of element names to use for creating new channels, taking into account which names are already being used.
-rw-r--r--bot/cogs/help_channels.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/bot/cogs/help_channels.py b/bot/cogs/help_channels.py
index 388bb1390..edc15607a 100644
--- a/bot/cogs/help_channels.py
+++ b/bot/cogs/help_channels.py
@@ -71,8 +71,12 @@ class HelpChannels(Scheduler, commands.Cog):
async def create_dormant(self) -> discord.TextChannel:
"""Create and return a new channel in the Dormant category."""
- async def create_name_queue(self) -> deque:
+ def create_name_queue(self) -> deque:
"""Return a queue of element names to use for creating new channels."""
+ used_names = self.get_used_names()
+ available_names = (name for name in ELEMENTS if name not in used_names)
+
+ return deque(available_names)
@commands.command(name="dormant")
async def dormant_command(self) -> None: