2019-05-30 06:12:01 +02:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"strings"
|
|
|
|
)
|
|
|
|
|
|
|
|
func clientSendCWMsg(userID64 int64, s string) {
|
|
|
|
c := TGCommand{
|
|
|
|
Type: commandSendMsg,
|
|
|
|
Text: s,
|
|
|
|
FromUserID64: userID64,
|
|
|
|
ToChatID64: userID64ChtWrsBot,
|
|
|
|
}
|
|
|
|
MQTGCmdQueue <- c
|
|
|
|
}
|
|
|
|
|
2019-05-30 07:55:53 +02:00
|
|
|
func clientMsgMeAck(m *ChatWarsMessageMeAck) {
|
2019-05-30 08:08:39 +02:00
|
|
|
if _, ok := clientsQueue[m.Msg.UserID64]; ok {
|
2019-05-30 07:49:11 +02:00
|
|
|
if c, ok := clientsCW[m.UserID64]; ok {
|
2019-05-30 08:08:39 +02:00
|
|
|
if c.LastUpdate.Before(m.Msg.Date) {
|
2019-05-30 07:49:11 +02:00
|
|
|
c.GuildID64 = m.GuildID64
|
|
|
|
c.State = m.State
|
2019-05-30 08:08:39 +02:00
|
|
|
c.LastUpdate = m.Msg.Date
|
2019-05-30 07:49:11 +02:00
|
|
|
if cacheObjGuild[``].ObjID64 != m.GuildID64 && strings.Compare(c.Role, ``) == 0 {
|
2019-05-30 08:08:39 +02:00
|
|
|
clientSendCWMsg(m.Msg.UserID64, "/g_roles")
|
2019-05-30 06:12:01 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
c := ChatWarsClient{
|
2019-05-30 07:49:11 +02:00
|
|
|
GuildID64: m.GuildID64,
|
2019-05-30 07:50:21 +02:00
|
|
|
State: m.State,
|
2019-05-30 08:08:39 +02:00
|
|
|
LastUpdate: m.Msg.Date,
|
2019-05-30 06:12:01 +02:00
|
|
|
}
|
2019-05-30 07:49:11 +02:00
|
|
|
clientsCW[m.UserID64] = &c
|
|
|
|
if cacheObjGuild[``].ObjID64 != m.GuildID64 {
|
2019-05-30 08:08:39 +02:00
|
|
|
clientSendCWMsg(m.Msg.UserID64, "/g_roles")
|
2019-05-30 06:12:01 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|