/nick: Avoid announcing when it's the same nick (#237)

Fixes #234
This commit is contained in:
Oliver Graff 2017-06-13 08:12:32 -07:00 committed by Andrey Petrov
parent 25689a88ed
commit a631215f5b

View File

@ -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)