main: Skip prompt, highlight, autocomplete in bot mode

This commit is contained in:
Andrey Petrov 2020-04-13 11:33:12 -04:00
parent 5055bbc859
commit a3f41865fd

13
host.go
View File

@ -160,9 +160,11 @@ func (h *Host) Connect(term *sshd.Terminal) {
}
// Successfully joined.
term.SetPrompt(GetPrompt(user))
term.AutoCompleteCallback = h.AutoCompleteFunction(user)
user.SetHighlight(user.Name())
if !apiMode {
term.SetPrompt(GetPrompt(user))
term.AutoCompleteCallback = h.AutoCompleteFunction(user)
user.SetHighlight(user.Name())
}
// Should the user be op'd on join?
if h.isOp(term.Conn) {
@ -210,6 +212,11 @@ func (h *Host) Connect(term *sshd.Terminal) {
// FIXME: Any reason to use h.room.Send(m) instead?
h.HandleMsg(m)
if apiMode {
// Skip the remaining rendering workarounds
continue
}
cmd := m.Command()
if cmd == "/nick" || cmd == "/theme" {
// Hijack /nick command to update terminal synchronously. Wouldn't