Beispiel #1
0
        public async Task <MessageResponse> SendMessageAsync([FromBody] SendMessageRequest request)
        {
            try
            {
                var groups = request.Groups.Select(group => _notifier.PostMessageAsync(request.Message, group, request.ImageUrls));
                await Task.WhenAll(groups);

                return(MessageResponse.CreateValidMessage());
            }
            catch (Exception ex)
            {
                return(MessageResponse.CreateInvalidMessage($"Group list:{string.Join("|", request.Groups)}, Message:{request.Message}, Exception:{ex}"));
            }
        }