Skip to main content

Class SocketThreadChannel

Represents a thread channel inside of a guild.

Assembly: Discord.Net.WebSocket.dll​
View Source​
Declaration
public class SocketThreadChannel : SocketTextChannel, ISocketMessageChannel, IThreadChannel, ITextChannel, IMessageChannel, IMentionable, INestedChannel, IGuildChannel, IChannel, ISnowflakeEntity, IEntity<ulong>, IDeletable

Properties​

Type​

Gets the type of the current thread channel.

View Source​
Declaration
public ThreadType Type { get; }

Owner​

Gets the owner of the current thread.

View Source​
Declaration
public SocketThreadUser Owner { get; }

CurrentUser​

Gets the current users within this thread.

View Source​
Declaration
public SocketThreadUser CurrentUser { get; }

HasJoined​

Gets whether or not the current user has joined this thread.

View Source​
Declaration
public bool HasJoined { get; }

IsPrivateThread​

true if this thread is private, otherwise false

View Source​
Declaration
public bool IsPrivateThread { get; }

ParentChannel​

Gets the parent channel this thread resides in.

View Source​
Declaration
public SocketTextChannel ParentChannel { get; }

MessageCount​

Gets an approximate count of messages in a thread, stops counting after 50.

View Source​
Declaration
public int MessageCount { get; }

MemberCount​

Gets an approximate count of users in a thread, stops counting after 50.

View Source​
Declaration
public int MemberCount { get; }

IsArchived​

Gets whether or not the current thread is archived.

View Source​
Declaration
public bool IsArchived { get; }

ArchiveTimestamp​

Gets the timestamp when the thread's archive status was last changed, used for calculating recent activity.

View Source​
Declaration
public DateTimeOffset ArchiveTimestamp { get; }

AutoArchiveDuration​

Gets the duration of time before the thread is automatically archived after no activity.

View Source​
Declaration
public ThreadArchiveDuration AutoArchiveDuration { get; }

IsLocked​

Gets whether or not the current thread is locked.

View Source​
Declaration
public bool IsLocked { get; }

Users​

Gets a collection of cached users within this thread.

View Source​
Declaration
public IReadOnlyCollection<SocketThreadUser> Users { get; }

PermissionOverwrites​

Gets a collection of permission overwrites for this channel.

View Source​
Declaration
public override IReadOnlyCollection<Overwrite> PermissionOverwrites { get; }

IChannel.Name​

View Source​
Declaration
string IChannel.Name { get; }

Methods​

GetUser(UInt64)​

View Source​
Declaration
public SocketThreadUser GetUser(ulong id)
Returns​

Discord.WebSocket.SocketThreadUser

Parameters​
TypeName
System.UInt64id

GetUsersAsync(RequestOptions)​

Gets all users inside this thread.

View Source​
Declaration
public async Task<IReadOnlyCollection<SocketThreadUser>> GetUsersAsync(RequestOptions options = null)
Returns​

System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyCollection<Discord.WebSocket.SocketThreadUser>>: A task representing the download operation.

Parameters​
TypeNameDescription
Discord.RequestOptionsoptionsThe options to be used when sending the request.

DownloadUsersAsync(RequestOptions)​

Downloads all users that have access to this thread.

View Source​
Declaration
public async Task DownloadUsersAsync(RequestOptions options = null)
Returns​

System.Threading.Tasks.Task: A task representing the asynchronous download operation.

Parameters​
TypeNameDescription
Discord.RequestOptionsoptionsThe options to be used when sending the request.

JoinAsync(RequestOptions)​

Joins the current thread.

View Source​
Declaration
public Task JoinAsync(RequestOptions options = null)
Returns​

System.Threading.Tasks.Task: A task that represents the asynchronous join operation.

Parameters​
TypeNameDescription
Discord.RequestOptionsoptionsThe options to be used when sending the request.

LeaveAsync(RequestOptions)​

Leaves the current thread.

View Source​
Declaration
public Task LeaveAsync(RequestOptions options = null)
Returns​

System.Threading.Tasks.Task: A task that represents the asynchronous leave operation.

Parameters​
TypeNameDescription
Discord.RequestOptionsoptionsThe options to be used when sending the request.

AddUserAsync(IGuildUser, RequestOptions)​

Adds a user to this thread.

View Source​
Declaration
public Task AddUserAsync(IGuildUser user, RequestOptions options = null)
Returns​

System.Threading.Tasks.Task: A task that represents the asynchronous operation of adding a member to a thread.

Parameters​
TypeNameDescription
Discord.IGuildUseruserThe Discord.IGuildUser to add.
Discord.RequestOptionsoptionsThe options to be used when sending the request.

RemoveUserAsync(IGuildUser, RequestOptions)​

Removes a user from this thread.

View Source​
Declaration
public Task RemoveUserAsync(IGuildUser user, RequestOptions options = null)
Returns​

System.Threading.Tasks.Task: A task that represents the asynchronous operation of removing a user from this thread.

