예제 #1
0
        public Response Execute(TelegramUser user, List <string> args, UpdateModel update)
        {
            var keyboard = new InlineKeyboardMarkup();

            keyboard.AddButton("Test", "/heas");

            return(new Response()
            {
                KeyboardMarkup = keyboard,
                Text = "Hello world"
            });
        }
예제 #2
0
        public async Task <InlineKeyboardMarkup> CategoriesMenu(
            string languageCode, int categoryId = 0) =>
        await Task.Run(async() => {
            var categories           = await _dataRepository.GetCategories(categoryId, languageCode);
            var lineButtons          = new List <InlineKeyboardButton>();
            var inlineKeyboardMarkup = new InlineKeyboardMarkup();

            int num = 0;
            foreach (var category in categories.Select(c => new { c.Name, c.Id }))
            {
                inlineKeyboardMarkup.AddButton(
                    new InlineKeyboardButton(category.Name, null, @"/cat" + category.Id.ToString()),
                    num++ / 2
                    );
            }
            //inlineKeyboardMarkup.AddLineButtons(await GetMainButtons());
            return(inlineKeyboardMarkup);
        });
예제 #3
0
        public async Task <InlineKeyboardMarkup> ProductsInlineKeybaord(
            int categoryId, string languageCode) =>
        await Task.Run(async() => {
            var products = (await _dataRepository.GetProducts(categoryId, languageCode))
                           .Select(p => new { p.Id, p.Name, p.Price }).ToList();
            var lineButtons          = new List <InlineKeyboardButton>();
            var inlineKeyboardMarkup = new InlineKeyboardMarkup();

            int num = 0;
            foreach (var product in products)
            {
                inlineKeyboardMarkup.AddButton(
                    new InlineKeyboardButton(product.Name, null, @"/product" + product.Id.ToString()),
                    num++ / 2
                    );
            }
            //inlineKeyboardMarkup.AddLineButtons(await GetMainButtons());
            return(inlineKeyboardMarkup);
        });