Table of Contents

Method UnbanMemberAsync

Namespace
DSharpPlus.Entities
Assembly
DSharpPlus.dll

UnbanMemberAsync(DiscordUser, string?)

Unbans a user from this guild.

public Task UnbanMemberAsync(DiscordUser user, string? reason = null)

Parameters

user DiscordUser

User to unban.

reason string

Reason for audit logs.

Returns

Task

Exceptions

UnauthorizedException

Thrown when the client does not have the BanMembers permission.

NotFoundException

Thrown when the user does not exist.

BadRequestException

Thrown when an invalid parameter was provided.

ServerErrorException

Thrown when Discord is unable to process the request.

UnbanMemberAsync(ulong, string?)

Unbans a user by ID.

public Task UnbanMemberAsync(ulong userId, string? reason = null)

Parameters

userId ulong

ID of the user to unban.

reason string

Reason for audit logs.

Returns

Task

Exceptions

UnauthorizedException

Thrown when the client does not have the BanMembers permission.

NotFoundException

Thrown when the user does not exist.

BadRequestException

Thrown when an invalid parameter was provided.

ServerErrorException

Thrown when Discord is unable to process the request.