Parameters​
TypeNameDescription
Discord.IGuildUseruserThe Discord.IGuildUser to remove from this thread.
Discord.RequestOptionsoptionsThe options to be used when sending the request.

AddPermissionOverwriteAsync(IRole, OverwritePermissions, RequestOptions)​

Adds or updates the permission overwrite for the given role.

View Source​
Declaration
public override Task AddPermissionOverwriteAsync(IRole role, OverwritePermissions permissions, RequestOptions options = null)
Returns​

System.Threading.Tasks.Task: A task representing the asynchronous permission operation for adding the specified permissions to the channel.

Parameters​
TypeNameDescription
Discord.IRoleroleThe role to add the overwrite to.
Discord.OverwritePermissionspermissionsThe overwrite to add to the role.
Discord.RequestOptionsoptionsThe options to be used when sending the request.

AddPermissionOverwriteAsync(IUser, OverwritePermissions, RequestOptions)​

Adds or updates the permission overwrite for the given user.

View Source​
Declaration
public override Task AddPermissionOverwriteAsync(IUser user, OverwritePermissions permissions, RequestOptions options = null)
Returns​

System.Threading.Tasks.Task: A task representing the asynchronous permission operation for adding the specified permissions to the channel.

Parameters​
TypeNameDescription
Discord.IUseruserThe user to add the overwrite to.
Discord.OverwritePermissionspermissionsThe overwrite to add to the user.
Discord.RequestOptionsoptionsThe options to be used when sending the request.

CreateInviteAsync(Nullable<Int32>, Nullable<Int32>, Boolean, Boolean, RequestOptions)​

Creates a new invite to this channel.

View Source​
Declaration
public override Task<IInviteMetadata> CreateInviteAsync(int? maxAge = 86400, int? maxUses = null, bool isTemporary = false, bool isUnique = false, RequestOptions options = null)
Returns​

System.Threading.Tasks.Task<Discord.IInviteMetadata>: A task that represents the asynchronous invite creation operation. The task result contains an invite metadata object containing information for the created invite.

Parameters​
TypeNameDescription
System.Nullable<System.Int32>maxAgeThe time (in seconds) until the invite expires. Set to null to never expire.
System.Nullable<System.Int32>maxUsesThe max amount of times this invite may be used. Set to null to have unlimited uses.
System.BooleanisTemporaryIf true, the user accepting this invite will be kicked from the guild after closing their client.
System.BooleanisUniqueIf true, don't try to reuse a similar invite (useful for creating many unique one time use invites).
Discord.RequestOptionsoptionsThe options to be used when sending the request.

CreateInviteToApplicationAsync(UInt64, Nullable<Int32>, Nullable<Int32>, Boolean, Boolean, RequestOptions)​

Creates a new invite to this channel.

View Source​
Declaration
public override Task<IInviteMetadata> CreateInviteToApplicationAsync(ulong applicationId, int? maxAge, int? maxUses = null, bool isTemporary = false, bool isUnique = false, RequestOptions options = null)
Returns​

System.Threading.Tasks.Task<Discord.IInviteMetadata>: A task that represents the asynchronous invite creation operation. The task result contains an invite metadata object containing information for the created invite.

Parameters​
TypeNameDescription
System.UInt64applicationIdThe id of the embedded application to open for this invite.
System.Nullable<System.Int32>maxAgeThe time (in seconds) until the invite expires. Set to null to never expire.
System.Nullable<System.Int32>maxUsesThe max amount of times this invite may be used. Set to null to have unlimited uses.
System.BooleanisTemporaryIf true, the user accepting this invite will be kicked from the guild after closing their client.
System.BooleanisUniqueIf true, don't try to reuse a similar invite (useful for creating many unique one time use invites).
Discord.RequestOptionsoptionsThe options to be used when sending the request.

CreateInviteToStreamAsync(IUser, Nullable<Int32>, Nullable<Int32>, Boolean, Boolean, RequestOptions)​

Creates a new invite to this channel.

View Source​
Declaration
public override Task<IInviteMetadata> CreateInviteToStreamAsync(IUser user, int? maxAge, int? maxUses = null, bool isTemporary = false, bool isUnique = false, RequestOptions options = null)
Returns​

System.Threading.Tasks.Task<Discord.IInviteMetadata>: A task that represents the asynchronous invite creation operation. The task result contains an invite metadata object containing information for the created invite.

Parameters​
TypeNameDescription
Discord.IUseruserThe id of the user whose stream to display for this invite.
System.Nullable<System.Int32>maxAgeThe time (in seconds) until the invite expires. Set to null to never expire.
System.Nullable<System.Int32>maxUsesThe max amount of times this invite may be used. Set to null to have unlimited uses.
System.BooleanisTemporaryIf true, the user accepting this invite will be kicked from the guild after closing their client.
System.BooleanisUniqueIf true, don't try to reuse a similar invite (useful for creating many unique one time use invites).
Discord.RequestOptionsoptionsThe options to be used when sending the request.

