Skip to content

Commit

Permalink
chore: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Lulalaby committed Oct 22, 2023
1 parent fbed3d5 commit 80321fc
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ public BotAddChangeSet()

public DiscordUser Bot => this.Discord.GetCachedOrEmptyUserInternal(this.TargetId!.Value);

internal override string? ChangeDescription
internal override string? ChangeDescription
=> $"{this.UserId} added {this.Bot.Username ?? "Not cached".Italic()} ({this.TargetId})";
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,23 @@ public ChannelCreateChangeSet()
public ulong? ParentId => (ulong?)this.Changes.FirstOrDefault(x => x.Key == "parent_id")?.NewValue;
public DiscordChannel? Parent => this.Discord.Guilds[this.GuildId].Channels.TryGetValue(this.ParentId ?? 0ul, out var channel) ? channel : null;

#region Voice
#region Voice

public int? Bitrate => (int?)this.Changes.FirstOrDefault(x => x.Key == "bitrate")?.NewValue;
public int? UserLimit => (int?)this.Changes.FirstOrDefault(x => x.Key == "user_limit")?.NewValue;
public string? RtcRegionId => (string?)this.Changes.FirstOrDefault(x => x.Key == "rtc_region")?.NewValue;
public DiscordVoiceRegion? RtcRegion => this.Discord.VoiceRegions[this.RtcRegionId];
public VideoQualityMode? VideoQualityMode => (VideoQualityMode?)this.Changes.FirstOrDefault(x => x.Key == "video_quality_mode")?.NewValue;
#endregion

#region Forum
#endregion

#region Forum

public ForumPostTag? AvailableTags => (ForumPostTag?)this.Changes.FirstOrDefault(x => x.Key == "available_tags")?.NewValue;
public ForumReactionEmoji? DefaultReactionEmoji => (ForumReactionEmoji?)this.Changes.FirstOrDefault(x => x.Key == "default_reaction_emoji")?.NewValue;
public ForumPostSortOrder? DefaultSortOrder => (ForumPostSortOrder?)this.Changes.FirstOrDefault(x => x.Key == "default_sort_order")?.NewValue;
public ForumLayout? DefaultLayout => (ForumLayout?)this.Changes.FirstOrDefault(x => x.Key == "default_forum_layout")?.NewValue;
public int? DefaultThreadPerUserRateLimit => (int?)this.Changes.FirstOrDefault(x => x.Key == "default_thread_rate_limit_per_user")?.NewValue;
#endregion
public int? DefaultThreadPerUserRateLimit => (int?)this.Changes.FirstOrDefault(x => x.Key == "default_thread_rate_limit_per_user")?.NewValue;

#endregion
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,23 @@ public ChannelDeleteChangeSet()
public ulong? ParentId => (ulong?)this.Changes.FirstOrDefault(x => x.Key == "parent_id")?.OldValue;
public DiscordChannel? Parent => this.Discord.Guilds[this.GuildId].Channels.TryGetValue(this.ParentId ?? 0ul, out var channel) ? channel : null;

#region Voice
#region Voice

public int? Bitrate => (int?)this.Changes.FirstOrDefault(x => x.Key == "bitrate")?.OldValue;
public int? UserLimit => (int?)this.Changes.FirstOrDefault(x => x.Key == "user_limit")?.OldValue;
public string? RtcRegionId => (string?)this.Changes.FirstOrDefault(x => x.Key == "rtc_region")?.OldValue;
public DiscordVoiceRegion? RtcRegion => this.Discord.VoiceRegions[this.RtcRegionId];
public VideoQualityMode? VideoQualityMode => (VideoQualityMode?)this.Changes.FirstOrDefault(x => x.Key == "video_quality_mode")?.OldValue;
#endregion

#region Forum
#endregion

#region Forum

