Class RestThreadChannel
Represents a thread channel received over REST.
Assembly: Discord.Net.Rest.dll​
View Source​
public class RestThreadChannel : RestTextChannel, IUpdateable, IRestMessageChannel, IThreadChannel, ITextChannel, IMessageChannel, IMentionable, INestedChannel, IGuildChannel, IChannel, ISnowflakeEntity, IEntity<ulong>, IDeletable
Properties​
Type​
View Source​
public ThreadType Type { get; }
HasJoined​
Gets whether or not the current user has joined this thread.
View Source​
public bool HasJoined { get; }
IsArchived​
Gets whether or not the current thread is archived.
View Source​
public bool IsArchived { get; }
AutoArchiveDuration​
Gets the duration of time before the thread is automatically archived after no activity.
View Source​
public ThreadArchiveDuration AutoArchiveDuration { 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; }
IsLocked​
Gets whether or not the current thread is locked.
View Source​
public bool IsLocked { get; }
MemberCount​
Gets an approximate count of users in a thread, stops counting after 50.
View Source​
public int MemberCount { get; }
MessageCount​
Gets an approximate count of messages in a thread, stops counting after 50.
View Source​
public int MessageCount { get; }
ParentChannelId​
Gets the parent text channel id.
View Source​
public ulong ParentChannelId { get; }
PermissionOverwrites​
Gets a collection of permission overwrites for this channel.
View Source​
public override IReadOnlyCollection<Overwrite> PermissionOverwrites { get; }
Methods​
GetUserAsync(UInt64, RequestOptions)​
Gets a user within this thread.
View Source​
public Task<RestThreadUser> GetUserAsync(ulong userId, RequestOptions options = null)
Returns​
System.Threading.Tasks.Task<Discord.Rest.RestThreadUser>
:
A task representing the asynchronous get operation. The task returns a
Discord.Rest.RestThreadUser if found, otherwise null
.
Parameters​
Type | Name | Description |
---|---|---|
System.UInt64 | userId | The id of the user to fetch. |
Discord.RequestOptions | options | The options to be used when sending the request. |
GetUsersAsync(RequestOptions)​
Gets a collection of users within this thread.
View Source​
public async Task<IReadOnlyCollection<RestThreadUser>> GetUsersAsync(RequestOptions options = null)
Returns​
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyCollection<Discord.Rest.RestThreadUser>>
:
A task representing the asynchronous get operation. The task returns a
System.Collections.Generic.IReadOnlyCollection%601
of Discord.Rest.RestThreadUser's.
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 async 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. |
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. |
GetCategoryAsync(RequestOptions)​
Gets the parent (category) channel of this channel.
View Source​
public override Task<ICategoryChannel> GetCategoryAsync(RequestOptions options = null)
Returns​
System.Threading.Tasks.Task<Discord.ICategoryChannel>
:
A task that represents the asynchronous get operation. The task result contains the category channel
representing the parent of this channel; null
if none is set.
Parameters​
Type | Name | Description |
---|---|---|
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. |
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. |
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. |