|
|
|
@ -306,13 +306,25 @@ func startCharge(m chat1.MsgSummary) {
@@ -306,13 +306,25 @@ func startCharge(m chat1.MsgSummary) {
|
|
|
|
|
if v == nil { |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
err := v.StartCharging() |
|
|
|
|
state, err := v.ChargeState() |
|
|
|
|
if err != nil { |
|
|
|
|
tracker := uuid.NewString() |
|
|
|
|
k.SendMessageByConvID(m.ConvID, "There was an error starting your charge. Contact @rudi9719 for more information with code %+v", tracker) |
|
|
|
|
k.SendMessageByConvID(m.ConvID, "There was an error getting charge state. Contact @rudi9719 for more information with code %+v", tracker) |
|
|
|
|
log.LogError("%+v: %+v", tracker, err) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
if state.ChargingState != "Disconnected" { |
|
|
|
|
err := v.StartCharging() |
|
|
|
|
if err != nil { |
|
|
|
|
tracker := uuid.NewString() |
|
|
|
|
k.SendMessageByConvID(m.ConvID, "There was an error starting your charge. Contact @rudi9719 for more information with code %+v", tracker) |
|
|
|
|
log.LogError("%+v: %+v", tracker, err) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
k.SendMessageByConvID(m.ConvID, "You must plug in first, to be able to charge.") |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func stopCharge(m chat1.MsgSummary) { |
|
|
|
@ -320,13 +332,24 @@ func stopCharge(m chat1.MsgSummary) {
@@ -320,13 +332,24 @@ func stopCharge(m chat1.MsgSummary) {
|
|
|
|
|
if v == nil { |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
err := v.StopCharging() |
|
|
|
|
state, err := v.ChargeState() |
|
|
|
|
if err != nil { |
|
|
|
|
tracker := uuid.NewString() |
|
|
|
|
k.SendMessageByConvID(m.ConvID, "There was an error stopping your charge. Contact @rudi9719 for more information with code %+v", tracker) |
|
|
|
|
k.SendMessageByConvID(m.ConvID, "There was an error getting charge state. Contact @rudi9719 for more information with code %+v", tracker) |
|
|
|
|
log.LogError("%+v: %+v", tracker, err) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
if state.ChargingState != "Disconnected" { |
|
|
|
|
err := v.StopCharging() |
|
|
|
|
if err != nil { |
|
|
|
|
tracker := uuid.NewString() |
|
|
|
|
k.SendMessageByConvID(m.ConvID, "There was an error stopping your charge. Contact @rudi9719 for more information with code %+v", tracker) |
|
|
|
|
log.LogError("%+v: %+v", tracker, err) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
k.SendMessageByConvID(m.ConvID, "You must plug in first, to be able to stop charging.") |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func enableStart(m chat1.MsgSummary) { |
|
|
|
|