test
This commit is contained in:
parent
cbbac16de9
commit
5d3e480a54
20
workers.go
20
workers.go
@ -127,7 +127,7 @@ func SQLIdentifyMsgWorker(id int, objIds <-chan int64) {
|
||||
s := TGCommand{
|
||||
Type: commandSendMsg,
|
||||
Text: fmt.Sprintf("Catching pillage (%s)", m.Date.Format(time.RFC3339)),
|
||||
ToChatID64: m.UserID64,
|
||||
ToUserID64: m.UserID64,
|
||||
}
|
||||
TGCmdQueue <- s
|
||||
case objSubTypeMessageGo:
|
||||
@ -206,6 +206,20 @@ func TGCmdWorker(id int, b *tb.Bot, cmds <-chan TGCommand) {
|
||||
}
|
||||
_, err := b.Reply(&m, c.Text)
|
||||
logOnError(err, "TGCmdWorker["+strconv.Itoa(id)+"] : Reply")
|
||||
case commandSendMsg:
|
||||
if c.ToChatID64 != 0 {
|
||||
ch := tb.Chat{
|
||||
ID: c.ToChatID64,
|
||||
}
|
||||
_, err := b.Send(&ch, c.Text)
|
||||
logOnError(err, "TGCmdWorker["+strconv.Itoa(id)+"] : Send")
|
||||
} else if c.ToUserID64 != 0 {
|
||||
ch := tb.Chat{
|
||||
ID: c.ToUserID64,
|
||||
}
|
||||
_, err := b.Send(&ch, c.Text)
|
||||
logOnError(err, "TGCmdWorker["+strconv.Itoa(id)+"] : Send")
|
||||
}
|
||||
default:
|
||||
|
||||
}
|
||||
@ -271,7 +285,7 @@ func MQKeepAliveWorker() {
|
||||
clientsQueues[x.UserID64] = &x
|
||||
c := TGCommand{
|
||||
Type: commandSendMsg,
|
||||
ToChatID64: x.UserID64,
|
||||
ToUserID64: x.UserID64,
|
||||
Text: "You are connected.",
|
||||
}
|
||||
TGCmdQueue <- c
|
||||
@ -291,7 +305,7 @@ func MQTidyKeepAliveWorker() {
|
||||
if v.Date.Add(90 * time.Second).Before(time.Now()) {
|
||||
c := TGCommand{
|
||||
Type: commandSendMsg,
|
||||
ToChatID64: v.UserID64,
|
||||
ToUserID64: v.UserID64,
|
||||
Text: "Timeout.",
|
||||
}
|
||||
TGCmdQueue <- c
|
||||
|
Loading…
Reference in New Issue
Block a user