From d90658d0c17158ee19e6bf2a28e7d64f5dd90427 Mon Sep 17 00:00:00 2001 From: TVanteeffelen Date: Fri, 6 Jun 2025 18:58:46 +0000 Subject: [PATCH] Modified !listcommands to not show custom commands if none are programmed. --- customcommands.json | 7 +------ methods.py | 7 ++++++- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/customcommands.json b/customcommands.json index b4d7717..babed61 100644 --- a/customcommands.json +++ b/customcommands.json @@ -1,8 +1,3 @@ { - "!test": "This is a test!", - "tannerisawesome": "He truly is.", - "test2": "This is another test!", - "[": "' t e s t 3 ' , ' t h i s ' , ' i s ' , ' y e t ' , ' a n o t h e r ' , ' t e s t ! ' ]", - "test4": "this is another test!", - "aldan": "Aldan sucks at coding!" + "tannerisawesome": "He truly is." } \ No newline at end of file diff --git a/methods.py b/methods.py index 95fa0a4..669fc32 100644 --- a/methods.py +++ b/methods.py @@ -67,7 +67,12 @@ async def cmd_listcommands(ctx): commands_list = "\n".join([f"{PREFIX}**{cmd}**" for cmd, resp in commands_dict.items()]) customcommands_list = "\n".join([f"{PREFIX}**{cmd}**" for cmd, resp in customcommands_dict.items()]) - await ctx.send(f"**Available Built-In Commands:**\n\n{commands_list}\n\n**Available Custom Commands:**\n\n{customcommands_list}\n\n") + await ctx.send(f"**Available Built-In Commands:**\n\n{commands_list}") + + with open ("customcommands.json", 'r') as file: + data = json.load(file) + if data != {}: + await ctx.send(f"\n\n**Available Custom Commands:**\n\n{customcommands_list}\n\n") except Exception as e: await ctx.send(f"Error loading commands: {e}")