using Discord.Rest; using System.Collections.Generic; using System.IO; using System.Threading.Tasks; namespace Discord.WebSocket { /// /// Represents a generic WebSocket-based channel that can send and receive messages. /// public interface ISocketMessageChannel : IMessageChannel { /// /// Gets all messages in this channel's cache. /// /// /// A read-only collection of WebSocket-based messages. /// IReadOnlyCollection CachedMessages { get; } /// /// Sends a message to this message channel. /// /// /// This method follows the same behavior as described in . /// Please visit its documentation for more details on this method. /// /// The message to be sent. /// Determines whether the message should be read aloud by Discord or not. /// The to be sent. /// The options to be used when sending the request. /// /// Specifies if notifications are sent for mentioned users and roles in the message . /// If null, all mentioned roles and users will be notified. /// /// /// A task that represents an asynchronous send operation for delivering the message. The task result /// contains the sent message. /// new Task SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null); /// /// Sends a file to this message channel with an optional caption. /// /// /// This method follows the same behavior as described in . /// Please visit its documentation for more details on this method. /// /// The file path of the file. /// The message to be sent. /// Whether the message should be read aloud by Discord or not. /// The to be sent. /// The options to be used when sending the request. /// Whether the message attachment should be hidden as a spoiler. /// /// Specifies if notifications are sent for mentioned users and roles in the message . /// If null, all mentioned roles and users will be notified. /// /// /// A task that represents an asynchronous send operation for delivering the message. The task result /// contains the sent message. /// new Task SendFileAsync(string filePath, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null); /// /// Sends a file to this message channel with an optional caption. /// /// /// This method follows the same behavior as described in . /// Please visit its documentation for more details on this method. /// /// The of the file to be sent. /// The name of the attachment. /// The message to be sent. /// Whether the message should be read aloud by Discord or not. /// The to be sent. /// The options to be used when sending the request. /// Whether the message attachment should be hidden as a spoiler. /// /// Specifies if notifications are sent for mentioned users and roles in the message . /// If null, all mentioned roles and users will be notified. /// /// /// A task that represents an asynchronous send operation for delivering the message. The task result /// contains the sent message. /// new Task SendFileAsync(Stream stream, string filename, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null); /// /// Gets a cached message from this channel. /// /// /// /// 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 /// 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. /// /// /// The snowflake identifier of the message. /// /// A WebSocket-based message object; null if it does not exist in the cache or if caching is not /// enabled. /// SocketMessage GetCachedMessage(ulong id); /// /// Gets the last N cached messages from this message channel. /// /// /// /// 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 /// 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 /// set. /// /// /// The number of messages to get. /// /// A read-only collection of WebSocket-based messages. /// IReadOnlyCollection GetCachedMessages(int limit = DiscordConfig.MaxMessagesPerBatch); /// /// Gets the last N cached messages starting from a certain message in this message channel. /// /// /// /// 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 /// 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 /// set. /// /// /// The message ID to start the fetching from. /// The direction of which the message should be gotten from. /// The number of messages to get. /// /// A read-only collection of WebSocket-based messages. /// IReadOnlyCollection GetCachedMessages(ulong fromMessageId, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch); /// /// Gets the last N cached messages starting from a certain message in this message channel. /// /// /// /// 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 /// 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 /// set. /// /// /// The message to start the fetching from. /// The direction of which the message should be gotten from. /// The number of messages to get. /// /// A read-only collection of WebSocket-based messages. /// IReadOnlyCollection GetCachedMessages(IMessage fromMessage, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch); /// /// Gets a read-only collection of pinned messages in this channel. /// /// /// This method follows the same behavior as described in . /// Please visit its documentation for more details on this method. /// /// The options to be used when sending the request. /// /// 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. /// new Task> GetPinnedMessagesAsync(RequestOptions options = null); } }