Method CreateThreadAsync
- Namespace
- DisCatSharp.Entities
- Assembly
- DisCatSharp.dll
CreateThreadAsync(string, ThreadAutoArchiveDuration, ChannelType, int?, string, CancellationToken)
Creates a thread.
public Task<DiscordThreadChannel> CreateThreadAsync(string name, ThreadAutoArchiveDuration autoArchiveDuration = ThreadAutoArchiveDuration.OneHour, ChannelType type = ChannelType.PublicThread, int? rateLimitPerUser = null, string reason = null, CancellationToken cancellationToken = default)
Parameters
namestringThe name of the thread.
autoArchiveDurationThreadAutoArchiveDurationThreadAutoArchiveDuration till it gets archived. Defaults to OneHour.
typeChannelTypeCan be either an PrivateThread, NewsThread or an PublicThread.
rateLimitPerUserint?The per user ratelimit, aka slowdown.
reasonstringAudit log reason.
cancellationTokenCancellationTokenA token to cancel the request.
Returns
- Task<DiscordThreadChannel>
The created thread.
Exceptions
- UnauthorizedException
Thrown when the client does not have the CreatePublicThreads or SendMessagesInThreads or if creating a private thread the CreatePrivateThreads permission.
- NotFoundException
Thrown when the guild hasn't enabled threads atm.
- BadRequestException
Thrown when an invalid parameter was provided.
- ServerErrorException
Thrown when Discord is unable to process the request.
- NotSupportedException
Thrown when a wrong
typewas given.