test
This commit is contained in:
parent
03e0d85446
commit
324b0ae8c7
4
bot.go
4
bot.go
@ -84,7 +84,9 @@ func botMsgRescan(m *tb.Message) (string, error) {
|
|||||||
r := regexp.MustCompile("^[0-9]+$")
|
r := regexp.MustCompile("^[0-9]+$")
|
||||||
if r.MatchString(m.Payload) {
|
if r.MatchString(m.Payload) {
|
||||||
p := JobPayloadRescanMsg{
|
p := JobPayloadRescanMsg{
|
||||||
Query: fmt.Sprintf("SELECT o.id FROM obj o WHERE o.id = %s AND o.obj_type_id = %d AND o.obj_sub_type_id = %d;", m.Payload, objTypeMessage, objSubTypeMessageUnknown),
|
Query: fmt.Sprintf("SELECT o.id FROM obj o WHERE o.id = %s AND o.obj_type_id = %d AND o.obj_sub_type_id = %d;", m.Payload, objTypeMessage, objSubTypeMessageUnknown),
|
||||||
|
MsgID64: int64(m.ID),
|
||||||
|
ChatID64: m.Chat.ID,
|
||||||
}
|
}
|
||||||
b, _ := json.Marshal(p)
|
b, _ := json.Marshal(p)
|
||||||
log.Printf("botMsgRescan : json : %s\n", string(b))
|
log.Printf("botMsgRescan : json : %s\n", string(b))
|
||||||
|
7
def.go
7
def.go
@ -108,9 +108,10 @@ type JobPayloadRescanMsg struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type JobPayloadSetDone struct {
|
type JobPayloadSetDone struct {
|
||||||
JobID64 int64 `json:"job_id"`
|
JobID64 int64 `json:"job_id"`
|
||||||
MsgID64 int64 `json:"msg_id"`
|
MsgID64 int64 `json:"msg_id"`
|
||||||
ChatID64 int64 `json:"chat_id"`
|
ChatID64 int64 `json:"chat_id"`
|
||||||
|
Text string `json:"test"`
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
23
job.go
23
job.go
@ -24,22 +24,39 @@ func jobRescan(j Job) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
b, _ := json.Marshal(p)
|
b, _ := json.Marshal(p)
|
||||||
err := createJob(objSubTypeJobRescanMsg, objJobPriorityRescanChildMsg, time.Now(), b)
|
err := createJob(objSubTypeJobRescanMsg, objJobPriorityRescanChildMsg, j.UserID64, time.Now(), b)
|
||||||
logOnError(err, "jobRescan : createJob(objSubTypeJobRescanMsg)")
|
logOnError(err, "jobRescan : createJob(objSubTypeJobRescanMsg)")
|
||||||
}
|
}
|
||||||
p := JobPayloadSetDone{
|
p := JobPayloadSetDone{
|
||||||
JobID64: j.ID64,
|
JobID64: j.ID64,
|
||||||
|
MsgID64: j.MsgID64,
|
||||||
|
ChatID64: j.ChatID64,
|
||||||
|
Text: fmt.Sprintf("%d messages processed.", len(ids)),
|
||||||
}
|
}
|
||||||
b, _ := json.Marshal(p)
|
b, _ := json.Marshal(p)
|
||||||
err := createJob(objSubTypeJobSetJobDone, objJobPriority, time.Now(), b)
|
err := createJob(objSubTypeJobSetJobDone, objJobPriority, j.UserID64, time.Now(), b)
|
||||||
logOnError(err, "jobRescan : createJob(objSubTypeJobSetJobDone)")
|
logOnError(err, "jobRescan : createJob(objSubTypeJobSetJobDone)")
|
||||||
} else if len(ids) == 1 {
|
} else if len(ids) == 1 {
|
||||||
SQLMsgIdentifyQueue <- ids[0]
|
SQLMsgIdentifyQueue <- ids[0]
|
||||||
err = setJobDone(j.ID64)
|
err = setJobDone(j.ID64)
|
||||||
logOnError(err, "jobRescan : setJobDone(1)")
|
logOnError(err, "jobRescan : setJobDone(1)")
|
||||||
|
m := TGCommand{
|
||||||
|
Type: commandReplyMsg,
|
||||||
|
Text: "One message processed.",
|
||||||
|
FromMsgID64: j.MsgID64,
|
||||||
|
FromChatID64j.ChatID64,
|
||||||
|
}
|
||||||
|
TGCmdQueue <- m
|
||||||
} else {
|
} else {
|
||||||
err = setJobDone(j.ID64)
|
err = setJobDone(j.ID64)
|
||||||
logOnError(err, "jobRescan : setJobDone(0)")
|
logOnError(err, "jobRescan : setJobDone(0)")
|
||||||
|
m := TGCommand{
|
||||||
|
Type: commandReplyMsg,
|
||||||
|
Text: "No message processed.",
|
||||||
|
FromMsgID64: j.MsgID64,
|
||||||
|
FromChatID64j.ChatID64,
|
||||||
|
}
|
||||||
|
TGCmdQueue <- m
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user