diff --git a/host.go b/host.go index 4c54fba..1916e62 100644 --- a/host.go +++ b/host.go @@ -90,11 +90,20 @@ func (h *Host) isOp(conn sshd.Connection) bool { // Connect a specific Terminal to this host and its room. func (h *Host) Connect(term *sshd.Terminal) { - term.SetEnterClear(true) // We provide our own echo rendering id := NewIdentity(term.Conn) user := message.NewUserScreen(id, term) cfg := user.Config() - cfg.Theme = &h.theme + + apiMode := strings.ToLower(term.Term()) == "bot" + + if apiMode { + cfg.Theme = message.MonoTheme + cfg.Echo = false + } else { + term.SetEnterClear(true) // We provide our own echo rendering + cfg.Theme = &h.theme + } + user.SetConfig(cfg) // Load user config overrides from ENV @@ -190,10 +199,12 @@ func (h *Host) Connect(term *sshd.Terminal) { m := message.ParseInput(line, user) - if m, ok := m.(*message.CommandMsg); ok { - // Other messages render themselves by the room, commands we'll - // have to re-echo ourselves manually. - user.HandleMsg(m) + if !apiMode { + if m, ok := m.(*message.CommandMsg); ok { + // Other messages render themselves by the room, commands we'll + // have to re-echo ourselves manually. + user.HandleMsg(m) + } } // FIXME: Any reason to use h.room.Send(m) instead?