protected override async Task <Message> SendResponseAsync(ICurrentTelegramUserClient client, InlineKeyboardButton[] response) { var(product, hookahs, tobaccos) = await TranslationsResolver.ResolveAsync( (TelegramTranslationKeys.ChooseProduct, Array.Empty <object>()), (TelegramTranslationKeys.Hookahs, Array.Empty <object>()), (TelegramTranslationKeys.Tobaccos, Array.Empty <object>()) ); return(await client .SendTextMessageAsync(product, replyMarkup : new InlineKeyboardMarkup(new[] { new[] { new InlineKeyboardButton { Text = hookahs, CallbackData = $"/{nameof(GetHookahsCommand).ExtractCommandName()}" }, new InlineKeyboardButton { Text = tobaccos, CallbackData = $"/{nameof(GetTobaccosCommand).ExtractCommandName()}" } }, response } .ToArray()))); }
protected override async Task <Message> SendResponseAsync(ICurrentTelegramUserClient client, Tobacco[] response) => await client .SendTextMessageAsync(response.Any() ?response .AggregateListString("/{0} {1} - {2}", x => x.Name, x => x.Price) : await TranslationsResolver.ResolveAsync(TelegramTranslationKeys.NoTobaccos));
protected override async Task <Message> SendResponseAsync(ICurrentTelegramUserClient client) => await client .SendTextMessageAsync(await TranslationsResolver.ResolveAsync(TelegramTranslationKeys.Welcome), replyMarkup : new ReplyKeyboardMarkup { OneTimeKeyboard = true, ResizeKeyboard = true, Keyboard = Array.Empty <IEnumerable <KeyboardButton> >() });
protected override async Task <Message> SendResponseAsync(ICurrentTelegramUserClient client, Order response) { var buttons = new List <IEnumerable <InlineKeyboardButton> >(); var firstLayerButtons = new List <InlineKeyboardButton>(); var builder = new StringBuilder(); if (response.OrderedHookahs.Any() || response.OrderedTobaccos.Any()) { builder.Append(StringifyResponse(response)); if (response.State == OrderStates.Constructing) { firstLayerButtons.Add(new InlineKeyboardButton { Text = await TranslationsResolver.ResolveAsync(TelegramTranslationKeys.Confirm), CallbackData = $"/{nameof(ConfirmOrderCommand).ExtractCommandName()} {response.Id}" }); } } else { builder.Append("seems like there is no any data in order"); } builder.Append($"\n\nStatus: *{response.State}*"); if (response.State == OrderStates.Constructing) { firstLayerButtons.Add(new InlineKeyboardButton { Text = await TranslationsResolver.ResolveAsync(TelegramTranslationKeys.Delete), CallbackData = $"/{nameof(DeleteOrderCommand).ExtractCommandName()} {response.Id}" }); } buttons.Add(firstLayerButtons); if (UserContextProvider.DatabaseUser.State > TelegramUserStates.Default) { buttons.Add(await GetServiceButtonsAsync(response)); } return(await client .SendTextMessageAsync(builder.ToString(), ParseMode.MarkdownV2, replyMarkup : new InlineKeyboardMarkup(buttons))); }
protected override async Task<Message> SendResponseAsync(ICurrentTelegramUserClient client, Identified<Tobacco> response) { var (content, keyboard) = await ( TranslationsResolver.ResolveAsync(TelegramTranslationKeys.GetTobaccoResult, response.Entity.Name, response.Entity.Price), PrepareKeyboardAsync(response) ).CombineAsync(); if (response.Entity.Photos.Any()) { await client.SendMediaGroupAsync( response.Entity.Photos .Select(x => new InputMediaPhoto(new InputMedia(x.TelegramFileId))) ); } return await client .SendTextMessageAsync( content, replyMarkup: keyboard); }
protected override async Task <Message> SendResponseAsync(ICurrentTelegramUserClient client, Order response) => await client .SendTextMessageAsync(await TranslationsResolver.ResolveAsync(TelegramTranslationKeys.OrderHasBeenFinished, response.Id));
protected override Task <Message> SendResponseAsync(ICurrentTelegramUserClient client) => client .SendTextMessageAsync(() => TranslationsResolver.ResolveAsync(TelegramTranslationKeys.HookahRemoveSuccess));
protected override async Task <Message> SendResponseAsync(ICurrentTelegramUserClient client, Order response) => await client.SendTextMessageAsync( await TranslationsResolver.ResolveAsync(TelegramTranslationKeys.ConfirmOrderSuccess, response.Id));
protected override async Task <Message> SendResponseAsync(ICurrentTelegramUserClient client) => await client.SendTextMessageAsync( await TranslationsResolver .ResolveAsync(TelegramTranslationKeys.AddPhotoSuccess) );
protected override async Task <Message> SendResponseAsync(ICurrentTelegramUserClient client) => await client .SendTextMessageAsync(await TranslationsResolver.ResolveAsync(TelegramTranslationKeys.DeleteCommandSuccess, typeof(TEntity).Name));
protected override async Task <Message> SendResponseAsync(ICurrentTelegramUserClient client) => await client .SendTextMessageAsync( await TranslationsResolver.ResolveAsync(TelegramTranslationKeys.UserStateRegistrationSuccess, StateToSet.ToString().ToLower()) );