/// <summary> /// Editing the embedded message /// </summary> /// <param name="builder">Builder</param> /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns> public override async Task EditMessage(DiscordEmbedBuilder builder) { builder.WithTitle(LocalizationGroup.GetText("CommitTitle", "Participants")); builder.WithDescription(LocalizationGroup.GetText("CommitText", "The following participants are recorded:")); builder.WithColor(DiscordColor.Green); builder.WithFooter("Scruffy", "https://cdn.discordapp.com/app-icons/838381119585648650/823930922cbe1e5a9fa8552ed4b2a392.png?size=64"); builder.WithTimestamp(DateTime.Now); var message = new StringBuilder(); if (_data.Participants == null) { _data.Participants = new List <CalendarAppointmentParticipantData>(); using (var dbFactory = RepositoryFactory.CreateInstance()) { foreach (var entry in dbFactory.GetRepository <CalendarAppointmentParticipantRepository>() .GetQuery() .Where(obj => obj.AppointmentId == _data.AppointmentId) .Select(obj => new { UserId = obj.User .DiscordAccounts .Select(obj2 => obj2.Id) .FirstOrDefault(), obj.IsLeader })) { _data.Participants.Add(new CalendarAppointmentParticipantData { Member = await CommandContext.Guild .GetMemberAsync(entry.UserId) .ConfigureAwait(false), IsLeader = entry.IsLeader }); } } } foreach (var entry in _data.Participants .OrderBy(obj => obj.Member.TryGetDisplayName())) { message.Append($"> {entry.Member.Mention}"); if (entry.IsLeader) { message.Append(' '); message.Append(DiscordEmojiService.GetStarEmoji(CommandContext.Client)); } message.Append('\n'); } message.AppendLine("\u200b"); builder.AddField($"{LocalizationGroup.GetText("Participants", "Participants")} ({_data.Participants.Count})", message.ToString()); }