【问题标题】:WebHook sends old update telegram botWebHook 发送旧的更新电报机器人
【发布时间】:2018-11-25 00:06:49
【问题描述】:

当我使用 WebHook 方法时,此方法发送旧更新。我怎样才能防止这种情况发生?

else if (text != null && text.Equals("متن ارسال شود") && (update.Message.Chat.Id == WebApiApplication.chatId1 || update.Message.Chat.Id == WebApiApplication.chatId2)) {
     WebApiApplication.SenderCount = 0;
     int i = 0;
     String[] Array;
     TelBotEntities1 db = new TelBotEntities1();
     int count = db.SenderBots.Count();
     Array = new string[count];
     foreach(var dbItem in db.SenderBots) {
         Array[i] = dbItem.ChannelId;
         i++;
     }

【问题讨论】:

  • 您好,请花点时间通过welcome tour 了解您的方法,阅读如何创建minimal reproducible example 示例并查看How to Ask,这样您就有机会获得反馈和有用的答案。
  • 我应该如何使用偏移量或其他任何东西来防止旧更新?

标签: bots telegram


【解决方案1】:

Telegram Webhook 会自动重发失败的更新,你可以通过getWebhookInfopending_update_count参数看到。

您无法阻止这种情况,只需忽略启动程序后的前几次更新即可。

【讨论】:

  • 试试 exit();功能,这取决于您使用的语言。
  • 我使用asp.net,毕竟我使用return Ok();
猜你喜欢
  • 1970-01-01
  • 2017-09-16
  • 2019-03-14
  • 2017-03-19
  • 2017-06-16
  • 1970-01-01
  • 2017-09-01
  • 2016-10-17
  • 1970-01-01
相关资源
最近更新 更多