From 385b99d688fc2d47c8486302c4917dd8cf0e7299 Mon Sep 17 00:00:00 2001 From: shoopea Date: Sat, 29 Feb 2020 17:36:14 +0800 Subject: [PATCH] commits count --- bot.go | 2 +- job.go | 1 + main.go | 3 ++- msg.go | 6 ------ 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/bot.go b/bot.go index a6c2425..e4411aa 100644 --- a/bot.go +++ b/bot.go @@ -820,7 +820,7 @@ func botShops(m *ChatWarsMessage) { c := TGCommand{ Type: commandReplyMsg, - Text: fmt.Sprintf("Shops coming (ETA : %ds)", ((len(cfg.Bot.Shops)/len(clts))-1)*4), + Text: fmt.Sprintf("Shops coming (ETA : %ds)", (len(cfg.Bot.Shops)/len(clts))*5), FromMsgID64: m.ID64, FromChatID64: m.ChatID64, } diff --git a/job.go b/job.go index b8d94be..02a9118 100644 --- a/job.go +++ b/job.go @@ -2079,6 +2079,7 @@ func jobAlchAll(j Job) { rule, err := getMsgParsingRule(m) logOnError(err, "jobAlchAll : getMsgParsingRule") if rule.MsgTypeID64 == cacheObjSubType[`msg_alch_stock_ack`] { + c := TGCommand{ Type: commandReplyMsg, Text: "Success.", diff --git a/main.go b/main.go index 03b4d82..0bc3fe1 100644 --- a/main.go +++ b/main.go @@ -23,6 +23,7 @@ var ( initdb = flag.Bool("initdb", false, "initialize bot database") githash string buildstamp string + commits string db *sql.DB bot *tb.Bot @@ -108,7 +109,7 @@ func main() { u := tb.User{ ID: int(cfg.Bot.Admin), } - bot.Send(&u, fmt.Sprintf("Started (%s - %s)", githash, buildstamp)) + bot.Send(&u, fmt.Sprintf("Started (%s-b%s - %s)", githash, commits, buildstamp)) cr = startCron() diff --git a/msg.go b/msg.go index 6871a3a..6e72ff7 100644 --- a/msg.go +++ b/msg.go @@ -100,11 +100,8 @@ func parseSubTypeMessageAlchStockAck(m *ChatWarsMessage, r *regexp.Regexp) (*Cha cwm := ChatWarsMessageStockAnyAck{} items := []ChatWarsItems{} - log.Printf("parseSubTypeMessageAlchStockAck : Start\n") - re := regexp.MustCompile(`\n\/aa_([0-9]{2}) ([a-zA-Z ']+) x ([0-9]+)`) for _, l := range re.FindAllStringSubmatch(r.ReplaceAllString(m.Text, "${Stuff}"), -1) { - log.Printf("parseSubTypeMessageAlchStockAck : %+q\n", l) i := getObjItemID(l[1], ``) q, _ := strconv.ParseInt(l[3], 10, 64) if i != 0 { @@ -113,12 +110,9 @@ func parseSubTypeMessageAlchStockAck(m *ChatWarsMessage, r *regexp.Regexp) (*Cha Quantity: q, } items = append(items, item) - log.Printf("parseSubTypeMessageAlchStockAck : %d - %d\n", i, q) } } - log.Printf("parseSubTypeMessageAlchStockAck : Done\n") - cwm.Stock = items cwm.Msg = m return &cwm, nil