Table of Contents

Method CreateInviteAsync

Namespace
DisCatSharp.Entities
Assembly
DisCatSharp.dll

CreateInviteAsync(int, int, bool, bool, TargetType?, ulong?, ulong?, string)

Create a new invite object

public Task<DiscordInvite> CreateInviteAsync(int maxAge = 86400, int maxUses = 0, bool temporary = false, bool unique = false, TargetType? targetType = null, ulong? targetApplicationId = null, ulong? targetUser = null, string reason = null)

Parameters

maxAge int

Duration of invite in seconds before expiry, or 0 for never. Defaults to 86400.

maxUses int

Max number of uses or 0 for unlimited. Defaults to 0

temporary bool

Whether this invite should be temporary. Defaults to false.

unique bool

Whether this invite should be unique. Defaults to false.

targetType TargetType?

The target type. Defaults to null.

targetApplicationId ulong?

The target activity ID. Defaults to null.

targetUser ulong?

The target user id. Defaults to null.

reason string

The audit log reason.

Returns

Task<DiscordInvite>

Exceptions

UnauthorizedException

Thrown when the client does not have the CreateInstantInvite permission.

NotFoundException

Thrown when the channel does not exist.

BadRequestException

Thrown when an invalid parameter was provided.

ServerErrorException

Thrown when Discord is unable to process the request.