Browse Source

made changes be actually optional. not everything always changes

pull/2437/head
Rennorb 2 years ago
parent
commit
8723477aef
2 changed files with 33 additions and 33 deletions
  1. +7
    -7
      src/Discord.Net.Rest/Entities/AuditLogs/DataTypes/ScheduledEventInfo.cs
  2. +26
    -26
      src/Discord.Net.Rest/Entities/AuditLogs/DataTypes/ScheduledEventUpdateAuditLogData.cs

+ 7
- 7
src/Discord.Net.Rest/Entities/AuditLogs/DataTypes/ScheduledEventInfo.cs View File

@@ -10,7 +10,7 @@ namespace Discord.Rest
/// <summary> /// <summary>
/// Gets the snowflake id of the guild the event is associated with. /// Gets the snowflake id of the guild the event is associated with.
/// </summary> /// </summary>
public ulong GuildId { get; }
public ulong? GuildId { get; }
/// <summary> /// <summary>
/// Gets the snowflake id of the channel the event is associated with. /// Gets the snowflake id of the channel the event is associated with.
/// </summary> /// </summary>
@@ -26,7 +26,7 @@ namespace Discord.Rest
/// <summary> /// <summary>
/// Gets the time the event was scheduled for. /// Gets the time the event was scheduled for.
/// </summary> /// </summary>
public DateTimeOffset ScheduledStartTime { get; }
public DateTimeOffset? ScheduledStartTime { get; }
/// <summary> /// <summary>
/// Gets the time the event was scheduled to end. /// Gets the time the event was scheduled to end.
/// </summary> /// </summary>
@@ -34,15 +34,15 @@ namespace Discord.Rest
/// <summary> /// <summary>
/// Gets the privacy level of the event. /// Gets the privacy level of the event.
/// </summary> /// </summary>
public GuildScheduledEventPrivacyLevel PrivacyLevel { get; }
public GuildScheduledEventPrivacyLevel? PrivacyLevel { get; }
/// <summary> /// <summary>
/// Gets the status of the event. /// Gets the status of the event.
/// </summary> /// </summary>
public GuildScheduledEventStatus Status { get; }
public GuildScheduledEventStatus? Status { get; }
/// <summary> /// <summary>
/// Gets the type of the entity associated with the event (stage / void / external). /// Gets the type of the entity associated with the event (stage / void / external).
/// </summary> /// </summary>
public GuildScheduledEventType EntityType { get; }
public GuildScheduledEventType? EntityType { get; }
/// <summary> /// <summary>
/// Gets the snowflake id of the entity associated with the event (stage / void / external). /// Gets the snowflake id of the entity associated with the event (stage / void / external).
/// </summary> /// </summary>
@@ -54,13 +54,13 @@ namespace Discord.Rest
/// <summary> /// <summary>
/// Gets the count of users interested in this event. /// Gets the count of users interested in this event.
/// </summary> /// </summary>
public int UserCount { get; }
public int? UserCount { get; }
/// <summary> /// <summary>
/// Gets the image hash of the image that was attached to the event. Null if not set. /// Gets the image hash of the image that was attached to the event. Null if not set.
/// </summary> /// </summary>
public string Image { get; } public string Image { get; }


