Method BanMemberAsync
- Namespace
- DisCatSharp.Entities
- Assembly
- DisCatSharp.dll
BanMemberAsync(DiscordMember, int, string?)
Bans a specified DiscordMember from this guild.
public Task BanMemberAsync(DiscordMember member, int deleteMessageSeconds = 0, string? reason = null)
Parameters
member
DiscordMemberMember to ban.
deleteMessageSeconds
intHow many seconds to remove messages from the users. Minimum
0
seconds and maximum604800
seconds (7 days).reason
stringReason for audit logs.
Returns
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.
BanMemberAsync(DiscordUser, int, string?)
Bans a specified DiscordUser. This doesn't require the user to be in this guild.
public Task BanMemberAsync(DiscordUser user, int deleteMessageSeconds = 0, string? reason = null)
Parameters
user
DiscordUserThe user to ban.
deleteMessageSeconds
intHow many seconds to remove messages from the users. Minimum
0
seconds and maximum604800
seconds (7 days).reason
stringReason for audit logs.
Returns
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.
BanMemberAsync(ulong, int, string)
Bans a specified user ID from this guild. This doesn't require the user to be in this guild.
public Task BanMemberAsync(ulong userId, int deleteMessageSeconds = 0, string reason = null)
Parameters
userId
ulongID of the user to ban.
deleteMessageSeconds
intHow many seconds to remove messages from the users. Minimum
0
seconds and maximum604800
seconds (7 days).reason
stringReason for audit logs.
Returns
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.