Skip to content

Commit

Permalink
fix: add real DTO
Browse files Browse the repository at this point in the history
  • Loading branch information
Lulalaby committed Apr 19, 2024
1 parent aefc165 commit 0c30901
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions DisCatSharp/Entities/Message/Polls/DiscordPoll.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,17 @@ public sealed class DiscordPoll : ObservableApiObject
public List<DiscordPollAnswer> Answers { get; internal set; }

/// <summary>
/// Gets the poll duration in hours.
/// Gets the poll's end time as raw string.
/// </summary>
[JsonProperty("expiry", NullValueHandling = NullValueHandling.Ignore)]
public int? Expiry { get; internal set; } = null;
internal string? ExpiryRaw { get; set; } = null;

/// <summary>
/// Gets the poll's end time.
/// </summary>
[JsonIgnore]
public DateTimeOffset? Expiry
=> !string.IsNullOrWhiteSpace(this.ExpiryRaw) && DateTimeOffset.TryParse(this.ExpiryRaw, CultureInfo.InvariantCulture, DateTimeStyles.None, out var dto) ? dto : null;

Check failure on line 40 in DisCatSharp/Entities/Message/Polls/DiscordPoll.cs

View workflow job for this annotation

GitHub Actions / Build library and release internally

The name 'CultureInfo' does not exist in the current context

Check failure on line 40 in DisCatSharp/Entities/Message/Polls/DiscordPoll.cs

View workflow job for this annotation

GitHub Actions / Build library and release internally

The name 'DateTimeStyles' does not exist in the current context

Check failure on line 40 in DisCatSharp/Entities/Message/Polls/DiscordPoll.cs

View workflow job for this annotation

GitHub Actions / Build library and release internally

The name 'CultureInfo' does not exist in the current context

Check failure on line 40 in DisCatSharp/Entities/Message/Polls/DiscordPoll.cs

View workflow job for this annotation

GitHub Actions / Build library and release internally

The name 'DateTimeStyles' does not exist in the current context

Check failure on line 40 in DisCatSharp/Entities/Message/Polls/DiscordPoll.cs

View workflow job for this annotation

GitHub Actions / Build library and release internally

The name 'CultureInfo' does not exist in the current context

Check failure on line 40 in DisCatSharp/Entities/Message/Polls/DiscordPoll.cs

View workflow job for this annotation

GitHub Actions / Build library and release internally

The name 'DateTimeStyles' does not exist in the current context

Check failure on line 40 in DisCatSharp/Entities/Message/Polls/DiscordPoll.cs

View workflow job for this annotation

GitHub Actions / Build library and release internally

The name 'CultureInfo' does not exist in the current context

Check failure on line 40 in DisCatSharp/Entities/Message/Polls/DiscordPoll.cs

View workflow job for this annotation

GitHub Actions / Build library and release internally

The name 'DateTimeStyles' does not exist in the current context

Check failure on line 40 in DisCatSharp/Entities/Message/Polls/DiscordPoll.cs

View workflow job for this annotation

GitHub Actions / Build library (ubuntu-latest)

The name 'CultureInfo' does not exist in the current context

Check failure on line 40 in DisCatSharp/Entities/Message/Polls/DiscordPoll.cs

View workflow job for this annotation

GitHub Actions / Build library (ubuntu-latest)

The name 'DateTimeStyles' does not exist in the current context

Check failure on line 40 in DisCatSharp/Entities/Message/Polls/DiscordPoll.cs

View workflow job for this annotation

GitHub Actions / Build library (ubuntu-latest)

The name 'CultureInfo' does not exist in the current context

Check failure on line 40 in DisCatSharp/Entities/Message/Polls/DiscordPoll.cs

View workflow job for this annotation

GitHub Actions / Build library (ubuntu-latest)

The name 'DateTimeStyles' does not exist in the current context

Check failure on line 40 in DisCatSharp/Entities/Message/Polls/DiscordPoll.cs

View workflow job for this annotation

GitHub Actions / Build library (ubuntu-latest)

The name 'CultureInfo' does not exist in the current context

Check failure on line 40 in DisCatSharp/Entities/Message/Polls/DiscordPoll.cs

View workflow job for this annotation

GitHub Actions / Build library (ubuntu-latest)

The name 'DateTimeStyles' does not exist in the current context

Check failure on line 40 in DisCatSharp/Entities/Message/Polls/DiscordPoll.cs

View workflow job for this annotation

GitHub Actions / Build library (ubuntu-latest)

The name 'CultureInfo' does not exist in the current context

Check failure on line 40 in DisCatSharp/Entities/Message/Polls/DiscordPoll.cs

View workflow job for this annotation

GitHub Actions / Build library (ubuntu-latest)

The name 'DateTimeStyles' does not exist in the current context

Check failure on line 40 in DisCatSharp/Entities/Message/Polls/DiscordPoll.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

The name 'CultureInfo' does not exist in the current context

Check failure on line 40 in DisCatSharp/Entities/Message/Polls/DiscordPoll.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

The name 'DateTimeStyles' does not exist in the current context

Check failure on line 40 in DisCatSharp/Entities/Message/Polls/DiscordPoll.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

The name 'CultureInfo' does not exist in the current context

Check failure on line 40 in DisCatSharp/Entities/Message/Polls/DiscordPoll.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

The name 'DateTimeStyles' does not exist in the current context

Check failure on line 40 in DisCatSharp/Entities/Message/Polls/DiscordPoll.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

The name 'CultureInfo' does not exist in the current context

Check failure on line 40 in DisCatSharp/Entities/Message/Polls/DiscordPoll.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

The name 'DateTimeStyles' does not exist in the current context

Check failure on line 40 in DisCatSharp/Entities/Message/Polls/DiscordPoll.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

The name 'CultureInfo' does not exist in the current context

Check failure on line 40 in DisCatSharp/Entities/Message/Polls/DiscordPoll.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

The name 'DateTimeStyles' does not exist in the current context

Check failure on line 40 in DisCatSharp/Entities/Message/Polls/DiscordPoll.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

The name 'CultureInfo' does not exist in the current context

Check failure on line 40 in DisCatSharp/Entities/Message/Polls/DiscordPoll.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

The name 'DateTimeStyles' does not exist in the current context

/// <summary>
/// Gets the poll layout type.
Expand Down

0 comments on commit 0c30901

Please sign in to comment.