Table of Contents

Method UnbanMemberAsync

Namespace
DisCatSharp.Entities
Assembly
DisCatSharp.dll

UnbanMemberAsync(DiscordUser, string?, CancellationToken)

Unbans a user from this guild.

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

Parameters

user DiscordUser

User to unban.

reason string

Reason for audit logs.

cancellationToken CancellationToken

A token to cancel the request.

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?, CancellationToken)

Unbans a user by ID.

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

Parameters

userId ulong

ID of the user to unban.

reason string

Reason for audit logs.

cancellationToken CancellationToken

A token to cancel the request.

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.