1
1
1Ting12020-06-20 15:32:12
C++ / C#
1Ting1, 2020-06-20 15:32:12

Telegram bot not responding to messages. Nothing is output to the console. How to fix this problem?

using Telegram.Bot;

namespace TelegramBot
{
    class Program
    {
        static TelegramBotClient Bot;
        static void Main(string[] args)
        {
            Bot = new TelegramBotClient("...");

            Bot.OnMessage += Bot_OnMessage;

            var me = Bot.GetMeAsync().Result;

            Console.WriteLine(me.FirstName);

            Bot.StartReceiving();
            Console.ReadLine();
            Bot.StopReceiving();
        }

        private static void Bot_OnMessage(object sender, Telegram.Bot.Args.MessageEventArgs e)
        {
            var massege = e.Message;

            Console.WriteLine(massege.Text);
        }
    }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
Timur Pokrovsky, 2020-06-20
@Makaroshka007

Is it hard to google?
https://stackoverflow.com/questions/44847614/onmes...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question