Skip to content

ReceivingUpdates

immmdreza edited this page Jul 3, 2021 · 1 revision

As an quick and simple approach the there are 3 main method for that!

1- Fly

This method is for Flamingo library and receive updates and pass the to the processors as they arrive. There is no queueing or something like that!

Every update will process in a separate thread in parallel with others.

This method may increase the respond time of your bot.

await flamingo.Fly();

2- StartReceiving & ReceiveAsync

These methods are for Telegram.Bot.Extensions.Polling. as it looks these method send update one by one to the update processors, meaning you should wait for an update to finish processing then go to the others.

This can make your bot looks slow. if you are using await-able incoming handlers, this methods are not recommended ( by me at least ) because those handlers wait for a single use to respond and all along that period your bot doesn't handle anything else!

await flamingo.ReceiveAsync(ErrorHandler);

Or

flamingo.StartReceiving(ErrorHandler);

3- None ?!

You don't really need to use default update receivers, You can make your own if you like to!

Just call flamingo.UpdateRedirector(update) when you fetch the incoming update and it will redirected to flamingo handlers!

// Working hard to fetch an update here!

{
    await UpdateRedirector(update);
}

You can look into DeepInside Flamingo for a similar example.

Flamingo Framework written in pure c#, install from Nuget

Clone this wiki locally