Telegram.Bot icon indicating copy to clipboard operation
Telegram.Bot copied to clipboard

Telegram.Bot.Exceptions.ApiRequestException: Request timed out on SendTextMessageAsync

Open AndreyPolovodov opened this issue 9 years ago • 2 comments

Hello! I've got a lot of such errors in my bot today... I don't know the reason, may be network or telegram servers issue, but because of timeout my message queue is growing very fast.. I think if I can set less timeout for this error it will be possible to make next try faster... So, the question is - how I can set timeout for SendTextMessageAsync? And what is default value for it now? I can see only UploadTimeout - looks like it's not what I want. Is it possible? I can see only way to use CancellationToken...

AndreyPolovodov avatar Feb 10 '17 13:02 AndreyPolovodov

You can indeed only use the cancellation token... consider something like this

bot.SendTextMessageAsync(paramsStuff, new CancellationTokenSource(milliseconds).Token);

Olfi01 avatar Jul 15 '17 10:07 Olfi01

@Olfi01 i am facing same error using this api "SendPhotoAsync". i am go wanna send image with caption on telegram bot so how can fix ti. can you please tell me.

This is my api code =>

await Bot.SendPhotoAsync("@abc", new FileToSend(ds.Tables[0].Rows[i]["Url"].ToString(), StreamImage), "hiiiii" );

Coderwill avatar Sep 20 '17 08:09 Coderwill