Skip to content

Commit

Permalink
Update GuildEventScheduleService.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
Twinki14 committed Nov 18, 2023
1 parent 20bcace commit c0b8797
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/Miha.Discord/Services/Hosted/GuildEventScheduleService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
using Miha.Discord.Services.Interfaces;
using Miha.Logic.Services.Interfaces;
using Miha.Shared.ZonedClocks.Interfaces;
using NodaTime;
using NodaTime.Extensions;

namespace Miha.Discord.Services.Hosted;
Expand Down Expand Up @@ -164,10 +163,14 @@ private async Task PostWeeklyScheduleAsync()
.WithAuthor("Weekly event schedule", _client.CurrentUser.GetAvatarUrl());
postedHeader = true;
}

var dayUnspecified = day.ToDateTimeOffset();
var dayInEst = day.ToLocalDateTime().Date.AtStartOfDayInZone(_easternStandardZonedClock.GetTzdbTimeZone()).Date.ToString("dddd", new CultureInfo("en-us"));
description.AppendLine("### " + dayInEst + " - " + dayUnspecified.ToDiscordTimestamp(TimestampTagStyles.ShortDate));

var dayInEst = day
.ToLocalDateTime()
.InZoneLeniently(_easternStandardZonedClock.GetTzdbTimeZone())
.Date
.ToString("dddd", new CultureInfo("en-us"));

description.AppendLine("### " + dayInEst + " - " + day.ToDateTimeOffset().ToDiscordTimestamp(TimestampTagStyles.ShortDate));

foreach (var guildEvent in events.OrderBy(e => e.StartTime))
{
Expand Down Expand Up @@ -210,7 +213,7 @@ private async Task PostWeeklyScheduleAsync()
.WithColor(new Color(255, 43, 241))
.WithDescription(description.ToString());

await weeklyScheduleChannel.SendMessageAsync(embed: embed.Build(), flags: MessageFlags.SuppressNotification);
await weeklyScheduleChannel.SendMessageAsync(embed: embed.Build());

_logger.LogInformation("Finished posting weekly schedule");
}
Expand Down

0 comments on commit c0b8797

Please sign in to comment.