Class SocketThreadChannel
Represents a thread channel inside of a guild.
public class SocketThreadChannel : SocketTextChannel, ISocketMessageChannel, IThreadChannel, ITextChannel, IMessageChannel, IMentionable, INestedChannel, IIntegrationChannel, IGuildChannel, IChannel, ISnowflakeEntity, IEntity<ulong>, IDeletable
- Inheritance
-
SocketThreadChannel
- Implements
- Inherited Members
- Extension Methods
Properties
AppliedTags
Gets ids of tags applied to a forum thread
public IReadOnlyCollection<ulong> AppliedTags { get; }
Property Value
Remarks
This property is only available on forum threads.
ArchiveTimestamp
Gets the timestamp when the thread's archive status was last changed, used for calculating recent activity.
public DateTimeOffset ArchiveTimestamp { get; }
Property Value
AutoArchiveDuration
Gets the duration of time before the thread is automatically archived after no activity.
public ThreadArchiveDuration AutoArchiveDuration { get; }
Property Value
CreatedAt
Gets when the thread was created.
public override DateTimeOffset CreatedAt { get; }
Property Value
Remarks
This property is only populated for threads created after 2022-01-09, hence the default date of this property will be that date.
CurrentUser
Gets the current users within this thread.
public SocketThreadUser CurrentUser { get; }
Property Value
HasJoined
Gets whether or not the current user has joined this thread.
public bool HasJoined { get; }
Property Value
IsArchived
Gets whether or not the current thread is archived.
public bool IsArchived { get; }
Property Value
IsInvitable
Gets whether non-moderators can add other non-moderators to a thread.
public bool? IsInvitable { get; }
Property Value
- bool?
Remarks
This property is only available on private threads.
IsLocked
Gets whether or not the current thread is locked.
public bool IsLocked { get; }
Property Value
IsPrivateThread
public bool IsPrivateThread { get; }
Property Value
MemberCount
Gets an approximate count of users in a thread, stops counting after 50.
public int MemberCount { get; }
Property Value
MessageCount
Gets an approximate count of messages in a thread, stops counting after 50.
public int MessageCount { get; }
Property Value
Owner
Gets the owner of the current thread.
public SocketThreadUser Owner { get; }
Property Value
ParentChannel
Gets the parent channel this thread resides in.
public SocketGuildChannel ParentChannel { get; }
Property Value
PermissionOverwrites
Gets a collection of permission overwrites for this channel.
public override IReadOnlyCollection<Overwrite> PermissionOverwrites { get; }
Property Value
- IReadOnlyCollection<Overwrite>
A collection of overwrites associated with this channel.
Remarks
This method is not supported in threads.
Type
Gets the type of the current thread channel.
public ThreadType Type { get; }
Property Value
Users
Gets a collection of cached users within this thread.
public IReadOnlyCollection<SocketThreadUser> Users { get; }
Property Value
Methods
AddPermissionOverwriteAsync(IRole, OverwritePermissions, RequestOptions)
Adds or updates the permission overwrite for the given role.
public override Task AddPermissionOverwriteAsync(IRole role, OverwritePermissions permissions, RequestOptions options = null)
Parameters
role
IRoleThe role to add the overwrite to.
permissions
OverwritePermissionsThe overwrite to add to the role.
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task
A task representing the asynchronous permission operation for adding the specified permissions to the channel.
Remarks
This method is not supported in threads.
AddPermissionOverwriteAsync(IUser, OverwritePermissions, RequestOptions)
Adds or updates the permission overwrite for the given user.
public override Task AddPermissionOverwriteAsync(IUser user, OverwritePermissions permissions, RequestOptions options = null)
Parameters
user
IUserThe user to add the overwrite to.
permissions
OverwritePermissionsThe overwrite to add to the user.
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task
A task representing the asynchronous permission operation for adding the specified permissions to the channel.
Remarks
This method is not supported in threads.
AddUserAsync(IGuildUser, RequestOptions)
Adds a user to this thread.
public Task AddUserAsync(IGuildUser user, RequestOptions options = null)
Parameters
user
IGuildUserThe IGuildUser to add.
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task
A task that represents the asynchronous operation of adding a member to a thread.
CreateInviteAsync(int?, int?, bool, bool, RequestOptions)
Creates a new invite to this channel.
public override Task<IInviteMetadata> CreateInviteAsync(int? maxAge = 86400, int? maxUses = null, bool isTemporary = false, bool isUnique = false, RequestOptions options = null)
Parameters
maxAge
int?The time (in seconds) until the invite expires. Set to null to never expire.
maxUses
int?The max amount of times this invite may be used. Set to null to have unlimited uses.
isTemporary
boolIf true, the user accepting this invite will be kicked from the guild after closing their client.
isUnique
boolIf true, don't try to reuse a similar invite (useful for creating many unique one time use invites).
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task<IInviteMetadata>
A task that represents the asynchronous invite creation operation. The task result contains an invite metadata object containing information for the created invite.
Examples
The following example creates a new invite to this channel; the invite lasts for 12 hours and can only be used 3 times throughout its lifespan.
await guildChannel.CreateInviteAsync(maxAge: 43200, maxUses: 3);
Remarks
This method is not supported in threads.
CreateInviteToApplicationAsync(ulong, int?, int?, bool, bool, RequestOptions)
Creates a new invite to this channel.
public override Task<IInviteMetadata> CreateInviteToApplicationAsync(ulong applicationId, int? maxAge, int? maxUses = null, bool isTemporary = false, bool isUnique = false, RequestOptions options = null)
Parameters
applicationId
ulongThe id of the embedded application to open for this invite.
maxAge
int?The time (in seconds) until the invite expires. Set to null to never expire.
maxUses
int?The max amount of times this invite may be used. Set to null to have unlimited uses.
isTemporary
boolIf true, the user accepting this invite will be kicked from the guild after closing their client.
isUnique
boolIf true, don't try to reuse a similar invite (useful for creating many unique one time use invites).
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task<IInviteMetadata>
A task that represents the asynchronous invite creation operation. The task result contains an invite metadata object containing information for the created invite.
Remarks
This method is not supported in threads.
CreateInviteToStreamAsync(IUser, int?, int?, bool, bool, RequestOptions)
Creates a new invite to this channel.
public override Task<IInviteMetadata> CreateInviteToStreamAsync(IUser user, int? maxAge, int? maxUses = null, bool isTemporary = false, bool isUnique = false, RequestOptions options = null)
Parameters
user
IUserThe id of the user whose stream to display for this invite.
maxAge
int?The time (in seconds) until the invite expires. Set to null to never expire.
maxUses
int?The max amount of times this invite may be used. Set to null to have unlimited uses.
isTemporary
boolIf true, the user accepting this invite will be kicked from the guild after closing their client.
isUnique
boolIf true, don't try to reuse a similar invite (useful for creating many unique one time use invites).
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task<IInviteMetadata>
A task that represents the asynchronous invite creation operation. The task result contains an invite metadata object containing information for the created invite.
Examples
The following example creates a new invite to this channel; the invite lasts for 12 hours and can only be used 3 times throughout its lifespan.
await guildChannel.CreateInviteAsync(maxAge: 43200, maxUses: 3);
Remarks
This method is not supported in threads.
CreateWebhookAsync(string, Stream, RequestOptions)
Creates a webhook in this text channel.
public override Task<RestWebhook> CreateWebhookAsync(string name, Stream avatar = null, RequestOptions options = null)
Parameters
name
stringThe name of the webhook.
avatar
StreamThe avatar of the webhook.
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task<RestWebhook>
A task that represents the asynchronous creation operation. The task result contains the newly created webhook.
Remarks
This method is not supported in threads.
DownloadUsersAsync(RequestOptions)
Downloads all users that have access to this thread.
public Task DownloadUsersAsync(RequestOptions options = null)
Parameters
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task
A task representing the asynchronous download operation.
GetActiveThreadsAsync(RequestOptions)
Gets a collection of active threads within this channel.
public override Task<IReadOnlyCollection<RestThreadChannel>> GetActiveThreadsAsync(RequestOptions options = null)
Parameters
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task<IReadOnlyCollection<RestThreadChannel>>
A task that represents an asynchronous get operation for retrieving the threads. The task result contains a collection of active threads.
Exceptions
- NotSupportedException
This method is not supported in threads.
GetInvitesAsync(RequestOptions)
Gets a collection of all invites to this channel.
public override Task<IReadOnlyCollection<IInviteMetadata>> GetInvitesAsync(RequestOptions options = null)
Parameters
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task<IReadOnlyCollection<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.
Examples
The following example gets all of the invites that have been created in this channel and selects the most used invite.
var invites = await channel.GetInvitesAsync();
if (invites.Count == 0) return;
var invite = invites.OrderByDescending(x => x.Uses).FirstOrDefault();
Remarks
This method is not supported in threads.
GetPermissionOverwrite(IRole)
Gets the permission overwrite for a specific role.
public override OverwritePermissions? GetPermissionOverwrite(IRole role)
Parameters
role
IRoleThe role to get the overwrite from.
Returns
- OverwritePermissions?
An overwrite object for the targeted role; null if none is set.
Remarks
This method is not supported in threads.
GetPermissionOverwrite(IUser)
Gets the permission overwrite for a specific user.
public override OverwritePermissions? GetPermissionOverwrite(IUser user)
Parameters
user
IUserThe user to get the overwrite from.
Returns
- OverwritePermissions?
An overwrite object for the targeted user; null if none is set.
Remarks
This method is not supported in threads.
GetUser(ulong)
public SocketThreadUser GetUser(ulong id)
Parameters
id
ulong
Returns
GetUsersAsync(RequestOptions)
Gets all users inside this thread.
public Task<IReadOnlyCollection<SocketThreadUser>> GetUsersAsync(RequestOptions options = null)
Parameters
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task<IReadOnlyCollection<SocketThreadUser>>
A task representing the download operation.
Remarks
If all users are not downloaded then this method will call DownloadUsersAsync(RequestOptions) and return the result.
GetWebhookAsync(ulong, RequestOptions)
Gets a webhook available in this text channel.
public override Task<RestWebhook> GetWebhookAsync(ulong id, RequestOptions options = null)
Parameters
id
ulongThe identifier of the webhook.
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task<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.
Remarks
This method is not supported in threads.
GetWebhooksAsync(RequestOptions)
Gets the webhooks available in this text channel.
public override Task<IReadOnlyCollection<RestWebhook>> GetWebhooksAsync(RequestOptions options = null)
Parameters
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task<IReadOnlyCollection<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.
Remarks
This method is not supported in threads.
JoinAsync(RequestOptions)
Joins the current thread.
public Task JoinAsync(RequestOptions options = null)
Parameters
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task
A task that represents the asynchronous join operation.
LeaveAsync(RequestOptions)
Leaves the current thread.
public Task LeaveAsync(RequestOptions options = null)
Parameters
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task
A task that represents the asynchronous leave operation.
ModifyAsync(Action<TextChannelProperties>, RequestOptions)
Modifies this text channel.
public override Task ModifyAsync(Action<TextChannelProperties> func, RequestOptions options = null)
Parameters
func
Action<TextChannelProperties>The delegate containing the properties to modify the channel with.
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task
A task that represents the asynchronous modification operation.
- See Also
ModifyAsync(Action<ThreadChannelProperties>, RequestOptions)
Modifies this thread channel.
public Task ModifyAsync(Action<ThreadChannelProperties> func, RequestOptions options = null)
Parameters
func
Action<ThreadChannelProperties>The delegate containing the properties to modify the channel with.
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task
A task that represents the asynchronous modification operation.
- See Also
RemovePermissionOverwriteAsync(IRole, RequestOptions)
Removes the permission overwrite for the given role, if one exists.
public override Task RemovePermissionOverwriteAsync(IRole role, RequestOptions options = null)
Parameters
role
IRoleThe role to remove the overwrite from.
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task
A task representing the asynchronous operation for removing the specified permissions from the channel.
Remarks
This method is not supported in threads.
RemovePermissionOverwriteAsync(IUser, RequestOptions)
Removes the permission overwrite for the given user, if one exists.
public override Task RemovePermissionOverwriteAsync(IUser user, RequestOptions options = null)
Parameters
user
IUserThe user to remove the overwrite from.
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task
A task representing the asynchronous operation for removing the specified permissions from the channel.
Remarks
This method is not supported in threads.
RemoveUserAsync(IGuildUser, RequestOptions)
Removes a user from this thread.
public Task RemoveUserAsync(IGuildUser user, RequestOptions options = null)
Parameters
user
IGuildUserThe IGuildUser to remove from this thread.
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task
A task that represents the asynchronous operation of removing a user from this thread.
SyncPermissionsAsync(RequestOptions)
Syncs the permissions of this nested channel with its parent's.
public override Task SyncPermissionsAsync(RequestOptions options = null)
Parameters
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task
A task that represents the asynchronous operation for syncing channel permissions with its parent's.
Remarks
This method is not supported in threads.