Format bot account names

This commit is contained in:
Trevor Slocum 2023-12-29 23:00:42 -08:00
parent 5ec74dd3db
commit 86cc2df9cd

View file

@ -646,8 +646,20 @@ COMMANDS:
cmd.client.Terminate("No account was found with the provided username and password. To log in as a guest, do not enter a password.")
continue
}
var name []byte
if bytes.HasPrefix(a.username, []byte("bot_")) {
name = append([]byte("BOT_"), a.username[4:]...)
} else {
name = a.username
}
if s.clientByUsername(name) != nil {
cmd.client.Terminate("That username is already in use.")
continue
}
cmd.client.account = a.id
cmd.client.name = a.username
cmd.client.name = name
cmd.client.sendEvent(&bgammon.EventSettings{
Highlight: a.highlight,
Pips: a.pips,