diff --git a/bot.go b/bot.go index 6f66dc3..a0f69ce 100644 --- a/bot.go +++ b/bot.go @@ -80,17 +80,6 @@ func botDocument(m *tb.Message) { // documents only } -func botHello(m *tb.Message) (string, error) { - fmt.Println("botHello :", m.Text) - if !m.Private() { - fmt.Println("botHello : !m.Private()") - return ``, nil - } - // fmt.Println("Hello payload :", m.Payload) // - PrintText(m) - return `hello world`, nil -} - func botChannelPost(m *tb.Message) { PrintText(m) b, _ := json.Marshal(m) @@ -776,7 +765,7 @@ func botShops(m *ChatWarsMessage) { // fan out to all active and non idle clients clts, err := getAllIdleClientID64() - if err != nil { + if err != nil || len(clts) == 0 { c := TGCommand{ Type: commandReplyMsg, Text: "Busy, please retry later.", @@ -805,7 +794,7 @@ func botShops(m *ChatWarsMessage) { Shops: make([]string, 0), } for j, s := range cfg.Bot.Shops { - if (j / len(clts)) == i { + if (j % len(clts)) == i { j2.Shops = append(j2.Shops, s.Link) } } diff --git a/main.go b/main.go index 4e3a9b5..03b4d82 100644 --- a/main.go +++ b/main.go @@ -64,13 +64,6 @@ func main() { err := ReadConfig(*config) failOnError(err, "Parsing config") - _, err = Asset("data/code_obj_type.json") - failOnError(err, "data/code_obj_type.json") - _, err = Asset("data/code_obj_type.json") - failOnError(err, "data/code_obj_sub_type.json") - _, err = Asset("data/code_obj_type.json") - failOnError(err, "data/msg_rules.json") - // Connecting to DB switch cfg.SQL.Driver { case "mysql":