This commit is contained in:
shoopea 2019-07-09 15:12:03 +08:00
parent e5295068be
commit 35f6359d1f
3 changed files with 21 additions and 3 deletions

View File

@ -21,6 +21,7 @@ ChirpNestBot
- [ ] Vault valuation - [ ] Vault valuation
- [ ] Experience graphs & forecast - [ ] Experience graphs & forecast
- [ ] Impersonate - [ ] Impersonate
- [ ] Link TelegramUserID and UserID
- [x] Foray interception - [x] Foray interception
- [x] Export/import all messages - [x] Export/import all messages
- [x] Test HTML in message - [x] Test HTML in message
@ -30,4 +31,5 @@ ChirpNestBot
- [x] Rewrite MQ connection handling for clients/keep alive/msg recv - [x] Rewrite MQ connection handling for clients/keep alive/msg recv
- Progression : - Progression :
- 0 -> 4 : Forest + Foray ; - 0 -> 4 : Forest + Foray ;
- 5 -> 20 : Forest + Foray + Arena ; - 5 -> 19 : Forest + Foray + Arena ;
- 20 -> .. : Forest + Swamp + Valley + Foray + Arena.

View File

@ -1,6 +1,7 @@
package main package main
import ( import (
"errors"
"fmt" "fmt"
"strings" "strings"
"time" "time"
@ -115,3 +116,13 @@ func clientMsgGRolesAck(m *ChatWarsMessageGRolesAck) {
} }
} }
} }
func clientGetUserID64(tgUserID64 int64) (int64, error) {
if _, ok := clientsQueue[tgUserID64]; ok {
if v, ok := clientsCW.Load(tgUserID64); ok {
c := v.(*ChatWarsClient)
return c.UserID64, nil
}
}
return 0, errors.New("Unknown user_id.")
}

View File

@ -400,8 +400,13 @@ func SQLIdentifyMsgWorker(id int, objIds <-chan int64) {
cwm, err := parseSubTypeMessageGoQuestAck(m, r) cwm, err := parseSubTypeMessageGoQuestAck(m, r)
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : Parsing objSubTypeMessageMeAck.") logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : Parsing objSubTypeMessageMeAck.")
cwm.Msg = m cwm.Msg = m
uid, err := clientGetUserID64(cwm.UserID64)
if err != nil {
err = setObjSubTypeId(objId, objSubTypeMessageUnknown)
} else {
clientMsgGoQuestAck(cwm) clientMsgGoQuestAck(cwm)
_, err = addObjQuest(m.UserID64, cwm.QuestTypeID, cwm.Duration, m.Date.UTC()) _, err = addObjQuest(cwm.UserID64, cwm.QuestTypeID, cwm.Duration, m.Date.UTC())
}
case objSubTypeMessageDuelFight: case objSubTypeMessageDuelFight:
cwm, err := parseSubTypeMessageDuelFight(m, r) cwm, err := parseSubTypeMessageDuelFight(m, r)
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : Parsing objSubTypeMessageDuelFight.") logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : Parsing objSubTypeMessageDuelFight.")