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 ответов

7 просмотров

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?

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

Обсуждают сегодня

Вопрос тем кто смотрит видео и слушает подкасты - как вы потом ищете нужную вам информацию? Вот статью я прочитал, потом могу искать нужную мне часть банальным поиском. Пропус...
Aleksandr Druzhinin
4
Мне были интересны дишные хаки и я нашёл любопытный способ на форуме через __traits, что-то вроде int delegate(int) fac = (int n) => n == 0 ? 1 : n * __traits(parent, {})(n - ...
Constantin F.
1
Мне интересно, скорее людей здесь используют D, Rust, C/C++ для решения реальных прикладных задач за деньги?)
Evil Satanson
49
Я думаю тему с тем, что “Google не продвигает свои технологии. Язык Го сам просто такой хороший» можно закрыть https://www.opennet.ru/opennews/art.shtml?num=61454
Serg Gini
5
И к какой архитектуре привязана Java?
Dmitry Olshansky
17
В общем. если я беру Ди при всех его проблемах, у меня возникает первая реальная задача. Сохранения к игре, гибкие сохранения. У нас нет легкого nosql хранилища, которое можно...
Vi
10
На работе пишем распределенное приложение, у которого сотни, если не тысячи настроек. Конфиги написаны на xml, расположены на разных хостах и должны быть согласованы друг с др...
Aleksandr Druzhinin
5
а сколько всего в IT умерло? Где флеш-игры, их было туча, где они все? Сегодня технология есть, а завтра вжух и мёртвая. Этот wasm сильно напоминает джавовские апплеты, silver...
Constantin F.
5
если их разбить, то может сработать, но это уже немного не то int delegate(int) fac; fac = (n) => n == 0 ? 1 : n * fac(n-1); writeln(fac(5)); //120
Constantin F.
1
опять 25. сколько ты написал серверов, где все упиралось в вайб? не хватало тебе быстродействия, клиенты уходили и прочее? вот прямо не хватало тебе 25К запросов в секунду?
Aleksandr Druzhinin
2
Карта сайта