Table of Contents

Class GuildThread

Namespace
NetCord
Assembly
NetCord.dll

Represents a thread within a guild.

public abstract class GuildThread : TextGuildChannel, IEquatable<Entity>, IJsonModel<JsonChannel>, IInteractionChannel, IGuildChannel, INamedChannel, IEntity, ISpanFormattable, IFormattable, ICloneable
Inheritance
GuildThread
Implements
Derived
Inherited Members

Constructors

GuildThread(JsonChannel, RestClient)

protected GuildThread(JsonChannel jsonModel, RestClient client)

Parameters

jsonModel JsonChannel
client RestClient

Properties

CurrentUser

A minimal thread user object for the current user, if they have joined the thread.

public ThreadCurrentUser? CurrentUser { get; set; }

Property Value

ThreadCurrentUser

MessageCount

The number of messages within the thread, excluding the initial and deleted messages.

public int MessageCount { get; }

Property Value

int

Remarks

For threads created before July 1, 2022, the message count is inaccurate when greater than 50.

Metadata

Additional metadata for the thread, unnecessary for standard channel operations.

public GuildThreadMetadata Metadata { get; }

Property Value

GuildThreadMetadata

OwnerId

The ID of the thread's creator.

public ulong OwnerId { get; }

Property Value

ulong

ParentId

The ID of the TextGuildChannel this thread was created in.

public ulong ParentId { get; }

Property Value

ulong

TotalMessageSent

The total number of messages sent in the thread, including deletions.

public int TotalMessageSent { get; }

Property Value

int

UserCount

An approximation of the number of users within the thread. Stops counting at 50 users.

public int UserCount { get; }

Property Value

int

Methods

AddUserAsync(ulong, RestRequestProperties?, CancellationToken)

Adds another user to a thread.

public Task AddUserAsync(ulong userId, RestRequestProperties? properties = null, CancellationToken cancellationToken = default)

Parameters

userId ulong

The ID of the user to add to the thread.

properties RestRequestProperties

Optional properties to customize the request, can be null.

cancellationToken CancellationToken

A token that can be used to cancel the operation before it completes.

Returns

Task

CreateFromJson(JsonChannel, RestClient)

public static GuildThread CreateFromJson(JsonChannel jsonChannel, RestClient client)

Parameters

jsonChannel JsonChannel
client RestClient

Returns

GuildThread

DeleteAsync(RestRequestProperties?, CancellationToken)

Deletes a channel.

public Task<GuildThread> DeleteAsync(RestRequestProperties? properties = null, CancellationToken cancellationToken = default)

Parameters

properties RestRequestProperties

Optional properties to customize the request, can be null.

cancellationToken CancellationToken

A token that can be used to cancel the operation before it completes.

Returns

Task<GuildThread>

DeleteUserAsync(ulong, RestRequestProperties?, CancellationToken)

Removes a user from a thread.

public Task DeleteUserAsync(ulong userId, RestRequestProperties? properties = null, CancellationToken cancellationToken = default)

Parameters

userId ulong

The ID of the user to remove from the thread.

properties RestRequestProperties

Optional properties to customize the request, can be null.

cancellationToken CancellationToken

A token that can be used to cancel the operation before it completes.

Returns

Task

GetAsync(RestRequestProperties?, CancellationToken)

Retrieves a channel by its ID.

public Task<GuildThread> GetAsync(RestRequestProperties? properties = null, CancellationToken cancellationToken = default)

Parameters

properties RestRequestProperties

Optional properties to customize the request, can be null.

cancellationToken CancellationToken

A token that can be used to cancel the operation before it completes.

Returns

Task<GuildThread>

GetUserAsync(ulong, bool, RestRequestProperties?, CancellationToken)

Retrieves a thread member object for a user in the thread.

public Task<ThreadUser> GetUserAsync(ulong userId, bool withGuildUser = false, RestRequestProperties? properties = null, CancellationToken cancellationToken = default)

Parameters

userId ulong

The ID of the user to fetch thread membership info for.

withGuildUser bool

Whether to include full guild member info in the response.

properties RestRequestProperties

Optional properties to customize the request, can be null.

cancellationToken CancellationToken

A token that can be used to cancel the operation before it completes.

Returns

Task<ThreadUser>

GetUsersAsync(OptionalGuildUsersPaginationProperties?, RestRequestProperties?)

Retrieves a list of users participating in a thread.

public IAsyncEnumerable<ThreadUser> GetUsersAsync(OptionalGuildUsersPaginationProperties? paginationProperties = null, RestRequestProperties? properties = null)

Parameters

paginationProperties OptionalGuildUsersPaginationProperties

Pagination options for fetching users, or null to use defaults.

properties RestRequestProperties

Optional properties to customize each request, can be null.

Returns

IAsyncEnumerable<ThreadUser>

JoinAsync(RestRequestProperties?, CancellationToken)

Joins the current user to a thread.

public Task JoinAsync(RestRequestProperties? properties = null, CancellationToken cancellationToken = default)

Parameters

properties RestRequestProperties

Optional properties to customize the request, can be null.

cancellationToken CancellationToken

A token that can be used to cancel the operation before it completes.

Returns

Task

LeaveAsync(RestRequestProperties?, CancellationToken)

Removes the current user from a thread.

public Task LeaveAsync(RestRequestProperties? properties = null, CancellationToken cancellationToken = default)

Parameters

properties RestRequestProperties

Optional properties to customize the request, can be null.

cancellationToken CancellationToken

A token that can be used to cancel the operation before it completes.

Returns

Task

ModifyAsync(Action<GuildChannelOptions>, RestRequestProperties?, CancellationToken)

Modifies a guild channel's properties.

public Task<GuildThread> ModifyAsync(Action<GuildChannelOptions> action, RestRequestProperties? properties = null, CancellationToken cancellationToken = default)

Parameters

action Action<GuildChannelOptions>

An action delegate used to configure the updated channel options.

properties RestRequestProperties

Optional properties to customize the request, can be null.

cancellationToken CancellationToken

A token that can be used to cancel the operation before it completes.

Returns

Task<GuildThread>