CreateWebhookAsync(String, Stream, RequestOptions)​

Creates a webhook in this text channel.

View Source​
Declaration
public override Task<RestWebhook> CreateWebhookAsync(string name, Stream avatar = null, RequestOptions options = null)
Returns​

System.Threading.Tasks.Task<Discord.Rest.RestWebhook>: A task that represents the asynchronous creation operation. The task result contains the newly created webhook.

Parameters​
TypeNameDescription
System.StringnameThe name of the webhook.
System.IO.StreamavatarThe avatar of the webhook.
Discord.RequestOptionsoptionsThe options to be used when sending the request.

GetInvitesAsync(RequestOptions)​

Gets a collection of all invites to this channel.

View Source​
Declaration
public override Task<IReadOnlyCollection<IInviteMetadata>> GetInvitesAsync(RequestOptions options = null)
Returns​

System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyCollection<Discord.IInviteMetadata>>: A task that represents the asynchronous get operation. The task result contains a read-only collection of invite metadata that are created for this channel.

Parameters​
TypeNameDescription
Discord.RequestOptionsoptionsThe options to be used when sending the request.

GetPermissionOverwrite(IRole)​

Gets the permission overwrite for a specific role.

View Source​
Declaration
public override OverwritePermissions? GetPermissionOverwrite(IRole role)
Returns​

System.Nullable<Discord.OverwritePermissions>: An overwrite object for the targeted role; null if none is set.

Parameters​
TypeNameDescription
Discord.IRoleroleThe role to get the overwrite from.

GetPermissionOverwrite(IUser)​

Gets the permission overwrite for a specific user.

View Source​
Declaration
public override OverwritePermissions? GetPermissionOverwrite(IUser user)
Returns​

System.Nullable<Discord.OverwritePermissions>: An overwrite object for the targeted user; null if none is set.

Parameters​
TypeNameDescription
Discord.IUseruserThe user to get the overwrite from.

GetWebhookAsync(UInt64, RequestOptions)​

Gets a webhook available in this text channel.

View Source​
Declaration
public override Task<RestWebhook> GetWebhookAsync(ulong id, RequestOptions options = null)
Returns​

System.Threading.Tasks.Task<Discord.Rest.RestWebhook>: A task that represents the asynchronous get operation. The task result contains a webhook associated with the identifier; null if the webhook is not found.

Parameters​
TypeNameDescription
System.UInt64idThe identifier of the webhook.
Discord.RequestOptionsoptionsThe options to be used when sending the request.

GetWebhooksAsync(RequestOptions)​

Gets the webhooks available in this text channel.

View Source​
Declaration
public override Task<IReadOnlyCollection<RestWebhook>> GetWebhooksAsync(RequestOptions options = null)
Returns​

System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyCollection<Discord.Rest.RestWebhook>>: A task that represents the asynchronous get operation. The task result contains a read-only collection of webhooks that is available in this channel.

Parameters​
TypeNameDescription
Discord.RequestOptionsoptionsThe options to be used when sending the request.

ModifyAsync(Action<TextChannelProperties>, RequestOptions)​

Modifies this text channel.

View Source​
Declaration
public override Task ModifyAsync(Action<TextChannelProperties> func, RequestOptions options = null)
Returns​

System.Threading.Tasks.Task: A task that represents the asynchronous modification operation.

Parameters​
TypeNameDescription
System.Action<Discord.TextChannelProperties>funcThe delegate containing the properties to modify the channel with.
Discord.RequestOptionsoptionsThe options to be used when sending the request.

RemovePermissionOverwriteAsync(IRole, RequestOptions)​

Removes the permission overwrite for the given role, if one exists.

View Source​
Declaration
public override Task RemovePermissionOverwriteAsync(IRole role, RequestOptions options = null)
Returns​

System.Threading.Tasks.Task: A task representing the asynchronous operation for removing the specified permissions from the channel.

Parameters​
TypeNameDescription
Discord.IRoleroleThe role to remove the overwrite from.
Discord.RequestOptionsoptionsThe options to be used when sending the request.

RemovePermissionOverwriteAsync(IUser, RequestOptions)​

Removes the permission overwrite for the given user, if one exists.

View Source​
Declaration
public override Task RemovePermissionOverwriteAsync(IUser user, RequestOptions options = null)
Returns​

System.Threading.Tasks.Task: A task representing the asynchronous operation for removing the specified permissions from the channel.

Parameters​
TypeNameDescription
Discord.IUseruserThe user to remove the overwrite from.
Discord.RequestOptionsoptionsThe options to be used when sending the request.

SyncPermissionsAsync(RequestOptions)​

Syncs the permissions of this nested channel with its parent's.

View Source​
Declaration
public override Task SyncPermissionsAsync(RequestOptions options = null)
Returns​

System.Threading.Tasks.Task: A task that represents the asynchronous operation for syncing channel permissions with its parent's.

Parameters​
TypeNameDescription
Discord.RequestOptionsoptionsThe options to be used when sending the request.

Implements​