internal ScheduledEventInfo(ulong guildId, ulong? channelId, string name, string description, DateTimeOffset scheduledStartTime, DateTimeOffset? scheduledEndTime, GuildScheduledEventPrivacyLevel privacyLevel, GuildScheduledEventStatus status, GuildScheduledEventType entityType, ulong? entityId, string location, int userCount, string image)
internal ScheduledEventInfo(ulong? guildId, ulong? channelId, string name, string description, DateTimeOffset? scheduledStartTime, DateTimeOffset? scheduledEndTime, GuildScheduledEventPrivacyLevel? privacyLevel, GuildScheduledEventStatus? status, GuildScheduledEventType? entityType, ulong? entityId, string location, int? userCount, string image)
{ {
GuildId = guildId ; GuildId = guildId ;
ChannelId = channelId ; ChannelId = channelId ;


+ 26
- 26
src/Discord.Net.Rest/Entities/AuditLogs/DataTypes/ScheduledEventUpdateAuditLogData.cs View File

@@ -40,41 +40,41 @@ namespace Discord.Rest
var image = entry.Changes.FirstOrDefault(x => x.ChangedProperty == "image"); var image = entry.Changes.FirstOrDefault(x => x.ChangedProperty == "image");


var before = new ScheduledEventInfo( var before = new ScheduledEventInfo(
guildId.OldValue.ToObject<ulong>(discord.ApiClient.Serializer),
channelId.OldValue.ToObject<ulong?>(discord.ApiClient.Serializer),
name.OldValue.ToObject<string>(discord.ApiClient.Serializer),
description.OldValue.ToObject<Optional<string>>(discord.ApiClient.Serializer)
guildId?.OldValue.ToObject<ulong>(discord.ApiClient.Serializer),
channelId?.OldValue.ToObject<ulong?>(discord.ApiClient.Serializer),
name?.OldValue.ToObject<string>(discord.ApiClient.Serializer),
description?.OldValue.ToObject<Optional<string>>(discord.ApiClient.Serializer)
.GetValueOrDefault(), .GetValueOrDefault(),
scheduledStartTime.OldValue.ToObject<DateTimeOffset>(discord.ApiClient.Serializer),
scheduledEndTime.OldValue.ToObject<DateTimeOffset?>(discord.ApiClient.Serializer),
privacyLevel.OldValue.ToObject<GuildScheduledEventPrivacyLevel>(discord.ApiClient.Serializer),
status.OldValue.ToObject<GuildScheduledEventStatus>(discord.ApiClient.Serializer),
entityType.OldValue.ToObject<GuildScheduledEventType>(discord.ApiClient.Serializer),
entityId.OldValue.ToObject<ulong?>(discord.ApiClient.Serializer),
entityMetadata.OldValue.ToObject<GuildScheduledEventEntityMetadata>(discord.ApiClient.Serializer)
scheduledStartTime?.OldValue.ToObject<DateTimeOffset>(discord.ApiClient.Serializer),
scheduledEndTime?.OldValue.ToObject<DateTimeOffset?>(discord.ApiClient.Serializer),
privacyLevel?.OldValue.ToObject<GuildScheduledEventPrivacyLevel>(discord.ApiClient.Serializer),
status?.OldValue.ToObject<GuildScheduledEventStatus>(discord.ApiClient.Serializer),
entityType?.OldValue.ToObject<GuildScheduledEventType>(discord.ApiClient.Serializer),
entityId?.OldValue.ToObject<ulong?>(discord.ApiClient.Serializer),
entityMetadata?.OldValue.ToObject<GuildScheduledEventEntityMetadata>(discord.ApiClient.Serializer)
?.Location.GetValueOrDefault(), ?.Location.GetValueOrDefault(),
userCount.OldValue.ToObject<Optional<int>>(discord.ApiClient.Serializer)
userCount?.OldValue.ToObject<Optional<int>>(discord.ApiClient.Serializer)
.GetValueOrDefault(), .GetValueOrDefault(),
image.OldValue.ToObject<Optional<string>>(discord.ApiClient.Serializer)
image?.OldValue.ToObject<Optional<string>>(discord.ApiClient.Serializer)
.GetValueOrDefault() .GetValueOrDefault()
); );
var after = new ScheduledEventInfo( var after = new ScheduledEventInfo(
guildId.NewValue.ToObject<ulong>(discord.ApiClient.Serializer),
channelId.NewValue.ToObject<ulong?>(discord.ApiClient.Serializer),
name.NewValue.ToObject<string>(discord.ApiClient.Serializer),
description.NewValue.ToObject<Optional<string>>(discord.ApiClient.Serializer)
guildId?.NewValue.ToObject<ulong>(discord.ApiClient.Serializer),
channelId?.NewValue.ToObject<ulong?>(discord.ApiClient.Serializer),
name?.NewValue.ToObject<string>(discord.ApiClient.Serializer),
description?.NewValue.ToObject<Optional<string>>(discord.ApiClient.Serializer)
.GetValueOrDefault(), .GetValueOrDefault(),
scheduledStartTime.NewValue.ToObject<DateTimeOffset>(discord.ApiClient.Serializer),
scheduledEndTime.NewValue.ToObject<DateTimeOffset?>(discord.ApiClient.Serializer),
privacyLevel.NewValue.ToObject<GuildScheduledEventPrivacyLevel>(discord.ApiClient.Serializer),
status.NewValue.ToObject<GuildScheduledEventStatus>(discord.ApiClient.Serializer),
entityType.NewValue.ToObject<GuildScheduledEventType>(discord.ApiClient.Serializer),
entityId.NewValue.ToObject<ulong?>(discord.ApiClient.Serializer),
entityMetadata.NewValue.ToObject<GuildScheduledEventEntityMetadata>(discord.ApiClient.Serializer)
scheduledStartTime?.NewValue.ToObject<DateTimeOffset>(discord.ApiClient.Serializer),
scheduledEndTime?.NewValue.ToObject<DateTimeOffset?>(discord.ApiClient.Serializer),
privacyLevel?.NewValue.ToObject<GuildScheduledEventPrivacyLevel>(discord.ApiClient.Serializer),
status?.NewValue.ToObject<GuildScheduledEventStatus>(discord.ApiClient.Serializer),
entityType?.NewValue.ToObject<GuildScheduledEventType>(discord.ApiClient.Serializer),
entityId?.NewValue.ToObject<ulong?>(discord.ApiClient.Serializer),
entityMetadata?.NewValue.ToObject<GuildScheduledEventEntityMetadata>(discord.ApiClient.Serializer)
?.Location.GetValueOrDefault(), ?.Location.GetValueOrDefault(),
userCount.NewValue.ToObject<Optional<int>>(discord.ApiClient.Serializer)
userCount?.NewValue.ToObject<Optional<int>>(discord.ApiClient.Serializer)
.GetValueOrDefault(), .GetValueOrDefault(),
image.NewValue.ToObject<Optional<string>>(discord.ApiClient.Serializer)
image?.NewValue.ToObject<Optional<string>>(discord.ApiClient.Serializer)
.GetValueOrDefault() .GetValueOrDefault()
); );




Loading…
Cancel
Save