From da284cd1247fb063d575c2f9ab945d944003c22c Mon Sep 17 00:00:00 2001 From: Arthur Lu Date: Thu, 19 Dec 2024 22:10:18 +0000 Subject: [PATCH] fix return messages to use code block for usernames --- app/commands.go | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/app/commands.go b/app/commands.go index eb5abb2..84c67ef 100644 --- a/app/commands.go +++ b/app/commands.go @@ -51,7 +51,7 @@ var ( // check requestedUsername validity valid := checkMcUsernameValid(requestedUsername) if !valid { - simpleResponse(s, i, fmt.Sprintf("%s is not a valid minecraft username", requestedUsername)) + simpleResponse(s, i, fmt.Sprintf("`%s` is not a valid minecraft username", requestedUsername)) return } @@ -60,14 +60,14 @@ var ( // execute RCON response, err := conn.Execute(fmt.Sprintf("whitelist add %s", requestedUsername)) if err != nil { - simpleResponse(s, i, fmt.Sprintf("Failed to add %s to whitelist: %s", requestedUsername, err.Error())) + simpleResponse(s, i, fmt.Sprintf("Failed to add `%s` to whitelist: %s", requestedUsername, err.Error())) return } // this can happen if the username is not a real player, OR if the user is already on the whitelist // In both cases we want to exit early to avoid adding an invalid username to the db if !strings.EqualFold(response, fmt.Sprintf("Added %s to the whitelist", requestedUsername)) { - simpleResponse(s, i, fmt.Sprintf("Failed to add %s to whitelist: %s", requestedUsername, response)) + simpleResponse(s, i, fmt.Sprintf("Failed to add `%s` to whitelist: %s", requestedUsername, response)) return } @@ -76,9 +76,9 @@ var ( SaveDB(dbPath, db) // send response - simpleResponse(s, i, fmt.Sprintf("%s linked minecraft username %s", invokingUserName, requestedUsername)) + simpleResponse(s, i, fmt.Sprintf("`%s` linked minecraft username `%s`", invokingUserName, requestedUsername)) } else { - simpleResponse(s, i, fmt.Sprintf("%s already has a linked minecraft username %s", invokingUserName, existingMCUsername)) + simpleResponse(s, i, fmt.Sprintf("`%s` already has a linked minecraft username `%s`", invokingUserName, existingMCUsername)) } }, @@ -88,18 +88,18 @@ var ( existingMCUsername, ok := db[invokingUserID] if !ok { // invoking user does not currently have an mc username associated - simpleResponse(s, i, fmt.Sprintf("%s does not have a linked minecraft username", invokingUserName)) + simpleResponse(s, i, fmt.Sprintf("`%s` does not have a linked minecraft username", invokingUserName)) } else { // execute RCON response, err := conn.Execute(fmt.Sprintf("whitelist remove %s", existingMCUsername)) if err != nil { - simpleResponse(s, i, fmt.Sprintf("Failed to remove %s from whitelist: %s", existingMCUsername, err.Error())) + simpleResponse(s, i, fmt.Sprintf("Failed to remove `%s` from whitelist: %s", existingMCUsername, err.Error())) return } // this can happen if the username is not a real player, OR if the user is already not on the whitelist if !strings.EqualFold(response, fmt.Sprintf("Removed %s from the whitelist", existingMCUsername)) { - simpleResponse(s, i, fmt.Sprintf("Failed to remove %s from whitelist: %s", existingMCUsername, response)) + simpleResponse(s, i, fmt.Sprintf("Failed to remove `%s` from whitelist: %s", existingMCUsername, response)) return } @@ -108,7 +108,7 @@ var ( SaveDB(dbPath, db) // send response - simpleResponse(s, i, fmt.Sprintf("%s unlinked minecraft username %s", invokingUserName, existingMCUsername)) + simpleResponse(s, i, fmt.Sprintf("`%s` unlinked minecraft username `%s`", invokingUserName, existingMCUsername)) } }, @@ -119,9 +119,9 @@ var ( existingMCUsername, ok := db[invokingUserID] if ok { - simpleResponse(s, i, fmt.Sprintf("%s is %s", invokingUserName, existingMCUsername)) + simpleResponse(s, i, fmt.Sprintf("`%s` is `%s`", invokingUserName, existingMCUsername)) } else { - simpleResponse(s, i, fmt.Sprintf("%s does not have a linked minecraft username", invokingUserName)) + simpleResponse(s, i, fmt.Sprintf("`%s` does not have a linked minecraft username", invokingUserName)) } }, }