This commit is contained in:
shoopea 2019-12-12 10:46:42 +08:00
parent 20da68c06c
commit 1914f82276

7
td.go
View File

@ -32,7 +32,7 @@ func ListenMe(c *tdlib.Client) {
func ListenMQ(c *tdlib.Client, msgs <-chan TGCommand) { func ListenMQ(c *tdlib.Client, msgs <-chan TGCommand) {
for m := range msgs { for m := range msgs {
b, _ := json.Marshal(m) //b, _ := json.Marshal(m)
//log.Printf("****************************** New MQ command ******************************\n%s\n****************************************************************************\n", string(b)) //log.Printf("****************************** New MQ command ******************************\n%s\n****************************************************************************\n", string(b))
go clientMsg(c, m) go clientMsg(c, m)
} }
@ -118,13 +118,12 @@ func ListenTest(c *tdlib.Client) {
chatID := int64(updateMsg.Message.ChatID) chatID := int64(updateMsg.Message.ChatID)
userID := int64(updateMsg.Message.SenderUserID) userID := int64(updateMsg.Message.SenderUserID)
forwardInfo := updateMsg.Message.ForwardInfo forwardInfo := updateMsg.Message.ForwardInfo
for _, v := range cfg.Listen {
if chatID == 408101137 && userID == 408101137 && forwardInfo == nil { if chatID == 408101137 && userID == 408101137 && forwardInfo == nil {
return true return true
} } else {
}
return false return false
} }
}
receiver := c.AddEventReceiver(&tdlib.UpdateNewMessage{}, eventFilter, 100) receiver := c.AddEventReceiver(&tdlib.UpdateNewMessage{}, eventFilter, 100)
for newMsg := range receiver.Chan { for newMsg := range receiver.Chan {