Method CreateInviteAsync
- Namespace
- DSharpPlus.Entities
- Assembly
- DSharpPlus.dll
CreateInviteAsync(int, int, bool, bool, string, DiscordInviteTargetType?, ulong?, ulong?)
Create a new invite object
public Task<DiscordInvite> CreateInviteAsync(int max_age = 86400, int max_uses = 0, bool temporary = false, bool unique = false, string reason = null, DiscordInviteTargetType? targetType = null, ulong? targetUserId = null, ulong? targetApplicationId = null)
Parameters
max_ageintDuration of invite in seconds before expiry, or 0 for never. Defaults to 86400.
max_usesintMax number of uses or 0 for unlimited. Defaults to 0
temporaryboolWhether this invite only grants temporary membership. Defaults to false.
uniqueboolIf true, don't try to reuse a similar invite (useful for creating many unique one time use invites)
reasonstringReason for audit logs.
targetTypeDiscordInviteTargetType?The target type of the invite, for stream and embedded application invites.
targetUserIdulong?The ID of the target user.
targetApplicationIdulong?The ID of the target application.
Returns
Exceptions
- UnauthorizedException
Thrown when the client does not have the CreateInvite 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.