Esempio n. 1
0
        public Task SendAsync(MessageInfo message)
        {
            if (message.Media.Any(media => media is Audio))
            {
                return(_audioSender.SendAsync(
                           message,
                           (Audio)message.Media.FirstOrDefault(media => media is Audio)));
            }

            return(message.Media.Count() switch
            {
                0 => _textSender.SendAsync(message),
                _ => _mediaSender.SendAsync(message)
            });
Esempio n. 2
0
        private async Task SendMediaAlbumWithAdditionalTextMessage(MessageInfo message, IEnumerable <IAlbumInputMedia> telegramMedia)
        {
            _logger.LogInformation("Sending media album with additional text message");

            var firstMediaMessageId = 0;

            if (message.Media.Any())
            {
                firstMediaMessageId = await SendMediaAlbumIfAny(message, telegramMedia);
            }

            if (message.Message.Any())
            {
                MessageInfo newMessage = message with {
                    ReplyMessageId = firstMediaMessageId
                };

                await _textSender.SendAsync(newMessage);
            }
        }