Better error logging
This commit is contained in:
@ -388,10 +388,13 @@ func handleError(err error, m chat1.MsgSummary, msg string) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if strings.HasPrefix(err.Error(), "408") {
|
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.")
|
k.SendMessageByConvID(m.ConvID, "Unable to wake vehicle within the timeframe. Trying to run the command again.")
|
||||||
|
m.Content.Attachment.Uploaded = true
|
||||||
handleChat(m)
|
handleChat(m)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if strings.HasPrefix(err.Error(), "400") {
|
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)
|
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
|
return
|
||||||
|
|||||||
3
main.go
3
main.go
@ -44,6 +44,9 @@ func main() {
|
|||||||
|
|
||||||
func handleChat(m chat1.MsgSummary) {
|
func handleChat(m chat1.MsgSummary) {
|
||||||
defer log.PanicSafe()
|
defer log.PanicSafe()
|
||||||
|
if m.Content.TypeName != "text" {
|
||||||
|
return
|
||||||
|
}
|
||||||
parts := strings.Split(m.Content.Text.Body, " ")
|
parts := strings.Split(m.Content.Text.Body, " ")
|
||||||
command := strings.Replace(parts[0], "!", "", -1)
|
command := strings.Replace(parts[0], "!", "", -1)
|
||||||
for _, v := range commands {
|
for _, v := range commands {
|
||||||
|
|||||||
Reference in New Issue
Block a user