ВК бот зацикливается на одном сообщении. C#

ВК бот зацикливается на одном сообщении. Подскажите, как исправить данную проблему.

    static void Main(string[] args)
    {
        var api = new VkApi();
        api.Authorize(new ApiAuthParams() { AccessToken = MyAppToken });

        var s = api.Groups.GetLongPollServer(MyGroupId);            

        while(true)
        {
            BotsLongPollHistoryResponse poll = api.Groups.GetBotsLongPollHistory(
                                  new BotsLongPollHistoryParams()
                                  { Server = s.Server, Ts = s.Ts, Key = s.Key, Wait = 20 });

            if (poll?.Updates == null) continue;

            foreach (var a in poll.Updates)
            {
                if (a.Type == GroupUpdateType.MessageNew)
                {
                    Console.WriteLine(a.Message.Body);
                    api.Messages.Send(new MessagesSendParams()
                    {
                        UserId = a.Message.UserId,
                        Message = a.Message.Body,
                        RandomId = new Random().Next(),
                    });
                }
            }
        }
    }

Ответы (1 шт):

Автор решения: Иван Недзвецкий

Вы забыли обновлять s.Ts без этого у вас бот не "движется" вперед

Надо добавить

s.Ts = poll?.Ts;

перед

if (poll?.Updates == null) continue;

→ Ссылка