L
L
lolik202021-03-29 02:25:43
ASP.NET
lolik20, 2021-03-29 02:25:43

Why is the bot not working correctly?

The bot replies to the same message, does not move further

using WebApplication3.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Web.Http;
using System.Web.Http.Results;
using Telegram.Bot.Types;
using System.Web.Mvc;

namespace WebApplication3.Controllers
{

    public class TelegramController : ApiController
    {

        [System.Web.Http.Route(@"api/telegram/update")]

        public async Task<OkResult> Update([FromBody] Update update)
        {
            var commands = Bot.commands;
            var message = update.Message;
            var client = await Bot.Get();
            foreach (var command in commands)
            {
                if (command.Contains(message.Text))
                {
                    command.Execute(message, client);
                    
                }
             
            }
            return Ok();
        }
    }
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question