Пример #1
0
        public Task <bool> AskMagnitudeAsync(int chatId)
        {
            var replyMarkup = new TelegramInlineKeyboardMarkup
            {
                InlineKeyboard = new List <IEnumerable <TelegramInlineKeyboardButton> > {
                    new List <TelegramInlineKeyboardButton>
                    {
                        new TelegramInlineKeyboardButton {
                            Text = "Hepsi", CallBackData = "0"
                        },
                        new TelegramInlineKeyboardButton {
                            Text = "3.0+", CallBackData = "3"
                        },
                        new TelegramInlineKeyboardButton {
                            Text = "4.0+", CallBackData = "4"
                        },
                        new TelegramInlineKeyboardButton {
                            Text = "5.0+", CallBackData = "5"
                        },
                        new TelegramInlineKeyboardButton {
                            Text = "6.0+", CallBackData = "6"
                        }
                    }
                }
            };


            var message = new TelegramMessage
            {
                ChatId      = chatId.ToString(),
                Text        = BotDialog.ASK_MAGNITUDE,
                ReplyMarkup = JsonConvert.SerializeObject(replyMarkup)
            };

            return(_telegramService.SendMessage(message));
        }
Пример #2
0
        public async Task <bool> AskScaleAsync(int chatId, Location location)
        {
            if (location.Longitude > 45 || location.Longitude < 25.5 ||
                location.Latitude > 42.5 || location.Latitude < 36)
            {
                return(await _telegramService.SendMessage(new TelegramMessage
                {
                    ChatId = chatId.ToString(),
                    Text = "Koordinatlar sınır dışında kalıyor."
                }));
            }

            var response = await _amazonDynamoDbService.UpdateAsync(chatId, location.Latitude, location.Longitude);

            if (!response)
            {
                return(await _telegramService.SendMessage(new TelegramMessage
                {
                    ChatId = chatId.ToString(),
                    Text = "Bir hata oluştu."
                }));
            }

            var replyMarkup = new TelegramInlineKeyboardMarkup
            {
                InlineKeyboard = new List <IEnumerable <TelegramInlineKeyboardButton> > {
                    new List <TelegramInlineKeyboardButton>
                    {
                        new TelegramInlineKeyboardButton {
                            Text = "250", CallBackData = "250"
                        },
                        new TelegramInlineKeyboardButton {
                            Text = "100", CallBackData = "100"
                        },
                        new TelegramInlineKeyboardButton {
                            Text = "50", CallBackData = "50"
                        },
                        new TelegramInlineKeyboardButton {
                            Text = "25", CallBackData = "25"
                        },
                        new TelegramInlineKeyboardButton {
                            Text = "10", CallBackData = "10"
                        },
                        new TelegramInlineKeyboardButton {
                            Text = "5", CallBackData = "5"
                        },
                        new TelegramInlineKeyboardButton {
                            Text = "2", CallBackData = "2"
                        },
                        new TelegramInlineKeyboardButton {
                            Text = "1", CallBackData = "1"
                        }
                    }
                }
            };

            var message = new TelegramMessage
            {
                ChatId      = chatId.ToString(),
                Text        = "Pafta ölçeğini seçiniz (1:___.000):",
                ReplyMarkup = JsonConvert.SerializeObject(replyMarkup)
            };

            return(await _telegramService.SendMessage(message));
        }