private void SendResponse(HashSet <long> receivers, KidsNoteNotification notification) { bool imagesAsAttachment = SendImagesAsAttachment(); foreach (var eachContent in notification.Contents) { // 본문 발송. string text = eachContent.FormatContent(); List <Task <Message> > taskList = new List <Task <Message> >(); foreach (var user in receivers) { if (user != 0) { taskList.Add(TheClient.SendTextMessageAsync(user, text)); } } // 메시지 순서가 섞이지 않도록 모두 보내질 때까지 대기. foreach (var task in taskList) { try { task.Wait(); } catch (Exception) { } } //Dictionary<long, LinkedList<InputMediaPhoto>> photoAlbumPerUser = new Dictionary<long, LinkedList<InputMediaPhoto>>(); bool hasAttachment = eachContent.Attachments != null && eachContent.Attachments.Count > 0; if (hasAttachment) { if (imagesAsAttachment) { SendImageAttachments(receivers, eachContent); } else { SendImageLinks(receivers, eachContent); } SendVideoLinks(receivers, eachContent); } } AllNotificationsSent(notification); }
public ResponseMessage(HashSet <long> chatIds, KidsNoteNotification notification) { Type = MessageType.KIDS_NOTE_MESSAGE; ChatIds = chatIds; Notification = notification; }