add text commands: /quit /exit /deafen /clear /help
This commit is contained in:
14
ui.go
14
ui.go
@@ -135,6 +135,20 @@ func (b *Barnard) OnTextInput(ui *uiterm.Ui, textbox *uiterm.Textbox, text strin
|
|||||||
if text == "" {
|
if text == "" {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
switch strings.TrimSpace(text) {
|
||||||
|
case "/quit", "/exit":
|
||||||
|
b.OnQuitPress(ui, 0)
|
||||||
|
return
|
||||||
|
case "/deafen":
|
||||||
|
b.OnDeafenToggle(ui, 0)
|
||||||
|
return
|
||||||
|
case "/clear":
|
||||||
|
b.OnClearPress(ui, 0)
|
||||||
|
return
|
||||||
|
case "/help":
|
||||||
|
b.AddOutputLine("/quit /exit /deafen /clear /help")
|
||||||
|
return
|
||||||
|
}
|
||||||
if b.Client != nil && b.Client.Self != nil {
|
if b.Client != nil && b.Client.Self != nil {
|
||||||
b.Client.Self.Channel.Send(text, false)
|
b.Client.Self.Channel.Send(text, false)
|
||||||
b.AddOutputMessage(b.Client.Self, text)
|
b.AddOutputMessage(b.Client.Self, text)
|
||||||
|
|||||||
Reference in New Issue
Block a user