Class TextGuildChannel
- Namespace
- NetCord
- Assembly
- NetCord.dll
Represents a text channel within a guild.
public class TextGuildChannel : TextChannel, IEquatable<Entity>, IJsonModel<JsonChannel>, IInteractionChannel, IGuildChannel, INamedChannel, IEntity, ISpanFormattable, IFormattable
- Inheritance
-
TextGuildChannel
- Implements
- Derived
- Inherited Members
Constructors
TextGuildChannel(JsonChannel, ulong, RestClient)
Represents a text channel within a guild.
public TextGuildChannel(JsonChannel jsonModel, ulong guildId, RestClient client)
Parameters
jsonModelJsonChannelguildIdulongclientRestClient
Properties
DefaultAutoArchiveDuration
The default duration for which threads within the channel must be inactive, before auto-archiving occurs.
public ThreadArchiveDuration? DefaultAutoArchiveDuration { get; }
Property Value
DefaultThreadSlowmode
The default slowmode duration for threads within the channel.
public int DefaultThreadSlowmode { get; }
Property Value
GuildId
The ID corresponding to the channel's parent guild.
public ulong GuildId { get; }
Property Value
Name
The name of the channel object, between 1 and 100 characters.
public string Name { get; }
Property Value
Nsfw
Whether the channel is age-restricted.
public bool Nsfw { get; }
Property Value
ParentId
The ID of the channel's parent channel.
public ulong? ParentId { get; }
Property Value
Remarks
If the channel is a thread, the ID corresponds to the thread's parent channel.
PermissionOverwrites
A list of explicit permission overwrites for specified members and roles.
public IReadOnlyDictionary<ulong, PermissionOverwrite> PermissionOverwrites { get; }
Property Value
Position
The channel's position within the guild channel list.
public int? Position { get; }
Property Value
- int?
Remarks
If two or more channels share a position, they are instead sorted by their ID.
Slowmode
The number of seconds a user has to wait before sending another message, between 0 and 21600 (6 hours).
public int Slowmode { get; }
Property Value
Remarks
Bots, and users with the BypassSlowmode permission are unaffected.
Topic
The channel topic, between 0 and 1024 characters. Can be null.
public string? Topic { get; }
Property Value
Methods
CreateGuildThreadAsync(GuildThreadProperties, RestRequestProperties?, CancellationToken)
Creates a standalone thread in a text channel.
public Task<GuildThread> CreateGuildThreadAsync(GuildThreadProperties threadProperties, RestRequestProperties? properties = null, CancellationToken cancellationToken = default)
Parameters
threadPropertiesGuildThreadPropertiesThe properties of the thread to create.
propertiesRestRequestPropertiesOptional properties to customize the request, can be null.
cancellationTokenCancellationTokenA token that can be used to cancel the operation before it completes.
Returns
CreateGuildThreadAsync(ulong, GuildThreadFromMessageProperties, RestRequestProperties?, CancellationToken)
Creates a thread from an existing message in a text channel.
public Task<GuildThread> CreateGuildThreadAsync(ulong messageId, GuildThreadFromMessageProperties threadFromMessageProperties, RestRequestProperties? properties = null, CancellationToken cancellationToken = default)
Parameters
messageIdulongThe ID of the message to start the thread from.
threadFromMessagePropertiesGuildThreadFromMessagePropertiesThe properties of the thread to create.
propertiesRestRequestPropertiesOptional properties to customize the request, can be null.
cancellationTokenCancellationTokenA token that can be used to cancel the operation before it completes.
Returns
CreateInviteAsync(InviteProperties?, RestRequestProperties?, CancellationToken)
Creates a new invite for a guild channel.
public Task<RestInvite> CreateInviteAsync(InviteProperties? inviteProperties = null, RestRequestProperties? properties = null, CancellationToken cancellationToken = default)
Parameters
invitePropertiesInvitePropertiesThe properties to configure the new invite. Can be null for defaults.
propertiesRestRequestPropertiesOptional properties to customize the request, can be null.
cancellationTokenCancellationTokenA token that can be used to cancel the operation before it completes.
Returns
CreateWebhookAsync(WebhookProperties, RestRequestProperties?, CancellationToken)
Creates a new webhook, and returns an IncomingWebhook object on success.
public Task<IncomingWebhook> CreateWebhookAsync(WebhookProperties webhookProperties, RestRequestProperties? properties = null, CancellationToken cancellationToken = default)
Parameters
webhookPropertiesWebhookPropertiesProperties to customize the webhook's appearance.
propertiesRestRequestPropertiesOptional properties to customize the request, can be null.
cancellationTokenCancellationTokenA token that can be used to cancel the operation before it completes.
Returns
Remarks
Fires a WebhooksUpdate event.
DeleteAsync(RestRequestProperties?, CancellationToken)
Deletes a channel.
public Task<TextGuildChannel> 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
DeletePermissionAsync(ulong, RestRequestProperties?, CancellationToken)
Deletes a permission overwrite for a user or role in a guild channel.
public Task DeletePermissionAsync(ulong overwriteId, RestRequestProperties? properties = null, CancellationToken cancellationToken = default)
Parameters
overwriteIdulongThe ID of the role or user whose permission overwrite is to be deleted.
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<TextGuildChannel> 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
GetChannelWebhooksAsync(RestRequestProperties?, CancellationToken)
Returns a list of channel Webhook objects.
public Task<IReadOnlyList<Webhook>> GetChannelWebhooksAsync(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
GetInvitesAsync(RestRequestProperties?, CancellationToken)
Retrieves a list of active invites for a guild channel.
public Task<IReadOnlyList<RestInvite>> GetInvitesAsync(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
GetJoinedPrivateArchivedGuildThreadsAsync(PaginationProperties<ulong>?, RestRequestProperties?)
Retrieves private archived threads joined by the current user.
public IAsyncEnumerable<GuildThread> GetJoinedPrivateArchivedGuildThreadsAsync(PaginationProperties<ulong>? paginationProperties = null, RestRequestProperties? properties = null)
Parameters
paginationPropertiesPaginationProperties<ulong>Pagination options for archived threads, or null to use defaults.
propertiesRestRequestPropertiesOptional properties to customize each request, can be null.
Returns
GetPrivateArchivedGuildThreadsAsync(PaginationProperties<DateTimeOffset>?, RestRequestProperties?)
Retrieves private archived threads in the channel.
public IAsyncEnumerable<GuildThread> GetPrivateArchivedGuildThreadsAsync(PaginationProperties<DateTimeOffset>? paginationProperties = null, RestRequestProperties? properties = null)
Parameters
paginationPropertiesPaginationProperties<DateTimeOffset>Pagination options for archived threads, or null to use defaults.
propertiesRestRequestPropertiesOptional properties to customize each request, can be null.
Returns
GetPublicArchivedGuildThreadsAsync(PaginationProperties<DateTimeOffset>?, RestRequestProperties?)
Retrieves public archived threads in the channel.
public IAsyncEnumerable<GuildThread> GetPublicArchivedGuildThreadsAsync(PaginationProperties<DateTimeOffset>? paginationProperties = null, RestRequestProperties? properties = null)
Parameters
paginationPropertiesPaginationProperties<DateTimeOffset>Pagination options for archived threads, or null to use defaults.
propertiesRestRequestPropertiesOptional properties to customize each request, can be null.
Returns
ModifyAsync(Action<GuildChannelOptions>, RestRequestProperties?, CancellationToken)
Modifies a guild channel's properties.
public Task<TextGuildChannel> 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.
Returns
ModifyPermissionsAsync(PermissionOverwriteProperties, RestRequestProperties?, CancellationToken)
Modifies the permissions of a role or user in a guild channel.
public Task ModifyPermissionsAsync(PermissionOverwriteProperties permissionOverwrite, RestRequestProperties? properties = null, CancellationToken cancellationToken = default)
Parameters
permissionOverwritePermissionOverwritePropertiesThe permission overwrite to apply.
propertiesRestRequestPropertiesOptional properties to customize the request, can be null.
cancellationTokenCancellationTokenA token that can be used to cancel the operation before it completes.