Esempio n. 1
0
        /// <inheritdoc />
        public async Task SendRichMediaMessageAsync(int botId, string receiverId, OutMessage message)
        {
            //
            var buttons = message.Buttons.Select(button => {
                var keyboardButton = new KeyboardButton
                {
                    Text       = button.Title,
                    ActionBody = button.Id.ToString(),
                    Columns    = button.Columns,
                    Rows       = button.Rows
                };

                if (button.Style != null)
                {
                    keyboardButton.BackgroundColor     = button.Style.BackgroundColor;
                    keyboardButton.TextHorizontalAlign = button.Style.TextHorizontalAlign.ToTextHorizontalAlign();
                    keyboardButton.TextVerticalAlign   = button.Style.TextVerticalAlign.ToTextVerticalAlign();
                    keyboardButton.TextSize            = button.Style.TextSize.ToTextSize();
                }

                return(keyboardButton);
            });

            //
            var carouselMessage = new CarouselMessage
            {
                Receiver        = receiverId,
                MinApiVersion   = 4,
                CarouselContent = new Carousel
                {
                    AlternateText       = message.Text,
                    ButtonsGroupColumns = 6,
                    ButtonsGroupRows    = 6,
                    Buttons             = buttons.ToList()
                }
            };

            await viberBotClient.SendCarouselMessageAsync(carouselMessage);
        }
Esempio n. 2
0
 /// <inheritdoc />
 public Task <long> SendCarouselMessageAsync(CarouselMessage message) => SendMessageAsync(message);