Method CreateInviteAsync
- Namespace
- DisCatSharp.Entities
- Assembly
- DisCatSharp.dll
CreateInviteAsync(int, int, bool, bool, TargetType?, ulong?, ulong?, string, IEnumerable<ulong>?, IEnumerable<ulong>?, IEnumerable<DiscordUser>?, Stream?)
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, IEnumerable<ulong>? roleIds = null, IEnumerable<ulong>? targetUserIds = null, IEnumerable<DiscordUser>? targetUsers = null, Stream? targetUsersCsv = null)
Parameters
maxAgeintDuration of invite in seconds before expiry, or 0 for never. Defaults to 86400.
maxUsesintMax number of uses or 0 for unlimited. Defaults to 0
temporaryboolWhether this invite should be temporary. Defaults to false.
uniqueboolWhether this invite should be unique. Defaults to false.
targetTypeTargetType?The target type. Defaults to null.
targetApplicationIdulong?The target activity ID. Defaults to null.
targetUserulong?The target user id. Defaults to null.
reasonstringThe audit log reason.
roleIdsIEnumerable<ulong>Role ids to grant when the invite is accepted.
targetUserIdsIEnumerable<ulong>Allowed target user ids for the invite.
targetUsersIEnumerable<DiscordUser>Allowed target users for the invite.
targetUsersCsvStreamOptional CSV stream defining allowed users.
Returns
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.
- ArgumentException
Thrown when the provided stream is not readable.