Answer the question
In order to leave comments, you need to log in
Telegram bot OnMessage - doesn't remember input?
static void Main(string[] args)
{
botClient = new TelegramBotClient("token");
var BotInformation = botClient.GetMeAsync().Result;
botClient.StartReceiving();
botClient.OnMessage += BotClient_OnMessage;
Console.ReadLine();
//botClient.StopReceiving();
CountKey = 0;
}
private async static void BotClient_OnMessage(object sender, Telegram.Bot.Args.MessageEventArgs e)
{
Program. args = e;
switch (e.Message.Text)
{
case "/generate":
My_messege = e.Message;
Find_Path();
break;
case "/draw":
My_messege = e.Message;
StartGame();
break;
default:
My_messege = e.Message;
break;
}
if (wariant == "/left" && (LastID == 1 || LastID == 3 || LastID == 4))
{
s = "/left";
s2 = "/right";
await botClient.SendPhotoAsync(My_messege.Chat.Id, dd);// два пути - лево - право
goto check;
}
if (wariant == "/right" && LastID == 1 || LastID == 3 || LastID == 4)
{
s = "/right";
s2 = "/left";
await botClient.SendPhotoAsync(My_messege.Chat.Id, dd);// два пути - лево - право
}
if (C == 0)
{
await botClient.SendPhotoAsync(My_messege.Chat.Id, dd);
await botClient.SendTextMessageAsync(My_messege.Chat.Id, s + " " + s2);
wariant = args.Message.Text;
C++;
//вызвать BotClient_OnMessage
Program.BotClient_OnMessage(botClient, args);
return;
}
switch (e.Message.Text)
- the old value remains.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question