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
jsonModelJsonChannelclientRestClient
Properties
CurrentUser
A minimal thread user object for the current user, if they have joined the thread.
public ThreadCurrentUser? CurrentUser { get; set; }
Property Value
MessageCount
The number of messages within the thread, excluding the initial and deleted messages.
public int MessageCount { get; }
Property Value
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
OwnerId
The ID of the thread's creator.
public ulong OwnerId { get; }
Property Value
ParentId
The ID of the TextGuildChannel this thread was created in.
public ulong ParentId { get; }
Property Value
TotalMessageSent
The total number of messages sent in the thread, including deletions.
public int TotalMessageSent { get; }
Property Value
UserCount
An approximation of the number of users within the thread. Stops counting at 50 users.
public int UserCount { get; }
Property Value
Methods
AddUserAsync(ulong, RestRequestProperties?, CancellationToken)
Adds another user to a thread.
public Task AddUserAsync(ulong userId, RestRequestProperties? properties = null, CancellationToken cancellationToken = default)
Parameters
userIdulongThe ID of the user to add to the thread.
propertiesRestRequestPropertiesOptional properties to customize the request, can be null.
cancellationTokenCancellationTokenA token that can be used to cancel the operation before it completes.
Returns
CreateFromJson(JsonChannel, RestClient)
public static GuildThread CreateFromJson(JsonChannel jsonChannel, RestClient client)
Parameters
jsonChannelJsonChannelclientRestClient
Returns
DeleteAsync(RestRequestProperties?, CancellationToken)
Deletes a channel.
public Task<GuildThread> DeleteAsync(RestRequestProperties? properties = null, CancellationToken cancellationToken = default)
Parameters
propertiesRestRequestPropertiesOptional properties to customize the request, can be null.
cancellationTokenCancellationTokenA token that can be used to cancel the operation before it completes.
Returns
DeleteUserAsync(ulong, RestRequestProperties?, CancellationToken)
Removes a user from a thread.
public Task DeleteUserAsync(ulong userId, RestRequestProperties? properties = null, CancellationToken cancellationToken = default)
Parameters
userIdulongThe ID of the user to remove from the thread.
propertiesRestRequestPropertiesOptional properties to customize the request, can be null.
cancellationTokenCancellationTokenA token that can be used to cancel the operation before it completes.
Returns
GetAsync(RestRequestProperties?, CancellationToken)
Retrieves a channel by its ID.
public Task<GuildThread> GetAsync(RestRequestProperties? properties = null, CancellationToken cancellationToken = default)
Parameters
propertiesRestRequestPropertiesOptional properties to customize the request, can be null.
cancellationTokenCancellationTokenA token that can be used to cancel the operation before it completes.
Returns
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
userIdulongThe ID of the user to fetch thread membership info for.
withGuildUserboolWhether to include full guild member info in the response.
propertiesRestRequestPropertiesOptional properties to customize the request, can be null.
cancellationTokenCancellationTokenA token that can be used to cancel the operation before it completes.
Returns
GetUsersAsync(OptionalGuildUsersPaginationProperties?, RestRequestProperties?)
Retrieves a list of users participating in a thread.
public IAsyncEnumerable<ThreadUser> GetUsersAsync(OptionalGuildUsersPaginationProperties? paginationProperties = null, RestRequestProperties? properties = null)
Parameters
paginationPropertiesOptionalGuildUsersPaginationPropertiesPagination options for fetching users, or null to use defaults.
propertiesRestRequestPropertiesOptional properties to customize each request, can be null.
Returns
JoinAsync(RestRequestProperties?, CancellationToken)
Joins the current user to a thread.
public Task JoinAsync(RestRequestProperties? properties = null, CancellationToken cancellationToken = default)
Parameters
propertiesRestRequestPropertiesOptional properties to customize the request, can be null.
cancellationTokenCancellationTokenA token that can be used to cancel the operation before it completes.
Returns
LeaveAsync(RestRequestProperties?, CancellationToken)
Removes the current user from a thread.
public Task LeaveAsync(RestRequestProperties? properties = null, CancellationToken cancellationToken = default)
Parameters
propertiesRestRequestPropertiesOptional properties to customize the request, can be null.
cancellationTokenCancellationTokenA token that can be used to cancel the operation before it completes.
Returns
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
actionAction<GuildChannelOptions>An action delegate used to configure the updated channel options.
propertiesRestRequestPropertiesOptional properties to customize the request, can be null.
cancellationTokenCancellationTokenA token that can be used to cancel the operation before it completes.