Skip to content

Commit

Permalink
Update DiscordGuild.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
Lulalaby committed Jul 26, 2023
1 parent 0c41e66 commit 48ef29b
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions DisCatSharp/Entities/Guild/DiscordGuild.cs
Original file line number Diff line number Diff line change
Expand Up @@ -616,12 +616,12 @@ public IReadOnlyDictionary<ulong, DiscordChannel> OrderedChannels
private Dictionary<ulong, DiscordChannel> InternalSortChannels()
{
Dictionary<ulong, DiscordChannel> keyValuePairs = new();
var ochannels = this.GetOrderedChannels();
foreach (var ochan in ochannels)
var orderedChannels = this.GetOrderedChannels();
foreach (var orderedChannel in orderedChannels)
{
if (ochan.Key != 0)
keyValuePairs.Add(ochan.Key, this.GetChannel(ochan.Key));
foreach (var chan in ochan.Value)
if (orderedChannel.Key != 0)
keyValuePairs.Add(orderedChannel.Key, this.GetChannel(orderedChannel.Key));
foreach (var chan in orderedChannel.Value)
keyValuePairs.Add(chan.Id, chan);
}
return keyValuePairs;
Expand Down Expand Up @@ -650,11 +650,11 @@ public Dictionary<ulong, List<DiscordChannel>> GetOrderedChannels()

foreach (var channel in rawChannels.Where(c => c.ParentId.HasValue && (c.Type == ChannelType.Text || c.Type == ChannelType.News || c.Type == ChannelType.Forum)).OrderBy(c => c.Position))
{
orderedChannels[channel.ParentId.Value].Add(channel);
orderedChannels[channel.ParentId.Value!].Add(channel);
}
foreach (var channel in rawChannels.Where(c => c.ParentId.HasValue && (c.Type == ChannelType.Voice || c.Type == ChannelType.Stage)).OrderBy(c => c.Position))
{
orderedChannels[channel.ParentId.Value].Add(channel);
orderedChannels[channel.ParentId.Value!].Add(channel);
}

foreach (var channel in rawChannels.Where(c => !c.ParentId.HasValue && c.Type != ChannelType.Category && (c.Type == ChannelType.Text || c.Type == ChannelType.News || c.Type == ChannelType.Forum)).OrderBy(c => c.Position))
Expand Down Expand Up @@ -692,11 +692,11 @@ public async Task<Dictionary<ulong, List<DiscordChannel>>> GetOrderedChannelsAsy

foreach (var channel in rawChannels.Where(c => c.ParentId.HasValue && (c.Type == ChannelType.Text || c.Type == ChannelType.News || c.Type == ChannelType.Forum)).OrderBy(c => c.Position))
{
orderedChannels[channel.ParentId.Value].Add(channel);
orderedChannels[channel.ParentId.Value!].Add(channel);
}
foreach (var channel in rawChannels.Where(c => c.ParentId.HasValue && (c.Type == ChannelType.Voice || c.Type == ChannelType.Stage)).OrderBy(c => c.Position))
{
orderedChannels[channel.ParentId.Value].Add(channel);
orderedChannels[channel.ParentId.Value!].Add(channel);
}

foreach (var channel in rawChannels.Where(c => !c.ParentId.HasValue && c.Type != ChannelType.Category && (c.Type == ChannelType.Text || c.Type == ChannelType.News || c.Type == ChannelType.Forum)).OrderBy(c => c.Position))
Expand Down

0 comments on commit 48ef29b

Please sign in to comment.