DSharpPlus/Entities/Guild/DiscordGuild.cs
/// <summary>
/// Prunes inactive users from this guild.
/// </summary>
/// <param name="days">Minimum number of inactivity days required for users to be pruned. Defaults to 7.</param>
/// <param name="computePruneCount">Whether to return the prune count after this method completes. This is discouraged for larger guilds.</param>
/// <param name="includedRoles">The roles to be included in the prune.</param>
/// <param name="reason">Reason for audit logs.</param>
/// <returns>Number of users pruned.</returns>
/// <exception cref="Exceptions.UnauthorizedException">Thrown when the client does not have the <see cref="Permissions.ManageChannels"/> permission.</exception>
/// <exception cref="Exceptions.NotFoundException">Thrown when the guild does not exist.</exception>
/// <exception cref="Exceptions.BadRequestException">Thrown when an invalid parameter was provided.</exception>
/// <exception cref="Exceptions.ServerErrorException">Thrown when Discord is unable to process the request.</exception>
Prunes inactive users from this guild.
Prunes inactive users from this guild .
public Task<int?> PruneAsync(int days = 7, bool computePruneCount = true, IEnumerable<DiscordRole> includedRoles = null, string reason = null)
        {
            if (includedRoles != null)
            {
                includedRoles = includedRoles.Where(r => r != null);
                var roleCount = includedRoles.Count();
                var roleArr = includedRoles.ToArray();
                var rawRoleIds = new List<ulong>();
                for (int i = 0; i < roleCount; i++)
                {
                    if (this._roles.ContainsKey(roleArr[i].Id))
                        rawRoleIds.Add(roleArr[i].Id);
                }
                return this.Discord.ApiClient.BeginGuildPruneAsync(this.Id, days, computePruneCount, rawRoleIds, reason);
            }
            return this.Discord.ApiClient.BeginGuildPruneAsync(this.Id, days, computePruneCount, null, reason);
        }
public Task < int ? > PruneAsync ( int days = 7 , bool computePruneCount = true , IEnumerable < DiscordRole > includedRoles = null , string reason = null ) { if ( includedRoles != null ) { includedRoles = includedRoles . Where ( r => r != null ) ; var roleCount = includedRoles . Count ( ) ; var roleArr = includedRoles . ToArray ( ) ; var rawRoleIds = new List < ulong > ( ) ; for ( int i = 0 ; i < roleCount ; i ++ ) { if ( this . _roles . ContainsKey ( roleArr [ i ] . Id ) ) rawRoleIds . Add ( roleArr [ i ] . Id ) ; } return this . Discord . ApiClient . BeginGuildPruneAsync ( this . Id , days , computePruneCount , rawRoleIds , reason ) ; } return this . Discord . ApiClient . BeginGuildPruneAsync ( this . Id , days , computePruneCount , null , reason ) ; }
Prunes inactive users from this guild.
Prunes inactive users from this guild .
Number of users pruned.
Number of users pruned .
Thrown when the client does not have the  permission.
Thrown when the client does not have the permission .
Thrown when the guild does not exist.
Thrown when the guild does not exist .
Thrown when an invalid parameter was provided.
Thrown when an invalid parameter was provided .
Thrown when Discord is unable to process the request.
Thrown when Discord is unable to process the request .
days
int
Minimum number of inactivity days required for users to be pruned. Defaults to 7.
Minimum number of inactivity days required for users to be pruned . Defaults to 7 .
computePruneCount
bool
Whether to return the prune count after this method completes. This is discouraged for larger guilds.
Whether to return the prune count after this method completes . This is discouraged for larger guilds .
includedRoles
IEnumerable<DiscordRole>
The roles to be included in the prune.
The roles to be included in the prune .
reason
string
Reason for audit logs.
Reason for audit logs .