public ForumPostTag? AvailableTags => (ForumPostTag?)this.Changes.FirstOrDefault(x => x.Key == "available_tags")?.OldValue;
public ForumReactionEmoji? DefaultReactionEmoji => (ForumReactionEmoji?)this.Changes.FirstOrDefault(x => x.Key == "default_reaction_emoji")?.OldValue;
public ForumPostSortOrder? DefaultSortOrder => (ForumPostSortOrder?)this.Changes.FirstOrDefault(x => x.Key == "default_sort_order")?.OldValue;
public ForumLayout? DefaultLayout => (ForumLayout?)this.Changes.FirstOrDefault(x => x.Key == "default_forum_layout")?.OldValue;
public int? DefaultThreadPerUserRateLimit => (int?)this.Changes.FirstOrDefault(x => x.Key == "default_thread_rate_limit_per_user")?.OldValue;
#endregion

#endregion
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ public ChannelUpdateChangeSet()
public DiscordChannel? ParentBefore => this.Discord.Guilds[this.GuildId].Channels.TryGetValue(this.ParentIdBefore ?? 0ul, out var channel) ? channel : null;
public DiscordChannel? ParentAfter => this.Discord.Guilds[this.GuildId].Channels.TryGetValue(this.ParentIdAfter ?? 0ul, out var channel) ? channel : null;

#region Voice
#region Voice

public bool BitrateChanged => this.BitrateBefore is not null || this.BitrateAfter is not null;
public int? BitrateBefore => (int?)this.Changes.FirstOrDefault(x => x.Key == "bitrate")?.OldValue;
public int? BitrateAfter => (int?)this.Changes.FirstOrDefault(x => x.Key == "bitrate")?.NewValue;
Expand All @@ -76,9 +77,11 @@ public ChannelUpdateChangeSet()
public bool VideoQualityModeChanged => this.VideoQualityModeBefore is not null || this.VideoQualityModeAfter is not null;
public VideoQualityMode? VideoQualityModeBefore => (VideoQualityMode?)this.Changes.FirstOrDefault(x => x.Key == "video_quality_mode")?.OldValue;
public VideoQualityMode? VideoQualityModeAfter => (VideoQualityMode?)this.Changes.FirstOrDefault(x => x.Key == "video_quality_mode")?.NewValue;
#endregion

#region Forum
#endregion

#region Forum

public bool AvailableTagsChanged => this.AvailableTagsBefore is not null || this.AvailableTagsAfter is not null;
public ForumPostTag? AvailableTagsBefore => (ForumPostTag?)this.Changes.FirstOrDefault(x => x.Key == "available_tags")?.OldValue;
public ForumPostTag? AvailableTagsAfter => (ForumPostTag?)this.Changes.FirstOrDefault(x => x.Key == "available_tags")?.NewValue;
Expand All @@ -98,5 +101,6 @@ public ChannelUpdateChangeSet()
public bool DefaultThreadPerUserRateLimitChanged => this.DefaultThreadPerUserRateLimitBefore is not null || this.DefaultThreadPerUserRateLimitAfter is not null;
public int? DefaultThreadPerUserRateLimitBefore => (int?)this.Changes.FirstOrDefault(x => x.Key == "default_thread_rate_limit_per_user")?.OldValue;
public int? DefaultThreadPerUserRateLimitAfter => (int?)this.Changes.FirstOrDefault(x => x.Key == "default_thread_rate_limit_per_user")?.NewValue;
#endregion

#endregion
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ public MemberRoleUpdateChangeSet()

public IReadOnlyList<DiscordRole> AddedRoles
=> ((IReadOnlyList<DiscordRole>)this.Changes.FirstOrDefault(x => x.Key == "$add")?.OldValue)
.Select(x => this.Discord.Guilds[this.GuildId].GetRole(x.Id)).ToList();
.Select(x => this.Discord.Guilds[this.GuildId].GetRole(x.Id)).ToList();

public IReadOnlyList<DiscordRole> RemovedRoles
=> ((IReadOnlyList<DiscordRole>)this.Changes.FirstOrDefault(x => x.Key == "$remove")?.OldValue)
.Select(x => this.Discord.Guilds[this.GuildId].GetRole(x.Id)).ToList();
.Select(x => this.Discord.Guilds[this.GuildId].GetRole(x.Id)).ToList();
}

0 comments on commit 80321fc

Please sign in to comment.