aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar MarkKoz <[email protected]>2020-08-13 18:10:03 -0700
committerGravatar MarkKoz <[email protected]>2020-08-14 09:43:40 -0700
commit1e4aabec382529aed878b7d548f13a2705da42dc (patch)
treee38cd875ff0cf947da25d84ceb27c458fd567c5d
parentExtensions: support nested groupings in list command (diff)
Extensions: refactor category grouping code
-rw-r--r--bot/cogs/utils/extensions.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/bot/cogs/utils/extensions.py b/bot/cogs/utils/extensions.py
index 90558c52a..52b5adefc 100644
--- a/bot/cogs/utils/extensions.py
+++ b/bot/cogs/utils/extensions.py
@@ -192,11 +192,10 @@ class Extensions(commands.Cog):
path = ext.split(".")
if len(path) > COG_PATH_LEN + 1:
category = " - ".join(path[COG_PATH_LEN:-1])
- extensions = categories.setdefault(category, [])
else:
- extensions = categories.setdefault("uncategorised", [])
+ category = "uncategorised"
- extensions.append(f"{status} {path[-1]}")
+ categories.setdefault(category, []).append(f"{status} {path[-1]}")
return categories