Refrain from getting updates of a channel

Hi All,

I’m working on a telegram Golang program using TDlib,
everytime that I run the program it will bring about 20 messages from about an hour or more before,
I want to refrain from getting them, I would be thankful for your comments.

Usually, I receive all messages missed while the instance wasn’t active. If there were a lot of missed messages, I will receive a lot of updateNewMessage updates soon after start.

I want to skip all updates about messages, which were sent before instance launch, by examining their send date.

my program is something like this:

// Send “/start” text every 5 seconds to Foursquare bot chat
go func() {
// Should get chatID somehow, check out “getChats” example
chatID := int64(198529620) // Foursquare bot chat id

	inputMsgTxt := tdlib.NewInputMessageText(tdlib.NewFormattedText("/start", nil), true, true)
	client.SendMessage(chatID, 0, 0, nil, nil, inputMsgTxt)

	time.Sleep(5 * time.Second)
}()

// rawUpdates gets all updates comming from tdlib
rawUpdates := client.GetRawUpdatesChannel(100)
for update := range rawUpdates {
	// Show all updates
	fmt.Println(update.Data)
	fmt.Print("\n\n")
}

I would be thankful for your comments.

Cheers

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.