What tools are needed to create Telegram-Bot with Asp.net and C #?

I created a robot with a console, now I want the robot on the host server to always be active, so I need to change the robot to ASP.net. I tried many teams, but could not.

I ask what tools are needed to build Telegram-Bot with Asp.net and C #?

C # 2013 update3

Summary Code:

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NetTelegramBotApi;
using NetTelegramBotApi.Requests;
using NetTelegramBotApi.Types;
using System.Net.Http;
using System.Runtime.Remoting.Channels;
using System.Data;
using System.Data.SqlClient;

namespace TestMyCam_bot
{


    class Program
    {
        private static string Token = "";
        private static ReplyKeyboardMarkup mainmenu;


        int i, j;
        int Counter = 0;



        bool success = false;
        bool bool_EndHtml = false;
        bool yek_Bar_Downloaded = false;


        Exception Ex;

        static void Main(string[] args)
        {

            mainmenu = new ReplyKeyboardMarkup 
            {

                Keyboard = new[] { new[] { "Sony" }, new[] { "Apple" }, new[] { "Nokia"} } 


            };

            Task.Run(() => RunBot());
            Console.ReadLine();
        }


        public static async Task RunBot()
        {





            var bot = new TelegramBot(Token);
            var me = await bot.MakeRequestAsync(new GetMe());
            Console.WriteLine("User Name is {0}", me.Username);
            long offset = 0;
            int whilecount = 0;
            while (true)
            {

                Console.WriteLine("while is {0}", whilecount);
                whilecount += 1;
                var updates = await bot.MakeRequestAsync(new GetUpdates() { Offset = offset });
                Console.WriteLine("Update Count is {0} ", updates.Count());
                Console.WriteLine("-------------------------------------");
                try
                {
                    foreach (var update in updates)
                    {

                        offset = update.UpdateId + 1;
                        var text = update.Message.Text;
                        if (text == "/start")
                        {
                            var req = new SendMessage(update.Message.Chat.Id, "Select Button") { ReplyMarkup = mainmenu};

                            await bot.MakeRequestAsync(req);
                            continue;

                        }



                }
                catch (Exception ex)
                {
                    throw;
                }

            }
        }
    }
}

If my questions are not clear, I apologize. I need to tell me, for example: vs 2015, webhook, ssl, etc. Or a simple code for my sample code above.thanks

+4
source share

Source: https://habr.com/ru/post/1664773/


All Articles