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

24
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,17 +105,20 @@ 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 {
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 { } else {
m = ChatWarsMessage{ fmt.Println("msg.ForwardInfo : ", msg.ForwardInfo.GetMessageForwardInfoEnum())
ID64: 0, 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,
}
} }
} }