go-tdlib icon indicating copy to clipboard operation
go-tdlib copied to clipboard

How to get the text content of historical messages

Open chenyu1990 opened this issue 5 years ago • 2 comments

How to get the text content of historical messages

chenyu1990 avatar Aug 24 '20 05:08 chenyu1990

history, err := client.GetChatHistory(cfg.AdChatID, 0, 0, 1, true)
if err != nil {
	return nil
}
for _, message := range history.Messages {
	contact := message.Content.(*tdlib.MessageContact)
	// contact is nil
}

chenyu1990 avatar Aug 24 '20 05:08 chenyu1990

If you do not parse the text message, it is better to return to Raw. I can only get the text message by modifying GetChatHistory to return to Raw

chenyu1990 avatar Aug 24 '20 05:08 chenyu1990