From c6926f5481d72394f7def3f46ecd46b0bb306e15 Mon Sep 17 00:00:00 2001 From: HackDefendr Date: Tue, 19 Nov 2024 17:37:32 -0600 Subject: [PATCH] Update actions.js Adding the !help command to instruct the bot to display all configured commands and their descriptions. Lightly formatted. --- src/agent/commands/actions.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/agent/commands/actions.js b/src/agent/commands/actions.js index 8728ad5..169da88 100644 --- a/src/agent/commands/actions.js +++ b/src/agent/commands/actions.js @@ -374,4 +374,16 @@ export const actionsList = [ // return 'Set npc goal: ' + agent.npc.data.curr_goal.name; // } // }, + { + name: '!help', + description: 'Lists all available commands and their descriptions.', + perform: async function (agent) { + const commandList = actionsList.map(action => { + return `${action.name.padEnd(15)} - ${action.description}`; // Ensure consistent spacing + }).join('\n'); + + console.log(commandList); + return `Available Commands:\n${commandList}`; + } + }, ];