public override async void Execute(Message message, TelegramBotClient client)
        {
            var chatId = message.Chat.Id;

            AppSettings.isTranslaterMode = true;
            var textToSend = "Now I will translate everything that you will write to me" +
                             Smilic.GetStringByName("подмигивание");
            await client.SendTextMessageAsync(chatId, textToSend);
        }
        public override async void Execute(Message message, TelegramBotClient client)
        {
            var chatId     = message.Chat.Id;
            var messageId  = message.MessageId;
            var textToSend = isFirstTime ? "Hello " + message.From.FirstName + " My Name is "
                             + getName(client) + " I'm an English text translator" + Smilic.GetStringByName("румянец")
                : "Hello again buddy" + Smilic.GetStringByName("улыбка");
            await client.SendTextMessageAsync(chatId, textToSend, replyToMessageId : messageId);

            isFirstTime = false;
        }
        public override async void Execute(Message message, TelegramBotClient client)
        {
            var chatId    = message.Chat.Id;
            var messageId = message.MessageId;

            if (message.Text.Contains(Names[0]))
            {
                string angelSmilic = Smilic.GetStringByName("ангел");
                string text        = angelSmilic + "Введи /NYчисло или /Mчисло \r\n"
                                     + "для того чтобы слушать песню Новогоднюю или Обычную";
                await client.SendTextMessageAsync(chatId, text);
            }
            else
            {
                string dirPath = Directory.GetCurrentDirectory();
                string numStr  = "";
                if (message.Text.StartsWith(Names[1]))
                {
                    dirPath = dirPath.Replace("bin\\Debug", "music\\НГ");
                    numStr  = message.Text.Replace("/NY", "");
                }
                else if (message.Text.StartsWith(Names[2]))
                {
                    dirPath = dirPath.Replace("bin\\Debug", "music");
                    numStr  = message.Text.Replace("/M", "");
                }

                string[] fileNames = Directory.GetFiles(dirPath);

                int num;
                if (!int.TryParse(numStr, out num))
                {
                    await client.SendTextMessageAsync(chatId, Smilic.GetStringByName("ошибка")
                                                      + "число неккоректное((", replyToMessageId : messageId);
                }
                else
                {
                    num--;
                    if (num >= 0 && num < fileNames.Length)
                    {
                        await SendMusic(chatId.ToString(), fileNames[num], AppSettings.Key);
                    }
                    else
                    {
                        await client.SendTextMessageAsync(chatId, Smilic.GetStringByName("ошибка")
                                                          + "столько песен нет", replyToMessageId : messageId);
                    }
                }
            }
        }
        public override async void Execute(Message message, TelegramBotClient client)
        {
            var    chatId = message.Chat.Id;
            string send   = "";

            if (message.Text.Contains(Names[0]))
            {
                send = "translation from English to Russian"
                       + Smilic.GetStringByName("стрелка вправо") + "🇷🇺";
                AppSettings.IsRuEn = false;
            }
            else if (message.Text.Contains(Names[1]))
            {
                send = "translation from Russian to English"
                       + Smilic.GetStringByName("стрелка влево") + "🇷🇺";
                AppSettings.IsRuEn = true;
            }
            await client.SendTextMessageAsync(chatId, send);
        }
        public override async void Execute(Message message, TelegramBotClient client)
        {
            var    chatId    = message.Chat.Id;
            var    messageId = message.MessageId;
            string dirPath   = Directory.GetCurrentDirectory();

            dirPath = dirPath.Replace("bin\\Debug", "foto");
            string[] fileNames = Directory.GetFiles(dirPath);
            if (message.Text.Contains(Names[0]))
            {
                if (curFotoNum == fileNames.Length - 1)
                {
                    await client.SendTextMessageAsync(chatId, "фото закончились, вперед не могу"
                                                      + Smilic.GetStringByName("ошибка"),
                                                      replyToMessageId : messageId);
                }
                else
                {
                    curFotoNum++;
                    await SendPhoto(chatId.ToString(), fileNames[curFotoNum], AppSettings.Key);
                }
            }
            else
            if (message.Text.Contains(Names[1]))
            {
                if (curFotoNum == 0)
                {
                    await client.SendTextMessageAsync(chatId, "назад не могу, только вперед"
                                                      + Smilic.GetStringByName("ошибка"),
                                                      replyToMessageId : messageId);
                }
                else
                {
                    curFotoNum--;
                    await SendPhoto(chatId.ToString(), fileNames[curFotoNum], AppSettings.Key);
                }
            }
        }
Ejemplo n.º 6
0
        public override async void Execute(Message message, TelegramBotClient client)
        {
            var    chatId     = message.Chat.Id;
            string textToSend = "";

            if (AppSettings.isTranslaterMode)
            {
                textToSend = AppSettings.TranslateCount == 0 ? "You don't really need help:)"
                    : "I hope I was useful to you"
                             + Smilic.GetStringByName("приятное смущение");
                if (AppSettings.TranslateCount >= 5)
                {
                    textToSend = "huh,  to be honest I'm already tired of translating"
                                 + Smilic.GetStringByName("обида");
                }
                AppSettings.TranslateCount   = 0;
                AppSettings.isTranslaterMode = false;
            }
            else
            {
                textToSend = "We even don't start" + Smilic.GetStringByName("смех");
            }
            await client.SendTextMessageAsync(chatId, textToSend);
        }