Better error logging

This commit is contained in:
2021-07-09 22:45:05 -04:00
parent d859ee6fe8
commit 610ea960f1
2 changed files with 20 additions and 14 deletions

View File

@ -388,10 +388,13 @@ func handleError(err error, m chat1.MsgSummary, msg string) {
return
}
if strings.HasPrefix(err.Error(), "408") {
if !m.Content.Attachment.Uploaded {
k.SendMessageByConvID(m.ConvID, "Unable to wake vehicle within the timeframe. Trying to run the command again.")
m.Content.Attachment.Uploaded = true
handleChat(m)
return
}
}
if strings.HasPrefix(err.Error(), "400") {
k.SendMessageByConvID(m.ConvID, "Tesla returned an error. The command you tried to use may need an update. Please contact @rudi9719 with tracking ID %+v and the bad command.", tracker)
return

View File

@ -44,6 +44,9 @@ func main() {
func handleChat(m chat1.MsgSummary) {
defer log.PanicSafe()
if m.Content.TypeName != "text" {
return
}
parts := strings.Split(m.Content.Text.Body, " ")
command := strings.Replace(parts[0], "!", "", -1)
for _, v := range commands {