From 6b166993eb92cddfc9048838148fc0919741b764 Mon Sep 17 00:00:00 2001 From: shoopea Date: Sat, 4 May 2019 18:21:53 +0800 Subject: [PATCH] test --- td.go | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/td.go b/td.go index 04931a3..13d87b3 100644 --- a/td.go +++ b/td.go @@ -97,7 +97,6 @@ func getHistory(c *tdlib.Client, chatID64 *int64, senderUserID64 *int64) { for _, msg := range msgs.Messages { switch msg.Content.GetMessageContentEnum() { case tdlib.MessageTextType: - fmt.Println("msg.ForwardInfo : ", msg.ForwardInfo) if msg.ForwardInfo == nil { m = ChatWarsMessage{ SenderUserID64: int64(msg.SenderUserID), @@ -106,17 +105,20 @@ func getHistory(c *tdlib.Client, chatID64 *int64, senderUserID64 *int64) { ChatID64: msg.ChatID, Text: msg.Content.(*tdlib.MessageText).Text.Text, } - } else if msg.ForwardInfo.GetMessageForwardInfoEnum() == tdlib.MessageForwardedFromUserType { - m = ChatWarsMessage{ - SenderUserID64: int64(msg.ForwardInfo.(*tdlib.MessageForwardedFromUser).SenderUserID), - Date: msg.ForwardInfo.(*tdlib.MessageForwardedFromUser).Date, - ID64: msg.ForwardInfo.(*tdlib.MessageForwardedFromUser).ForwardedFromMessageID, - ChatID64: msg.ForwardInfo.(*tdlib.MessageForwardedFromUser).ForwardedFromChatID, - Text: msg.Content.(*tdlib.MessageText).Text.Text, - } } else { - m = ChatWarsMessage{ - ID64: 0, + fmt.Println("msg.ForwardInfo : ", msg.ForwardInfo.GetMessageForwardInfoEnum()) + if msg.ForwardInfo.GetMessageForwardInfoEnum() == tdlib.MessageForwardedFromUserType { + m = ChatWarsMessage{ + SenderUserID64: int64(msg.ForwardInfo.(*tdlib.MessageForwardedFromUser).SenderUserID), + Date: msg.ForwardInfo.(*tdlib.MessageForwardedFromUser).Date, + ID64: msg.ForwardInfo.(*tdlib.MessageForwardedFromUser).ForwardedFromMessageID, + ChatID64: msg.ForwardInfo.(*tdlib.MessageForwardedFromUser).ForwardedFromChatID, + Text: msg.Content.(*tdlib.MessageText).Text.Text, + } + } else { + m = ChatWarsMessage{ + ID64: 0, + } } }