diff --git a/VQCalendarAttention/Services/NextDayCalendarAttentionService.cs b/VQCalendarAttention/Services/NextDayCalendarAttentionService.cs index b26bf08..3a62648 100644 --- a/VQCalendarAttention/Services/NextDayCalendarAttentionService.cs +++ b/VQCalendarAttention/Services/NextDayCalendarAttentionService.cs @@ -60,7 +60,13 @@ DateTime startOfTomorrow = jst.Date.AddDays(1); DateTime endOfTomorrow = startOfTomorrow.AddDays(1); - var tomorrowEvents = events.Items.Where(e => e.Start.DateTime >= startOfTomorrow && e.Start.DateTime < endOfTomorrow).ToList(); + var tomorrowEvents = events.Items.Where( + e => (e.Start.DateTime.HasValue && + e.Start.DateTime >= startOfTomorrow && e.Start.DateTime < endOfTomorrow) || + (e.Start.Date != null && + DateTime.Parse(e.Start.Date).Date == startOfTomorrow.Date + ) + ).ToList(); // 明日の予定を表示 if (tomorrowEvents.Count > 0) { @@ -81,7 +87,8 @@ { importanceMention = $" <@&{roleId}>"; } - sb.AppendLine($"{tomorrowEvent.Summary}: {tomorrowEvent.Start.DateTime}{importanceMention}"); + string startTime = tomorrowEvent.Start.DateTime?.ToString("yyyy-MM-dd HH:mm:ss") ?? DateTime.Parse(tomorrowEvent.Start.Date).ToString("yyyy-MM-dd"); + sb.AppendLine($"{tomorrowEvent.Summary}: {startTime}{importanceMention}"); } // メッセージをDiscordに送信