Modified !listcommands to not show custom commands if none are programmed.

This commit is contained in:
Tanner Van Teeffelen 2025-06-06 18:58:46 +00:00
parent 937f0ebf8d
commit d90658d0c1
2 changed files with 7 additions and 7 deletions

View file

@ -1,8 +1,3 @@
{ {
"!test": "This is a test!", "tannerisawesome": "He truly is."
"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!"
} }

View file

@ -67,7 +67,12 @@ async def cmd_listcommands(ctx):
commands_list = "\n".join([f"{PREFIX}**{cmd}**" for cmd, resp in commands_dict.items()]) 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()]) 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: except Exception as e:
await ctx.send(f"Error loading commands: {e}") await ctx.send(f"Error loading commands: {e}")