This commit is contained in:
shoopea 2019-05-04 18:21:53 +08:00
parent 2c9a25308d
commit 6b166993eb

6
td.go
View File

@ -97,7 +97,6 @@ func getHistory(c *tdlib.Client, chatID64 *int64, senderUserID64 *int64) {
for _, msg := range msgs.Messages { for _, msg := range msgs.Messages {
switch msg.Content.GetMessageContentEnum() { switch msg.Content.GetMessageContentEnum() {
case tdlib.MessageTextType: case tdlib.MessageTextType:
fmt.Println("msg.ForwardInfo : ", msg.ForwardInfo)
if msg.ForwardInfo == nil { if msg.ForwardInfo == nil {
m = ChatWarsMessage{ m = ChatWarsMessage{
SenderUserID64: int64(msg.SenderUserID), SenderUserID64: int64(msg.SenderUserID),
@ -106,7 +105,9 @@ func getHistory(c *tdlib.Client, chatID64 *int64, senderUserID64 *int64) {
ChatID64: msg.ChatID, ChatID64: msg.ChatID,
Text: msg.Content.(*tdlib.MessageText).Text.Text, Text: msg.Content.(*tdlib.MessageText).Text.Text,
} }
} else if msg.ForwardInfo.GetMessageForwardInfoEnum() == tdlib.MessageForwardedFromUserType { } else {
fmt.Println("msg.ForwardInfo : ", msg.ForwardInfo.GetMessageForwardInfoEnum())
if msg.ForwardInfo.GetMessageForwardInfoEnum() == tdlib.MessageForwardedFromUserType {
m = ChatWarsMessage{ m = ChatWarsMessage{
SenderUserID64: int64(msg.ForwardInfo.(*tdlib.MessageForwardedFromUser).SenderUserID), SenderUserID64: int64(msg.ForwardInfo.(*tdlib.MessageForwardedFromUser).SenderUserID),
Date: msg.ForwardInfo.(*tdlib.MessageForwardedFromUser).Date, Date: msg.ForwardInfo.(*tdlib.MessageForwardedFromUser).Date,
@ -119,6 +120,7 @@ func getHistory(c *tdlib.Client, chatID64 *int64, senderUserID64 *int64) {
ID64: 0, ID64: 0,
} }
} }
}
if m.ID64 != 0 && (*senderUserID64 == 0 || m.SenderUserID64 == *senderUserID64) { if m.ID64 != 0 && (*senderUserID64 == 0 || m.SenderUserID64 == *senderUserID64) {
MQCWMsgQueue <- m MQCWMsgQueue <- m