Пример #1
0
        private static async Task ReorderChannels(SocketGuild guild)
        {
            var config   = guild.GetGovernanceConfig();
            var channels = guild.CategoryChannels.First(c => c.Id == config.Category).Channels
                           .OrderByDescending(c => c.Id).ToList();

            var normal = channels.Where(c => !c.IsSuggestionChannelByName()).Reverse();
            var vote   = channels.Except(normal).Where(c => c.GetSuggestionChannelType() == SuggestionType.Vote);
            var rfc    = channels.Except(normal).Where(c => c.GetSuggestionChannelType() == SuggestionType.RFC);
            var draft  = channels.Except(normal).Where(c => c.GetSuggestionChannelType() == SuggestionType.Draft);
            await guild.ReorderChannelsAsync(normal.Concat(vote).Concat(rfc).Concat(draft)
                                             .Select((c, i) => new ReorderChannelProperties(c.Id, i)));
        }