Browse Source

Add formatting to charge status

master
Gregory Rudolph 3 years ago
parent
commit
81d79a1b0e
Signed by: rudi
GPG Key ID: EF64F3CBD1A1EBDD
  1. 13
      commands.go

13
commands.go

@ -132,19 +132,20 @@ func chargeStatus(m chat1.MsgSummary) { @@ -132,19 +132,20 @@ func chargeStatus(m chat1.MsgSummary) {
ret := fmt.Sprintf("Status for %+v: ```", v.DisplayName)
ret += fmt.Sprintf("\nCurrent Charge: %+v (%+vmi)", state.BatteryLevel, state.BatteryRange)
if state.ChargingState != "Disconnected" {
ret += fmt.Sprintf("\nCharging State: %+v", state.ChargingState)
ret += fmt.Sprintf("\nTime to full: %+vmin", state.MinutesToFullCharge)
ret += fmt.Sprintf("\nConnected Cable: %+v", state.ConnChargeCable)
if state.FastChargerPresent {
ret += fmt.Sprintf("\nFast Charger: %+v %+v", state.FastChargerBrand, state.FastChargerType)
ret += fmt.Sprintf("\nCharging State: %+v", state.ChargingState)
if state.ChargingState != "Stopped" {
ret += fmt.Sprintf("\nTime to full: %+vmin", state.MinutesToFullCharge)
if state.FastChargerPresent {
ret += fmt.Sprintf("\nFast Charger: %+v %+v", state.FastChargerBrand, state.FastChargerType)
}
}
}
ret += "```\n"
if state.BatteryHeaterOn {
ret += "The battery heater is on. "
}
if state.ChargePortDoorOpen {
if state.ChargePortDoorOpen && state.ChargingState == "Disconnected" {
ret += "The charge port is open. "
}
k.SendMessageByConvID(m.ConvID, ret)

Loading…
Cancel
Save