Search Results for

    Show / Hide Table of Contents

    Interface ISocketMessageChannel

    Represents a generic WebSocket-based channel that can send and receive messages.

    Inherited Members
    Discord.IMessageChannel.SendFilesAsync(IEnumerable<>, System.String, System.Boolean, Discord.Embed, Discord.RequestOptions, Discord.AllowedMentions, Discord.MessageReference, Discord.MessageComponent, Discord.ISticker[], Discord.Embed[], Discord.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.DeleteMessageAsync(UInt64, RequestOptions)
    IMessageChannel.DeleteMessageAsync(IMessage, RequestOptions)
    Discord.IMessageChannel.ModifyMessageAsync(System.UInt64, Action<>, Discord.RequestOptions)
    IMessageChannel.TriggerTypingAsync(RequestOptions)
    IMessageChannel.EnterTypingState(RequestOptions)
    IChannel.Name
    IChannel.GetUsersAsync(CacheMode, RequestOptions)
    IChannel.GetUserAsync(UInt64, CacheMode, RequestOptions)
    ISnowflakeEntity.CreatedAt
    IEntity<UInt64>.Id
    Namespace: Discord.WebSocket
    Assembly: Discord.Net.WebSocket.dll
    Syntax
    public interface ISocketMessageChannel : IMessageChannel, IChannel, ISnowflakeEntity, IEntity<ulong>

    Properties

    | Improve this Doc View Source

    CachedMessages

    Gets all messages in this channel's cache.

    Declaration
    IReadOnlyCollection<SocketMessage> CachedMessages { get; }
    Property Value
    Type Description
    IReadOnlyCollection<SocketMessage>

    A read-only collection of WebSocket-based messages.

    Methods

    | Improve this Doc View Source

    GetCachedMessage(UInt64)

    Gets a cached message from this channel.

    Declaration
    SocketMessage GetCachedMessage(ulong id)
    Parameters
    Type Name Description
    UInt64 id

    The snowflake identifier of the message.

    Returns
    Type Description
    SocketMessage

    A WebSocket-based message object; null if it does not exist in the cache or if caching is not enabled.

    Remarks

    warning

    This method requires the use of cache, which is not enabled by default; if caching is not enabled, this method will always return null. Please refer to MessageCacheSize for more details.

    This method retrieves the message from the local WebSocket cache and does not send any additional request to Discord. This message may be a message that has been deleted.

    | Improve this Doc View Source

    GetCachedMessages(IMessage, Direction, Int32)

    Gets the last N cached messages starting from a certain message in this message channel.

    Declaration
    IReadOnlyCollection<SocketMessage> GetCachedMessages(IMessage fromMessage, Direction dir, int limit = null)
    Parameters
    Type Name Description
    IMessage fromMessage

    The message to start the fetching from.

    Direction dir

    The direction of which the message should be gotten from.

    Int32 limit

    The number of messages to get.

    Returns
    Type Description
    IReadOnlyCollection<SocketMessage>

    A read-only collection of WebSocket-based messages.

    Remarks

    warning

    This method requires the use of cache, which is not enabled by default; if caching is not enabled, this method will always return an empty collection. Please refer to MessageCacheSize for more details.

    This method retrieves the message(s) from the local WebSocket cache and does not send any additional request to Discord. This read-only collection may include messages that have been deleted. The maximum number of messages that can be retrieved from this method depends on the MessageCacheSize set.

    | Improve this Doc View Source

    GetCachedMessages(Int32)

    Gets the last N cached messages from this message channel.

    Declaration
    IReadOnlyCollection<SocketMessage> GetCachedMessages(int limit = null)
    Parameters
    Type Name Description
    Int32 limit

    The number of messages to get.

    Returns
    Type Description
    IReadOnlyCollection<SocketMessage>

    A read-only collection of WebSocket-based messages.

    Remarks

    warning

    This method requires the use of cache, which is not enabled by default; if caching is not enabled, this method will always return an empty collection. Please refer to MessageCacheSize for more details.

    This method retrieves the message(s) from the local WebSocket cache and does not send any additional request to Discord. This read-only collection may include messages that have been deleted. The maximum number of messages that can be retrieved from this method depends on the MessageCacheSize set.

    | Improve this Doc View Source

    GetCachedMessages(UInt64, Direction, Int32)

    Gets the last N cached messages starting from a certain message in this message channel.

    Declaration
    IReadOnlyCollection<SocketMessage> GetCachedMessages(ulong fromMessageId, Direction dir, int limit = null)
    Parameters
    Type Name Description
    UInt64 fromMessageId

    The message ID to start the fetching from.

    Direction dir

    The direction of which the message should be gotten from.

    Int32 limit

    The number of messages to get.

    Returns
    Type Description
    IReadOnlyCollection<SocketMessage>

    A read-only collection of WebSocket-based messages.

    Remarks

    warning

    This method requires the use of cache, which is not enabled by default; if caching is not enabled, this method will always return an empty collection. Please refer to MessageCacheSize for more details.

    This method retrieves the message(s) from the local WebSocket cache and does not send any additional request to Discord. This read-only collection may include messages that have been deleted. The maximum number of messages that can be retrieved from this method depends on the MessageCacheSize set.

    | Improve this Doc View Source

    GetPinnedMessagesAsync(RequestOptions)

    Gets a read-only collection of pinned messages in this channel.

    Declaration
    Task<IReadOnlyCollection<RestMessage>> GetPinnedMessagesAsync(RequestOptions options = null)
    Parameters
    Type Name Description
    RequestOptions options

    The options to be used when sending the request.

    Returns
    Type Description
    Task<IReadOnlyCollection<RestMessage>>

    A task that represents the asynchronous get operation for retrieving pinned messages in this channel. The task result contains a read-only collection of messages found in the pinned messages.

    Remarks

    This method follows the same behavior as described in GetPinnedMessagesAsync(RequestOptions). Please visit its documentation for more details on this method.

    | Improve this Doc View Source

    SendFileAsync(FileAttachment, String, Boolean, Embed, RequestOptions, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[], MessageFlags)

    Declaration
    Task<RestUserMessage> SendFileAsync(FileAttachment attachment, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null, MessageFlags flags = default(MessageFlags))
    Parameters
    Type Name Description
    FileAttachment attachment
    String text
    Boolean isTTS
    Embed embed
    RequestOptions options
    AllowedMentions allowedMentions
    MessageReference messageReference
    MessageComponent components
    ISticker[] stickers
    Embed[] embeds
    MessageFlags flags
    Returns
    Type Description
    Task<RestUserMessage>
    | Improve this Doc View Source

    SendFileAsync(Stream, String, String, Boolean, Embed, RequestOptions, Boolean, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[], MessageFlags)

    Declaration
    Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null, MessageFlags flags = default(MessageFlags))
    Parameters
    Type Name Description
    Stream stream
    String filename
    String text
    Boolean isTTS
    Embed embed
    RequestOptions options
    Boolean isSpoiler
    AllowedMentions allowedMentions
    MessageReference messageReference
    MessageComponent components
    ISticker[] stickers
    Embed[] embeds
    MessageFlags flags
    Returns
    Type Description
    Task<RestUserMessage>
    | Improve this Doc View Source

    SendFileAsync(String, String, Boolean, Embed, RequestOptions, Boolean, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[], MessageFlags)

    Declaration
    Task<RestUserMessage> SendFileAsync(string filePath, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null, MessageFlags flags = default(MessageFlags))
    Parameters
    Type Name Description
    String filePath
    String text
    Boolean isTTS
    Embed embed
    RequestOptions options
    Boolean isSpoiler
    AllowedMentions allowedMentions
    MessageReference messageReference
    MessageComponent components
    ISticker[] stickers
    Embed[] embeds
    MessageFlags flags
    Returns
    Type Description
    Task<RestUserMessage>
    | Improve this Doc View Source

    SendFilesAsync(IEnumerable<FileAttachment>, String, Boolean, Embed, RequestOptions, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[], MessageFlags)

    Declaration
    Task<RestUserMessage> SendFilesAsync(IEnumerable<FileAttachment> attachments, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null, MessageFlags flags = default(MessageFlags))
    Parameters
    Type Name Description
    IEnumerable<FileAttachment> attachments
    String text
    Boolean isTTS
    Embed embed
    RequestOptions options
    AllowedMentions allowedMentions
    MessageReference messageReference
    MessageComponent components
    ISticker[] stickers
    Embed[] embeds
    MessageFlags flags
    Returns
    Type Description
    Task<RestUserMessage>
    | Improve this Doc View Source

    SendMessageAsync(String, Boolean, Embed, RequestOptions, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[], MessageFlags)

    Declaration
    Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null, MessageFlags flags = default(MessageFlags))
    Parameters
    Type Name Description
    String text
    Boolean isTTS
    Embed embed
    RequestOptions options
    AllowedMentions allowedMentions
    MessageReference messageReference
    MessageComponent components
    ISticker[] stickers
    Embed[] embeds
    MessageFlags flags
    Returns
    Type Description
    Task<RestUserMessage>

    Theme

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