Search Results for

    Show / Hide Table of Contents

    Interface ITextChannel

    Represents a generic channel in a guild that can send and receive messages.

    Inherited Members
    IMessageChannel.SendMessageAsync(String, Boolean, Embed, RequestOptions, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[], MessageFlags)
    IMessageChannel.SendFileAsync(String, String, Boolean, Embed, RequestOptions, Boolean, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[], MessageFlags)
    IMessageChannel.SendFileAsync(Stream, String, String, Boolean, Embed, RequestOptions, Boolean, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[], MessageFlags)
    IMessageChannel.SendFileAsync(FileAttachment, String, Boolean, Embed, RequestOptions, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[], MessageFlags)
    IMessageChannel.SendFilesAsync(IEnumerable<FileAttachment>, String, Boolean, Embed, RequestOptions, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[], MessageFlags)
    IMessageChannel.GetMessageAsync(UInt64, CacheMode, RequestOptions)
    IMessageChannel.GetMessagesAsync(Int32, CacheMode, RequestOptions)
    IMessageChannel.GetMessagesAsync(UInt64, Direction, Int32, CacheMode, RequestOptions)
    IMessageChannel.GetMessagesAsync(IMessage, Direction, Int32, CacheMode, RequestOptions)
    IMessageChannel.GetPinnedMessagesAsync(RequestOptions)
    IMessageChannel.DeleteMessageAsync(UInt64, RequestOptions)
    IMessageChannel.DeleteMessageAsync(IMessage, RequestOptions)
    IMessageChannel.ModifyMessageAsync(UInt64, Action<MessageProperties>, RequestOptions)
    IMessageChannel.TriggerTypingAsync(RequestOptions)
    IMessageChannel.EnterTypingState(RequestOptions)
    IMentionable.Mention
    INestedChannel.CategoryId
    INestedChannel.GetCategoryAsync(CacheMode, RequestOptions)
    INestedChannel.SyncPermissionsAsync(RequestOptions)
    INestedChannel.CreateInviteAsync(Nullable<Int32>, Nullable<Int32>, Boolean, Boolean, RequestOptions)
    INestedChannel.CreateInviteToApplicationAsync(UInt64, Nullable<Int32>, Nullable<Int32>, Boolean, Boolean, RequestOptions)
    INestedChannel.CreateInviteToApplicationAsync(DefaultApplications, Nullable<Int32>, Nullable<Int32>, Boolean, Boolean, RequestOptions)
    INestedChannel.CreateInviteToStreamAsync(IUser, Nullable<Int32>, Nullable<Int32>, Boolean, Boolean, RequestOptions)
    INestedChannel.GetInvitesAsync(RequestOptions)
    IGuildChannel.Position
    IGuildChannel.Flags
    IGuildChannel.Guild
    IGuildChannel.GuildId
    IGuildChannel.PermissionOverwrites
    IGuildChannel.ModifyAsync(Action<GuildChannelProperties>, RequestOptions)
    IGuildChannel.GetPermissionOverwrite(IRole)
    IGuildChannel.GetPermissionOverwrite(IUser)
    IGuildChannel.RemovePermissionOverwriteAsync(IRole, RequestOptions)
    IGuildChannel.RemovePermissionOverwriteAsync(IUser, RequestOptions)
    IGuildChannel.AddPermissionOverwriteAsync(IRole, OverwritePermissions, RequestOptions)
    IGuildChannel.AddPermissionOverwriteAsync(IUser, OverwritePermissions, RequestOptions)
    IGuildChannel.GetUsersAsync(CacheMode, RequestOptions)
    IGuildChannel.GetUserAsync(UInt64, CacheMode, RequestOptions)
    IChannel.Name
    ISnowflakeEntity.CreatedAt
    IEntity<UInt64>.Id
    IDeletable.DeleteAsync(RequestOptions)
    Namespace: Discord
    Assembly: Discord.Net.Core.dll
    Syntax
    public interface ITextChannel : IMessageChannel, IMentionable, INestedChannel, IGuildChannel, IChannel, ISnowflakeEntity, IEntity<ulong>, IDeletable

    Properties

    | Improve this Doc View Source

    DefaultArchiveDuration

    Gets the default auto-archive duration for client-created threads in this channel.

    Declaration
    ThreadArchiveDuration DefaultArchiveDuration { get; }
    Property Value
    Type Description
    ThreadArchiveDuration

    The default auto-archive duration for thread creation in this channel.

    Remarks

    The value of this property does not affect API thread creation, it will not respect this value.

    | Improve this Doc View Source

    IsNsfw

    Gets a value that indicates whether the channel is NSFW.

    Declaration
    bool IsNsfw { get; }
    Property Value
    Type Description
    Boolean

    true if the channel has the NSFW flag enabled; otherwise false.

    | Improve this Doc View Source

    SlowModeInterval

    Gets the current slow-mode delay for this channel.

    Declaration
    int SlowModeInterval { get; }
    Property Value
    Type Description
    Int32

    An representing the time in seconds required before the user can send another message; 0 if disabled.

    | Improve this Doc View Source

    Topic

    Gets the current topic for this text channel.

    Declaration
    string Topic { get; }
    Property Value
    Type Description
    String

    A string representing the topic set in the channel; null if none is set.

    Methods

    | Improve this Doc View Source

    CreateThreadAsync(String, ThreadType, ThreadArchiveDuration, IMessage, Nullable<Boolean>, Nullable<Int32>, RequestOptions)

    Creates a thread within this ITextChannel.

    Declaration
    Task<IThreadChannel> CreateThreadAsync(string name, ThreadType type = default(ThreadType), ThreadArchiveDuration autoArchiveDuration = default(ThreadArchiveDuration), IMessage message = null, bool? invitable = null, int? slowmode = null, RequestOptions options = null)
    Parameters
    Type Name Description
    String name

    The name of the thread.

    ThreadType type

    The type of the thread.

    Note: This parameter is not used if the message parameter is not specified.

    ThreadArchiveDuration autoArchiveDuration

    The duration on which this thread archives after.

    Note: Options OneWeek and ThreeDays are only available for guilds that are boosted. You can check in the Features to see if the guild has the THREE_DAY_THREAD_ARCHIVE and SEVEN_DAY_THREAD_ARCHIVE.

    IMessage message

    The message which to start the thread from.

    Nullable<Boolean> invitable

    Whether non-moderators can add other non-moderators to a thread; only available when creating a private thread

    Nullable<Int32> slowmode

    The amount of seconds a user has to wait before sending another message (0-21600)

    RequestOptions options

    The options to be used when sending the request.

    Returns
    Type Description
    Task<IThreadChannel>

    A task that represents the asynchronous create operation. The task result contains a IThreadChannel

    Remarks

    When message is null the thread type will be based off of the channel its created in. When called on a ITextChannel, it creates a PublicThread. When called on a INewsChannel, it creates a NewsThread. The id of the created thread will be the same as the id of the message, and as such a message can only have a single thread created from it.

    | Improve this Doc View Source

    CreateWebhookAsync(String, Stream, RequestOptions)

    Creates a webhook in this text channel.

    Declaration
    Task<IWebhook> CreateWebhookAsync(string name, Stream avatar = null, RequestOptions options = null)
    Parameters
    Type Name Description
    String name

    The name of the webhook.

    Stream avatar

    The avatar of the webhook.

    RequestOptions options

    The options to be used when sending the request.

    Returns
    Type Description
    Task<IWebhook>

    A task that represents the asynchronous creation operation. The task result contains the newly created webhook.

    | Improve this Doc View Source

    DeleteMessagesAsync(IEnumerable<IMessage>, RequestOptions)

    Bulk-deletes multiple messages.

    Declaration
    Task DeleteMessagesAsync(IEnumerable<IMessage> messages, RequestOptions options = null)
    Parameters
    Type Name Description
    IEnumerable<IMessage> messages

    The messages to be bulk-deleted.

    RequestOptions options

    The options to be used when sending the request.

    Returns
    Type Description
    Task

    A task that represents the asynchronous bulk-removal operation.

    Remarks

    This method attempts to remove the messages specified in bulk.

    important

    Due to the limitation set by Discord, this method can only remove messages that are posted within 14 days!

    Examples

    The following example gets 250 messages from the channel and deletes them.

    var messages = await textChannel.GetMessagesAsync(250).FlattenAsync();
    await textChannel.DeleteMessagesAsync(messages);
    | Improve this Doc View Source

    DeleteMessagesAsync(IEnumerable<UInt64>, RequestOptions)

    Bulk-deletes multiple messages.

    Declaration
    Task DeleteMessagesAsync(IEnumerable<ulong> messageIds, RequestOptions options = null)
    Parameters
    Type Name Description
    IEnumerable<UInt64> messageIds

    The snowflake identifier of the messages to be bulk-deleted.

    RequestOptions options

    The options to be used when sending the request.

    Returns
    Type Description
    Task

    A task that represents the asynchronous bulk-removal operation.

    Remarks

    This method attempts to remove the messages specified in bulk.

    important

    Due to the limitation set by Discord, this method can only remove messages that are posted within 14 days!

    | Improve this Doc View Source

    GetActiveThreadsAsync(RequestOptions)

    Gets a collection of active threads within this channel.

    Declaration
    Task<IReadOnlyCollection<IThreadChannel>> GetActiveThreadsAsync(RequestOptions options = null)
    Parameters
    Type Name Description
    RequestOptions options

    The options to be used when sending the request.

    Returns
    Type Description
    Task<IReadOnlyCollection<IThreadChannel>>

    A task that represents an asynchronous get operation for retrieving the threads. The task result contains a collection of active threads.

    | Improve this Doc View Source

    GetWebhookAsync(UInt64, RequestOptions)

    Gets a webhook available in this text channel.

    Declaration
    Task<IWebhook> GetWebhookAsync(ulong id, RequestOptions options = null)
    Parameters
    Type Name Description
    UInt64 id

    The identifier of the webhook.

    RequestOptions options

    The options to be used when sending the request.

    Returns
    Type Description
    Task<IWebhook>

    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.

    | Improve this Doc View Source

    GetWebhooksAsync(RequestOptions)

    Gets the webhooks available in this text channel.

    Declaration
    Task<IReadOnlyCollection<IWebhook>> GetWebhooksAsync(RequestOptions options = null)
    Parameters
    Type Name Description
    RequestOptions options

    The options to be used when sending the request.

    Returns
    Type Description
    Task<IReadOnlyCollection<IWebhook>>

    A task that represents the asynchronous get operation. The task result contains a read-only collection of webhooks that is available in this channel.

    | Improve this Doc View Source

    ModifyAsync(Action<TextChannelProperties>, RequestOptions)

    Modifies this text channel.

    Declaration
    Task ModifyAsync(Action<TextChannelProperties> func, RequestOptions options = null)
    Parameters
    Type Name Description
    Action<TextChannelProperties> func

    The delegate containing the properties to modify the channel with.

    RequestOptions options

    The options to be used when sending the request.

    Returns
    Type Description
    Task

    A task that represents the asynchronous modification operation.

    See Also
    TextChannelProperties

    Extension Methods

    ChannelExtensions.GetChannelType(IChannel)

    Theme

    • Improve this Doc
    • View Source
    In This Article
    Back to top Discord.Net (c) 2015-2022 3.9.0