This commit is contained in:
shoopea 2020-02-03 16:45:00 +08:00
parent 491c9a8029
commit a6c99c7f7b

9
sql.go
View File

@ -6,6 +6,8 @@ import (
"log"
"regexp"
"strconv"
"github.com/go-sql-driver/mysql"
)
func initDB() {
@ -659,7 +661,12 @@ func insertMsgTributesStats(m *ChatWarsMessageTributesStatsAck) error {
for _, t := range m.Tributes {
_, err = stmt.Exec(m.Msg.TGUserID64, t.ItemID64, t.Quantity, t.Exp, t.Date)
logOnError(err, "insertMsgTributesStats Exec")
mysqlerr, ok := err.(*mysql.MySQLError)
if ok && mysqlerr.Number == 1062 {
// duplicate, expected
} else {
logOnError(err, "insertMsgTributesStats Exec")
}
}
return nil