Method BanAsync
- Namespace
- DSharpPlus.Entities
- Assembly
- DSharpPlus.dll
BanAsync(TimeSpan, string)
Bans a this member from their guild.
public Task BanAsync(TimeSpan deleteMessageDuration = default, string reason = null)
Parameters
deleteMessageDuration
TimeSpanThe duration in which discord should delete messages from the banned user.
reason
stringReason for audit logs.
Returns
- Task
Exceptions
- UnauthorizedException
Thrown when the client does not have the BanMembers permission.
- NotFoundException
Thrown when the member does not exist.
- BadRequestException
Thrown when an invalid parameter was provided.
- ServerErrorException
Thrown when Discord is unable to process the request.