diff --git a/job.go b/job.go index 1e1ef17..c6c335f 100644 --- a/job.go +++ b/job.go @@ -3,6 +3,7 @@ package main import ( "encoding/json" "fmt" + "strconv" "time" ) @@ -87,8 +88,8 @@ func rescheduleJob(jobID64 int64, schedule time.Time) error { } defer stmt.Close() - _, err = stmt.Exec(time.Now(), jobId) - s := fmt.Sprintf("rescheduleJob, update obj_job(%d)", jobId) + _, err = stmt.Exec(time.Now(), jobID64) + s := fmt.Sprintf("rescheduleJob, update obj_job(%d)", jobID64) logOnError(err, s) if err != nil { return err @@ -246,7 +247,7 @@ func jobPillage(j Job) { s := TGCommand{ Type: commandSendMsg, Text: fmt.Sprintf("More than one outcome for pillage #%d", r.ObjID64), - ToUserID64: m.UserID64, + ToUserID64: j.UserID64, } TGCmdQueue <- s } else if len(ids) == 1 { // we've got a match, job is done whether we prevented the pillage or not @@ -261,21 +262,21 @@ func jobPillage(j Job) { s := TGCommand{ Type: commandSendMsg, Text: fmt.Sprintf("We avoided a pillage (%s)", m.Date.Format(time.RFC3339)), - ToUserID64: m.UserID64, + ToUserID64: j.UserID64, } TGCmdQueue <- s } else if msgTypeId == objSubTypeMessagePillageTimeout { s := TGCommand{ Type: commandSendMsg, Text: fmt.Sprintf("We got pillaged (%s)", m.Date.Format(time.RFC3339)), - ToUserID64: m.UserID64, + ToUserID64: j.UserID64, } TGCmdQueue <- s } else { s := TGCommand{ Type: commandSendMsg, Text: fmt.Sprintf("We don't know what happened (%s)", m.Date.Format(time.RFC3339)), - ToUserID64: m.UserID64, + ToUserID64: j.UserID64, } TGCmdQueue <- s } @@ -306,7 +307,7 @@ func jobPillage(j Job) { s := TGCommand{ Type: commandSendMsg, Text: fmt.Sprintf("We started intercepting the pillage (%s)", m.Date.Format(time.RFC3339)), - ToUserID64: m.UserID64, + ToUserID64: j.UserID64, } TGCmdQueue <- s }