From a631215f5bbc8a2b3aa199145ee4f0836e5538df Mon Sep 17 00:00:00 2001 From: Oliver Graff Date: Tue, 13 Jun 2017 08:12:32 -0700 Subject: [PATCH] /nick: Avoid announcing when it's the same nick (#237) Fixes #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)