Exemplo n.º 1
0
        private static void AJula_OnMessage(object sender, Telegram.Bot.Args.MessageEventArgs e)
        {
            Console.WriteLine($"От {e.Message.Chat.Id}:{e.Message.Text}");
            ICommand command;

            switch (e.Message.Text.ToLower())
            {
            case null: return;

            case "привет":
                command = new HelloCommand();
                command.Execute(e.Message);
                break;

            case "время":
                command = new TimeCommand();
                command.Execute(e.Message);
                break;

            case "погода":
                command = new WeatherCommand();
                command.Execute(e.Message);
                break;

            case "курс":
                command = new CurrencyCommand();
                command.Execute(e.Message);
                break;

            case "создание напоминания":
                Bot.Flag = true;
                break;

            case "газета":
                command = new NewsCommand();
                command.Execute(e.Message);
                break;

            case "почта":
                command = new EmailCommand(e.Message.Chat.Id);
                command.Execute(e.Message);
                break;

            default:
                Bot.AssistantJula.SendTextMessageAsync
                (
                    chatId: e.Message.Chat,
                    text: "Я вас не поняла",
                    replyMarkup: KeyboardTemplates.mainKeyboard
                ).ConfigureAwait(false);
                break;
            }
            if (Bot.Flag)
            {
                command = new ReminderCommand();
                command.Execute(e.Message);
            }
        }