diff --git a/ui.go b/ui.go index 716e548..044bb39 100644 --- a/ui.go +++ b/ui.go @@ -125,7 +125,7 @@ func (b *Barnard) OnScrollOutputBottom(ui *uiterm.Ui, key uiterm.Key) { b.UiOutput.ScrollBottom() } -var commands = []string{"/clear", "/deafen", "/exit", "/help", "/quit"} +var commands = []string{"/clear", "/deafen", "/exit", "/help", "/quit", "/register"} func (b *Barnard) OnFocusPress(ui *uiterm.Ui, key uiterm.Key) { active := b.Ui.Active() @@ -181,8 +181,18 @@ func (b *Barnard) OnTextInput(ui *uiterm.Ui, textbox *uiterm.Textbox, text strin case "/clear": b.OnClearPress(ui, 0) return + case "/register": + if b.Client != nil && b.Client.Self != nil { + if b.Client.Self.IsRegistered() { + b.AddOutputLine("Already registered") + } else { + b.Client.Self.Register() + b.AddOutputLine("Registration request sent") + } + } + return case "/help": - b.AddOutputLine("/quit /exit /deafen /clear /help") + b.AddOutputLine("/quit /exit /deafen /clear /register /help") return } if b.Client != nil && b.Client.Self != nil {