Class SocketThreadChannel
Represents a thread channel inside of a guild.
Assembly: Discord.Net.WebSocket.dll​
View Source​
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​
public ThreadType Type { get; }
Owner​
Gets the owner of the current thread.
View Source​
public SocketThreadUser Owner { get; }
CurrentUser​
Gets the current users within this thread.
View Source​
public SocketThreadUser CurrentUser { get; }
HasJoined​
Gets whether or not the current user has joined this thread.
View Source​
public bool HasJoined { get; }
IsPrivateThread​
true
if this thread is private, otherwise false
View Source​
public bool IsPrivateThread { get; }
ParentChannel​
Gets the parent channel this thread resides in.
View Source​
public SocketTextChannel ParentChannel { get; }
MessageCount​
Gets an approximate count of messages in a thread, stops counting after 50.
View Source​
public int MessageCount { get; }
MemberCount​
Gets an approximate count of users in a thread, stops counting after 50.
View Source​
public int MemberCount { get; }
IsArchived​
Gets whether or not the current thread is archived.
View Source​
public bool IsArchived { get; }
ArchiveTimestamp​
Gets the timestamp when the thread's archive status was last changed, used for calculating recent activity.
View Source​
public DateTimeOffset ArchiveTimestamp { get; }
AutoArchiveDuration​
Gets the duration of time before the thread is automatically archived after no activity.
View Source​
public ThreadArchiveDuration AutoArchiveDuration { get; }
IsLocked​
Gets whether or not the current thread is locked.
View Source​
public bool IsLocked { get; }
Users​
Gets a collection of cached users within this thread.
View Source​
public IReadOnlyCollection<SocketThreadUser> Users { get; }
PermissionOverwrites​
Gets a collection of permission overwrites for this channel.
View Source​
public override IReadOnlyCollection<Overwrite> PermissionOverwrites { get; }
IChannel.Name​
View Source​
string IChannel.Name { get; }
Methods​
GetUser(UInt64)​
View Source​
public SocketThreadUser GetUser(ulong id)
Returns​
Discord.WebSocket.SocketThreadUser
Parameters​
Type | Name |
---|---|
System.UInt64 | id |
GetUsersAsync(RequestOptions)​
Gets all users inside this thread.
View Source​
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​
Type | Name | Description |
---|---|---|
Discord.RequestOptions | options | The options to be used when sending the request. |
DownloadUsersAsync(RequestOptions)​
Downloads all users that have access to this thread.
View Source​
public async Task DownloadUsersAsync(RequestOptions options = null)
Returns​
System.Threading.Tasks.Task
: A task representing the asynchronous download operation.
Parameters​
Type | Name | Description |
---|---|---|
Discord.RequestOptions | options | The options to be used when sending the request. |
JoinAsync(RequestOptions)​
Joins the current thread.
View Source​
public Task JoinAsync(RequestOptions options = null)
Returns​
System.Threading.Tasks.Task
:
A task that represents the asynchronous join operation.
Parameters​
Type | Name | Description |
---|---|---|
Discord.RequestOptions | options | The options to be used when sending the request. |
LeaveAsync(RequestOptions)​
Leaves the current thread.
View Source​
public Task LeaveAsync(RequestOptions options = null)
Returns​
System.Threading.Tasks.Task
:
A task that represents the asynchronous leave operation.
Parameters​
Type | Name | Description |
---|---|---|
Discord.RequestOptions | options | The options to be used when sending the request. |
AddUserAsync(IGuildUser, RequestOptions)​
Adds a user to this thread.
View Source​
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​
Type | Name | Description |
---|---|---|
Discord.IGuildUser | user | The Discord.IGuildUser to add. |
Discord.RequestOptions | options | The options to be used when sending the request. |
RemoveUserAsync(IGuildUser, RequestOptions)​
Removes a user from this thread.
View Source​
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​
Type | Name | Description |
---|---|---|
Discord.IGuildUser | user | The Discord.IGuildUser to remove from this thread. |
Discord.RequestOptions | options | The options to be used when sending the request. |
AddPermissionOverwriteAsync(IRole, OverwritePermissions, RequestOptions)​
Adds or updates the permission overwrite for the given role.
View Source​
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​
Type | Name | Description |
---|---|---|
Discord.IRole | role | The role to add the overwrite to. |
Discord.OverwritePermissions | permissions | The overwrite to add to the role. |
Discord.RequestOptions | options | The options to be used when sending the request. |
AddPermissionOverwriteAsync(IUser, OverwritePermissions, RequestOptions)​
Adds or updates the permission overwrite for the given user.
View Source​
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​
Type | Name | Description |
---|---|---|
Discord.IUser | user | The user to add the overwrite to. |
Discord.OverwritePermissions | permissions | The overwrite to add to the user. |
Discord.RequestOptions | options | The 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​
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​
Type | Name | Description |
---|---|---|
System.Nullable<System.Int32> | maxAge | The time (in seconds) until the invite expires. Set to null to never expire. |
System.Nullable<System.Int32> | maxUses | The max amount of times this invite may be used. Set to null to have unlimited uses. |
System.Boolean | isTemporary | If true , the user accepting this invite will be kicked from the guild after closing their client. |
System.Boolean | isUnique | If true , don't try to reuse a similar invite (useful for creating many unique one time use invites). |
Discord.RequestOptions | options | The 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​
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​
Type | Name | Description |
---|---|---|
System.UInt64 | applicationId | The id of the embedded application to open for this invite. |
System.Nullable<System.Int32> | maxAge | The time (in seconds) until the invite expires. Set to null to never expire. |
System.Nullable<System.Int32> | maxUses | The max amount of times this invite may be used. Set to null to have unlimited uses. |
System.Boolean | isTemporary | If true , the user accepting this invite will be kicked from the guild after closing their client. |
System.Boolean | isUnique | If true , don't try to reuse a similar invite (useful for creating many unique one time use invites). |
Discord.RequestOptions | options | The 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​
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​
Type | Name | Description |
---|---|---|
Discord.IUser | user | The id of the user whose stream to display for this invite. |
System.Nullable<System.Int32> | maxAge | The time (in seconds) until the invite expires. Set to null to never expire. |
System.Nullable<System.Int32> | maxUses | The max amount of times this invite may be used. Set to null to have unlimited uses. |
System.Boolean | isTemporary | If true , the user accepting this invite will be kicked from the guild after closing their client. |
System.Boolean | isUnique | If true , don't try to reuse a similar invite (useful for creating many unique one time use invites). |
Discord.RequestOptions | options | The options to be used when sending the request. |
CreateWebhookAsync(String, Stream, RequestOptions)​
Creates a webhook in this text channel.
View Source​
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​
Type | Name | Description |
---|---|---|
System.String | name | The name of the webhook. |
System.IO.Stream | avatar | The avatar of the webhook. |
Discord.RequestOptions | options | The options to be used when sending the request. |
GetInvitesAsync(RequestOptions)​
Gets a collection of all invites to this channel.
View Source​
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​
Type | Name | Description |
---|---|---|
Discord.RequestOptions | options | The options to be used when sending the request. |
GetPermissionOverwrite(IRole)​
Gets the permission overwrite for a specific role.
View Source​
public override OverwritePermissions? GetPermissionOverwrite(IRole role)
Returns​
System.Nullable<Discord.OverwritePermissions>
:
An overwrite object for the targeted role; null
if none is set.
Parameters​
Type | Name | Description |
---|---|---|
Discord.IRole | role | The role to get the overwrite from. |
GetPermissionOverwrite(IUser)​
Gets the permission overwrite for a specific user.
View Source​
public override OverwritePermissions? GetPermissionOverwrite(IUser user)
Returns​
System.Nullable<Discord.OverwritePermissions>
:
An overwrite object for the targeted user; null
if none is set.
Parameters​
Type | Name | Description |
---|---|---|
Discord.IUser | user | The user to get the overwrite from. |
GetWebhookAsync(UInt64, RequestOptions)​
Gets a webhook available in this text channel.
View Source​
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​
Type | Name | Description |
---|---|---|
System.UInt64 | id | The identifier of the webhook. |
Discord.RequestOptions | options | The options to be used when sending the request. |
GetWebhooksAsync(RequestOptions)​
Gets the webhooks available in this text channel.
View Source​
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​
Type | Name | Description |
---|---|---|
Discord.RequestOptions | options | The options to be used when sending the request. |
ModifyAsync(Action<TextChannelProperties>, RequestOptions)​
Modifies this text channel.
View Source​
public override Task ModifyAsync(Action<TextChannelProperties> func, RequestOptions options = null)
Returns​
System.Threading.Tasks.Task
:
A task that represents the asynchronous modification operation.
Parameters​
Type | Name | Description |
---|---|---|
System.Action<Discord.TextChannelProperties> | func | The delegate containing the properties to modify the channel with. |
Discord.RequestOptions | options | The options to be used when sending the request. |
RemovePermissionOverwriteAsync(IRole, RequestOptions)​
Removes the permission overwrite for the given role, if one exists.
View Source​
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​
Type | Name | Description |
---|---|---|
Discord.IRole | role | The role to remove the overwrite from. |
Discord.RequestOptions | options | The options to be used when sending the request. |
RemovePermissionOverwriteAsync(IUser, RequestOptions)​
Removes the permission overwrite for the given user, if one exists.
View Source​
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​
Type | Name | Description |
---|---|---|
Discord.IUser | user | The user to remove the overwrite from. |
Discord.RequestOptions | options | The options to be used when sending the request. |
SyncPermissionsAsync(RequestOptions)​
Syncs the permissions of this nested channel with its parent's.
View Source​
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​
Type | Name | Description |
---|---|---|
Discord.RequestOptions | options | The options to be used when sending the request. |