mirror of
https://github.com/neoarz/Syntrel.git
synced 2025-12-25 11:40:12 +01:00
refactor: extension loading and help category mapping
Simplifies extension loading log conditions to only exclude 'owner' and streamlines help command category mapping by grouping commands under their respective __init__.py structures. Also updates subcommand handling to exclude only 'owner' from group checks.
This commit is contained in:
2
bot.py
2
bot.py
@@ -90,7 +90,7 @@ class DiscordBot(commands.Bot):
|
|||||||
if os.path.exists(init_file):
|
if os.path.exists(init_file):
|
||||||
try:
|
try:
|
||||||
await self.load_extension(f"cogs.{folder}")
|
await self.load_extension(f"cogs.{folder}")
|
||||||
if folder not in ["fun", "general", "idevice", "miscellaneous", "moderation", "owner", "sidestore", "utilities"]:
|
if folder not in ["owner"]:
|
||||||
self.logger.info(f"Loaded extension '{folder}'")
|
self.logger.info(f"Loaded extension '{folder}'")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
exception = f"{type(e).__name__}: {e}"
|
exception = f"{type(e).__name__}: {e}"
|
||||||
|
|||||||
47
cogs/help.py
47
cogs/help.py
@@ -37,49 +37,24 @@ class Help(commands.Cog, name="help"):
|
|||||||
async def help(self, context: Context, category: str = None) -> None:
|
async def help(self, context: Context, category: str = None) -> None:
|
||||||
|
|
||||||
category_mapping = {
|
category_mapping = {
|
||||||
# General Commands
|
# Command Groups (using __init__.py structure)
|
||||||
"general": "general",
|
"general": "general",
|
||||||
|
|
||||||
# Fun Commands
|
|
||||||
"fun": "fun",
|
"fun": "fun",
|
||||||
|
|
||||||
# idevice Commands
|
|
||||||
"idevice": "idevice",
|
"idevice": "idevice",
|
||||||
|
"miscellaneous": "miscellaneous",
|
||||||
# Moderation Commands
|
"moderation": "moderation",
|
||||||
"kick": "moderation",
|
|
||||||
"ban": "moderation",
|
|
||||||
"nick": "moderation",
|
|
||||||
"purge": "moderation",
|
|
||||||
"hackban": "moderation",
|
|
||||||
"warnings": "moderation",
|
|
||||||
"archive": "moderation",
|
|
||||||
|
|
||||||
# SideStore Commands
|
|
||||||
"sidestore": "sidestore",
|
"sidestore": "sidestore",
|
||||||
"refresh": "sidestore",
|
"utilities": "utilities",
|
||||||
"code": "sidestore",
|
|
||||||
"crash": "sidestore",
|
|
||||||
"pairing": "sidestore",
|
|
||||||
"server": "sidestore",
|
|
||||||
"half": "sidestore",
|
|
||||||
"sparse": "sidestore",
|
|
||||||
"afc": "sidestore",
|
|
||||||
"udid": "sidestore",
|
|
||||||
|
|
||||||
# Owner Commands
|
# Individual Owner Commands (exception)
|
||||||
"sync": "owner",
|
"sync": "owner",
|
||||||
"cog_management": "owner",
|
"logs": "owner",
|
||||||
|
"invite": "owner",
|
||||||
|
"load": "owner",
|
||||||
|
"unload": "owner",
|
||||||
|
"reload": "owner",
|
||||||
"shutdown": "owner",
|
"shutdown": "owner",
|
||||||
"say": "owner",
|
"say": "owner",
|
||||||
"invite": "owner",
|
|
||||||
"logs": "owner",
|
|
||||||
|
|
||||||
# Utilities Commands
|
|
||||||
"translate": "utilities",
|
|
||||||
|
|
||||||
# Miscellaneous Commands
|
|
||||||
"miscellaneous": "miscellaneous",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
category_descriptions = {
|
category_descriptions = {
|
||||||
@@ -166,7 +141,7 @@ class Help(commands.Cog, name="help"):
|
|||||||
commands_in_category.append((app_command.name, description))
|
commands_in_category.append((app_command.name, description))
|
||||||
seen_names.add(app_command.name)
|
seen_names.add(app_command.name)
|
||||||
|
|
||||||
if hasattr(app_command, 'commands') and category in ["fun", "general", "idevice", "miscellaneous", "moderation", "owner", "sidestore", "utilities"]:
|
if hasattr(app_command, 'commands') and category not in ["owner"]:
|
||||||
for subcommand in app_command.commands:
|
for subcommand in app_command.commands:
|
||||||
if subcommand.name in seen_names:
|
if subcommand.name in seen_names:
|
||||||
continue
|
continue
|
||||||
|
|||||||
Reference in New Issue
Block a user