From 46881a1cbee873844c4d5bc3c33cc73188eeb54e Mon Sep 17 00:00:00 2001 From: Oliver Graff Date: Sun, 11 Jun 2017 01:44:57 -0700 Subject: [PATCH] /nick: Avoid announcing when it's the same nick (#234) --- chat/command.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/chat/command.go b/chat/command.go index 49c8b7f..f6aa9bd 100644 --- a/chat/command.go +++ b/chat/command.go @@ -155,7 +155,11 @@ func InitCommands(c *Commands) { } oldID := member.ID() - member.SetID(SanitizeName(args[0])) + newID := SanitizeName(args[0]) + if newID == oldID { + return errors.New("new name is the same as the original") + } + member.SetID(newID) err := room.Rename(oldID, member) if err != nil { member.SetID(oldID)