From de117eb5a9e723ec996c413206352aed97c9d78e Mon Sep 17 00:00:00 2001 From: Clif Gordon Date: Tue, 5 May 2020 12:04:42 -0700 Subject: [PATCH] Prepend @ symbol to names shown in user list, so they highlight (cherry picked from commit abfeb0c1cf270e90496f42e3545eafd2dc518782) --- chatcommands.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/chatcommands.go b/chatcommands.go index 7c499d8..d7de741 100644 --- a/chatcommands.go +++ b/chatcommands.go @@ -213,7 +213,18 @@ var commands = &CommandControl{ HelpText: "Show a list of users in chat", Function: func(cl *Client, args []string) (string, error) { names := cl.belongsTo.GetNames() - return strings.Join(names, " "), nil + formatNames := func(names []string) []string { + result := make([]string, len(names)) + for _, name := range names { + if strings.HasPrefix(name, "@") { + result = append(result, name) + } else { + result = append(result, "@"+name) + } + } + return result + } + return strings.Join(formatNames(names), " "), nil }, },