This commit is contained in:
shoopea 2019-05-31 18:41:26 +08:00
parent a04debbc83
commit 40a8be4548
2 changed files with 29 additions and 6 deletions

View File

@ -1,10 +1,15 @@
ChirpNestBot
- [ ] Crontab : engine, user interface
- [ ] Impersonate
- [ ] Items parsing/identification
- [ ] Withdrawal bot
- [x] Foray interception
- [ ] Auto identificate weight of items
- [ ] Tribute interception
- [ ] Withdrawal bot
- [ ] Crontab : engine, user interface
- [ ] Resources hidding
- [ ] Resources auto destroy
- [ ] Crafting helper (rss, recipes, part) + valuation
- [ ] Vault snapshot/diff
- [ ] Vault valuation
- [ ] Experience graphs & forecast
- [ ] Redis/eliminate map race conditions
- [ ] Impersonate
- [x] Foray interception
- [x] Eliminate cache map race conditions

18
bot.go
View File

@ -30,6 +30,8 @@ func BotHandlers(b *tb.Bot) {
b.Handle("/timer", botTimer)
b.Handle("/g_stock", botGStock)
b.Handle(tb.OnPhoto, botPhoto)
b.Handle(tb.OnChannelPost, botChannelPost)
b.Handle(tb.OnQuery, botQuery)
@ -229,6 +231,9 @@ func botListParsingRules(m *tb.Message) {
}
func botListParsingRule(m *tb.Message) {
if !m.Private() {
return
}
r := regexp.MustCompile("^[0-9]+$")
if r.MatchString(m.Payload) {
i, _ := strconv.ParseInt(m.Payload, 10, 64)
@ -263,6 +268,19 @@ func botListParsingRule(m *tb.Message) {
return
}
func botGStock(m *tb.Message) {
if !m.Private() {
return
}
clientSendCWMsg(m.Chat.ID, "/g_stock_res")
clientSendCWMsg(m.Chat.ID, "/g_stock_alch")
clientSendCWMsg(m.Chat.ID, "/g_stock_misc")
clientSendCWMsg(m.Chat.ID, "/g_stock_rec")
clientSendCWMsg(m.Chat.ID, "/g_stock_parts")
clientSendCWMsg(m.Chat.ID, "/g_stock_other")
return
}
func botTimer(m *tb.Message) {
r := regexp.MustCompile("^(?P<Duration>([0-9]*(s|m|h))+) \"(?P<Msg>(.*))\"$")
if r.MatchString(m.Payload) {