From 61643f579aa550b5ede24e9e74d46495925a5699 Mon Sep 17 00:00:00 2001 From: joeyak Date: Sun, 10 Mar 2019 20:47:59 -0400 Subject: [PATCH] Fixed bug where any mod could not change color --- chatcommands.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/chatcommands.go b/chatcommands.go index 61e9e75..4cc4b9e 100644 --- a/chatcommands.go +++ b/chatcommands.go @@ -201,7 +201,8 @@ func (cc *CommandControl) RunCommand(command string, args []string, sender *Clie } func cmdColor(cl *Client, args []string) string { - if cl.IsMod || cl.IsAdmin && len(args) == 2 { + // If the caller is priviledged enough, they can change the color of another user + if len(args) == 2 && (cl.IsMod || cl.IsAdmin) { color := "" name := "" for _, s := range args { @@ -222,6 +223,8 @@ func cmdColor(cl *Client, args []string) string { } return fmt.Sprintf("Color changed for user %s to %s\n", name, color) } + + // Change the color of the user if len(args) == 0 || !colorRegex.MatchString(args[0]) { cl.color = randomColor() return "Random color chosen. To choose a specific color use the format /color #c029ce. Hex values expected."