private static void Main() { mClient = GetBot(); mClient.UpdatesReceived += ClientUpdatesReceived; mClient.GetUpdatesError += ClientGetUpdatesError; mClient.StartCheckingUpdates(); ConsoleUtlis.WriteConsoleLog("Example bot start. For exit press any key"); Console.ReadKey(); }
private static void Main() { AllowedUpdates[] allowedUpdateses = { AllowedUpdates.Message, AllowedUpdates.CallbackQuery }; mClient = GetBot(); mClient.UpdatesReceived += ClientUpdatesReceived; mClient.GetUpdatesError += ClientGetUpdatesError; mClient.StartCheckingUpdates(allowedUpdateses: allowedUpdateses); ConsoleUtlis.WriteConsoleLog("Example bot start. For exit press any key"); Console.ReadKey(); }
private static void ClientUpdatesReceived(object sender, TelegramUpdateEventArgs e) { foreach (var update in e.Updates) { if (update.CallbackQuery.Id != null) { ConsoleUtlis.WriteConsoleLog("New CallbackQuery"); ParseCommandInCallbackQuery(update.CallbackQuery); } if (update.Message.MessageId != 0) { ConsoleUtlis.WriteConsoleLog("New MessageInfo"); if (update.Message.Text.StartsWith("/")) { ParseCommandInMessageInfo(update.Message); } } } }