fix
This commit is contained in:
parent
9d8e727fe0
commit
7d38a0329b
46
bot.go
46
bot.go
@ -771,6 +771,52 @@ func botCraftItem(m *ChatWarsMessage, r *regexp.Regexp) {
|
||||
return
|
||||
}
|
||||
|
||||
func botCraftAll(m *ChatWarsMessage, r *regexp.Regexp) {
|
||||
clt, err := getLockedIdleClient()
|
||||
if err != nil {
|
||||
c := TGCommand{
|
||||
Type: commandReplyMsg,
|
||||
Text: "Busy, please retry later.",
|
||||
FromMsgID64: m.ID64,
|
||||
FromChatID64: m.ChatID64,
|
||||
}
|
||||
TGCmdQueue <- c
|
||||
return
|
||||
}
|
||||
userID64 := clt.TGUserID64
|
||||
clt.Mux.Unlock()
|
||||
|
||||
p := JobPayloadCraftAll{
|
||||
MsgID64: m.ID64,
|
||||
ChatID64: m.ChatID64,
|
||||
Status: 0,
|
||||
}
|
||||
|
||||
b, _ := json.Marshal(p)
|
||||
t := time.Now().UTC().Add(1 * time.Second)
|
||||
_, err = createJob(cacheObjSubType[`job_craft_all`], objJobPriority, userID64, 0, t, b)
|
||||
|
||||
if err != nil {
|
||||
c := TGCommand{
|
||||
Type: commandReplyMsg,
|
||||
Text: fmt.Sprintf("%s", err),
|
||||
FromMsgID64: m.ID64,
|
||||
FromChatID64: m.ChatID64,
|
||||
}
|
||||
TGCmdQueue <- c
|
||||
} else {
|
||||
c := TGCommand{
|
||||
Type: commandReplyMsg,
|
||||
Text: "Craft all coming",
|
||||
FromMsgID64: m.ID64,
|
||||
FromChatID64: m.ChatID64,
|
||||
}
|
||||
TGCmdQueue <- c
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func botSaveRes(m *tb.Message) {
|
||||
if !m.Private() {
|
||||
return
|
||||
|
2
def.go
2
def.go
@ -493,7 +493,6 @@ type JobPayloadVaultItemStatus struct {
|
||||
type JobPayloadCraftItem struct {
|
||||
MsgID64 int64 `json:"msg_id"`
|
||||
ChatID64 int64 `json:"chat_id"`
|
||||
UserID64 int64 `json:"user_id"`
|
||||
ObjItemID64 int64 `json:"item_id"`
|
||||
Quantity int64 `json:"quantity"`
|
||||
Status int64 `json:"status"`
|
||||
@ -503,7 +502,6 @@ type JobPayloadCraftItem struct {
|
||||
type JobPayloadCraftAll struct {
|
||||
MsgID64 int64 `json:"msg_id"`
|
||||
ChatID64 int64 `json:"chat_id"`
|
||||
UserID64 int64 `json:"user_id"`
|
||||
Status int64 `json:"status"`
|
||||
VaultJobID64 int64 `json:"vault_job_id"`
|
||||
}
|
||||
|
@ -513,14 +513,7 @@ func SQLIdentifyMsgWorker(id int, objIds <-chan int64) {
|
||||
case cacheObjSubType[`msg_bot_craft_item`]:
|
||||
botCraftItem(m, rule.re)
|
||||
case cacheObjSubType[`msg_bot_craft_all`]:
|
||||
c := TGCommand{
|
||||
Type: commandReplyMsg,
|
||||
Text: `Not implemented yet`,
|
||||
FromMsgID64: m.ID64,
|
||||
FromChatID64: m.ChatID64,
|
||||
ParseMode: cmdParseModeHTML,
|
||||
}
|
||||
TGCmdQueue <- c
|
||||
botCraftAll(m, rule.re)
|
||||
default:
|
||||
//log.Printf("SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : Unknwon message type in rule %d : %d (%d)\n%s\n", msgParsingRules[i].ID, msgParsingRules[i].MsgTypeID64, objId, m.Text)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user