fix time parsing

This commit is contained in:
shoopea 2019-12-19 11:32:10 +08:00
parent a9a0d5f43e
commit c1ef937fc3

4
msg.go
View File

@ -429,14 +429,14 @@ func parseSubTypeMessageDuelFight(m *ChatWarsMessage, r *regexp.Regexp) (*ChatWa
func parseSubTypeMessageTimeAck(m *ChatWarsMessage, r *regexp.Regexp) (*ChatWarsMessageTimeAck, error) {
cwm := ChatWarsMessageTimeAck{}
t, err = fromChatWarsDate(r.ReplaceAllString(m.Text, "${Day}") + " " + r.ReplaceAllString(m.Text, "${Month}") + " " + r.ReplaceAllString(m.Text, "${Year}") + " " + r.ReplaceAllString(m.Text, "${Hour}") + ":" + r.ReplaceAllString(m.Text, "${Minute}"))
t, err := fromChatWarsDate(r.ReplaceAllString(m.Text, "${Day}") + " " + r.ReplaceAllString(m.Text, "${Month}") + " " + r.ReplaceAllString(m.Text, "${Year}") + " " + r.ReplaceAllString(m.Text, "${Hour}") + ":" + r.ReplaceAllString(m.Text, "${Minute}"))
logOnError(err, "parseSubTypeMessageTimeAck : fromChatWarsDate")
cwm.RealTime = t
cwm.TimeOfDay = r.ReplaceAllString(m.Text, "${Time}")
cwm.Hour, _ = strconv.ParseInt(r.ReplaceAllString(m.Text, "${Hour}"), 10, 64)
cwm.Minute, _ = strconv.ParseInt(r.ReplaceAllString(m.Text, "${Minute}"), 10, 64)
cwm.Day, _ = strconv.ParseInt(r.ReplaceAllString(m.Text, "${Day}"), 10, 64)
cwm.Month = chatWarsMonth[r.ReplaceAllString(d, "${Month}")]
cwm.Month = int64(chatWarsMonth[r.ReplaceAllString(d, "${Month}")])
cwm.Year, _ = strconv.ParseInt(r.ReplaceAllString(m.Text, "${Year}"), 10, 64)
cwm.Weather = r.ReplaceAllString(m.Text, "${Weather}")
cwm.WeatherNext = r.ReplaceAllString(m.Text, "${WeatherNext}")