I am not able to make the editMessageText () method

asynchronous (this method in my code is inside a for loop that lasts about ten seconds). I noticed via "getWebhookinfo" that pending_update_count: 1

Is there any way to force it to "0"? this way I would make the editMessageText method asynchronous.

7 ответов

15 просмотров

Not sure what are you trying to do in a loop you need to provide more details in your question. Read this , and of course... Read the telegram bot API docs... really..top to end you are gonna needed. That been said. You can use the drop_pending_updates true in delete webhook and setwebhook

Giovanni-VI Автор вопроса

Let me explain better: A) if in the chat with the bot I write "ok" 1) I use the sendMessage method to write "Count 0" 2) then there is a for loop and inside there is the editMesageText () method used to modify the previous message and show: "Count $i" ($i would be the index of the for loop) B) if in the chat with the bot I write "stop" 3) I use the sendMessage method to write "END" "B" does not work if for loop is running (point 2). How can I solve and run "B" when the loop is in progress?

You need to find another way...i sending message burst it's not the best way to scale the problem .. remember if you send to many messages per seconds you get rate limited . ..need to improve your code... maybe use a button to check state and answer query with the count update??

Giovanni-VI Автор вопроса

I don’t send many messages per seconds... i edit only one last message. My problem is not this. Thanks.

It doesn't matter you are sending a request to telegram API to modify the message...so if the for makes ~30 iterations per second...you get 429 error and telegram won't send more updates to you in a time... because your abusing the API

Giovanni-VI Автор вопроса

is a for loop < 100. Again... my problem is not this. Thank you for the help and sorry for my english 😊

You are using PHP , right?

Похожие вопросы

Карта сайта