Example #1
0
        public InlineKeyboardMarkup GetMarkup()
        {
            var rows   = (int)Math.Ceiling((double)buttons.Count / BUTTONS_IN_ROW);
            var board  = new List <InlineKeyboardButton> [rows];
            var markup = new InlineKeyboardMarkup(board);

            for (int i = 0; i < rows; i++)
            {
                var button = new InlineKeyboardButton[BUTTONS_IN_ROW < buttons.Count ? BUTTONS_IN_ROW : buttons.Count];

                for (int j = 0; j < button.Length; j++)
                {
                    button[j] = InlineKeyboardButton.WithCallbackData(buttons.Dequeue());
                }
                board[i] = button.ToList();
            }
            return(markup);
        }