Skip to content

Commit

Permalink
feat: Add missing properties to
Browse files Browse the repository at this point in the history
Fixes DISCATSHARP-2CA
Fxies #435
  • Loading branch information
Lulalaby committed Aug 27, 2024
1 parent cd8d487 commit 4927793
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions DisCatSharp/Entities/Guild/ScheduledEvent/DiscordScheduledEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class DiscordScheduledEvent : SnowflakeObject, IEquatable<DiscordSchedule
/// Initializes a new instance of the <see cref="DiscordScheduledEvent" /> class.
/// </summary>
internal DiscordScheduledEvent()
: base(["sku_ids"])
: base(["sku_ids", "privacy_level", "guild_scheduled_event_exceptions"])
{ }

/// <summary>
Expand All @@ -35,14 +35,14 @@ internal DiscordScheduledEvent()
/// </summary>
[JsonIgnore]
public DiscordGuild Guild
=> this.Discord.Guilds.TryGetValue(this.GuildId, out var guild) ? guild : null;
=> this.Discord.Guilds.TryGetValue(this.GuildId, out var guild) ? guild : null!;

/// <summary>
/// Gets the associated channel.
/// </summary>
[JsonIgnore]
public Task<DiscordChannel> Channel
=> this.ChannelId.HasValue ? this.Discord.ApiClient.GetChannelAsync(this.ChannelId.Value) : null;
public DiscordChannel? Channel
=> this.ChannelId.HasValue ? this.Discord.ApiClient.GetChannelAsync(this.ChannelId.Value).Result : null;

/// <summary>
/// Gets id of the associated channel id.
Expand Down Expand Up @@ -87,13 +87,13 @@ public DiscordMember CreatorMember
/// Gets this event's cover hash, when applicable.
/// </summary>
[JsonProperty("image", NullValueHandling = NullValueHandling.Include)]
public string CoverImageHash { get; internal set; }
public string? CoverImageHash { get; internal set; }

/// <summary>
/// Gets this event's cover in url form.
/// </summary>
[JsonIgnore]
public string CoverImageUrl
public string? CoverImageUrl
=> !string.IsNullOrWhiteSpace(this.CoverImageHash) ? $"{DiscordDomain.GetDomain(CoreDomain.DiscordCdn).Uri}{Endpoints.GUILD_EVENTS}/{this.Id.ToString(CultureInfo.InvariantCulture)}/{this.CoverImageHash}.png" : null;

/// <summary>
Expand Down Expand Up @@ -169,6 +169,12 @@ This isn't used.
[JsonProperty("user_count", NullValueHandling = NullValueHandling.Ignore)]
public int UserCount { get; internal set; }

/// <summary>
/// Gets whether the scheduled event auto starts.
/// </summary>
[JsonProperty("auto_start", NullValueHandling = NullValueHandling.Ignore)]
public bool AutoStart { get; internal set; }

/// <summary>
/// Checks whether this <see cref="DiscordScheduledEvent" /> is equal to another <see cref="DiscordScheduledEvent" />.
/// </summary>
Expand Down

0 comments on commit 4927793

Please sign in to comment.