Table of Contents

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 DiscordMember

Member to ban.

deleteMessageSeconds int

How many seconds to remove messages from the users. Minimum 0 seconds and maximum 604800 seconds (7 days).

reason string

Reason 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.

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 DiscordUser

The user to ban.

deleteMessageSeconds int

How many seconds to remove messages from the users. Minimum 0 seconds and maximum 604800 seconds (7 days).

reason string

Reason 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.

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 ulong

ID of the user to ban.

deleteMessageSeconds int

How many seconds to remove messages from the users. Minimum 0 seconds and maximum 604800 seconds (7 days).

reason string

Reason 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.