Table of Contents

Method PruneAsync

Namespace
DSharpPlus.Entities
Assembly
DSharpPlus.dll

PruneAsync(int, bool, IEnumerable<DiscordRole>?, string?)

Prunes inactive users from this guild.

public Task<int?> PruneAsync(int days = 7, bool computePruneCount = true, IEnumerable<DiscordRole>? includedRoles = null, string? reason = null)

Parameters

days int

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.

includedRoles IEnumerable<DiscordRole>

The roles to be included in the prune.

reason string

Reason for audit logs.

Returns

Task<int?>

Number of users pruned.

Exceptions

UnauthorizedException

Thrown when the client does not have the ManageChannels permission.

NotFoundException

Thrown when the guild does not exist.

BadRequestException

Thrown when an invalid parameter was provided.

ServerErrorException

Thrown when Discord is unable to process the request.

PruneAsync(int, bool, IEnumerable<ulong>?, string?)

Prunes inactive users from this guild.

public Task<int?> PruneAsync(int days = 7, bool computePruneCount = true, IEnumerable<ulong>? includedRoleIds = null, string? reason = null)

Parameters

days int

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.

includedRoleIds IEnumerable<ulong>

The ids of roles to be included in the prune.

reason string

Reason for audit logs.

Returns

Task<int?>

Number of users pruned.

Exceptions

UnauthorizedException

Thrown when the client does not have the ManageChannels permission.

NotFoundException

Thrown when the guild does not exist.

BadRequestException

Thrown when an invalid parameter was provided.

ServerErrorException

Thrown when Discord is unable to process the request.