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
userDiscordUserUser to unban.
reasonstringReason for audit logs.
cancellationTokenCancellationTokenA token to cancel the request.
Returns
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
userIdulongID of the user to unban.
reasonstringReason for audit logs.
cancellationTokenCancellationTokenA token to cancel the request.
Returns
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.