From a3f41865fdd9948fa5a2a6a3f140d6ea2fe782eb Mon Sep 17 00:00:00 2001
From: Andrey Petrov <andrey.petrov@shazow.net>
Date: Mon, 13 Apr 2020 11:33:12 -0400
Subject: [PATCH] main: Skip prompt, highlight, autocomplete in bot mode

---
 host.go | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/host.go b/host.go
index 1916e62..8973229 100644
--- a/host.go
+++ b/host.go
@@ -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