From ce773a6c569f464932d3c7c94b37183ed987726d Mon Sep 17 00:00:00 2001 From: Matthew Date: Mon, 27 Nov 2023 04:05:15 -0500 Subject: [PATCH] feat: Finish help command and add description to commands. --- config.json | 8 ++++++++ config/config.go | 7 ++++--- server/channelserver/handlers_cast_binary.go | 5 ++++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/config.json b/config.json index 5a6e09216..e18506f3a 100644 --- a/config.json +++ b/config.json @@ -82,35 +82,43 @@ { "Name": "Help", "Enabled": true, + "Description": "Show all of the commands", "Prefix": "help" }, { "Name": "Rights", "Enabled": false, + "Description": "Directly alter user's applied courses.", "Prefix": "rights" }, { "Name": "Raviente", "Enabled": true, + "Description": "Start or view an ongoing raviante raid.", "Prefix": "ravi" }, { "Name": "Teleport", "Enabled": false, + "Description": "Teleport to a specified stage.", "Prefix": "tele" }, { "Name": "Reload", "Enabled": true, + "Description": "Reload all user sessions (Forces log out)", "Prefix": "reload" }, { "Name": "KeyQuest", "Enabled": false, + "Description": "Allow the overriding of necessary key quests.", "Prefix": "kqf" }, { "Name": "Course", "Enabled": true, + "Description": "Apply/remove user courses based on the name.", "Prefix": "course" }, { "Name": "PSN", "Enabled": true, + "Description": "Link a PSN account to your Erupe account.", "Prefix": "psn" } ], diff --git a/config/config.go b/config/config.go index 5a50a511b..12cb00316 100644 --- a/config/config.go +++ b/config/config.go @@ -169,9 +169,10 @@ type Discord struct { // Command is a channelserver chat command type Command struct { - Name string - Enabled bool - Prefix string + Name string + Enabled bool + Description string + Prefix string } // Course represents a course within MHF diff --git a/server/channelserver/handlers_cast_binary.go b/server/channelserver/handlers_cast_binary.go index 806c50749..e74728906 100644 --- a/server/channelserver/handlers_cast_binary.go +++ b/server/channelserver/handlers_cast_binary.go @@ -10,6 +10,7 @@ import ( "erupe-ce/network/binpacket" "erupe-ce/network/mhfpacket" "fmt" + "golang.org/x/exp/maps" "golang.org/x/exp/slices" "math" "strconv" @@ -320,7 +321,9 @@ func parseChatCommand(s *Session, command string) { } case commands["Help"].Prefix: if commands["Help"].Enabled { - sendServerChatMessage(s, fmt.Sprintf(s.server.dict["commandTeleportSuccess"], x, y)) + for _, command := range maps.Values(commands) { + sendServerChatMessage(s, fmt.Sprintf("%s: %s", command.Name, command.Description)) + } } else { sendDisabledCommandMessage(s, commands["Help"]) }