using System.Collections.Generic; using System.IO; using System.Threading.Tasks; namespace Discord.Rest { /// /// Represents a REST-based channel that can send and receive messages. /// public interface IRestMessageChannel : IMessageChannel { /// /// Sends a message to this message channel. /// /// 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. /// /// 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); /// /// Sends a file to this message channel with an optional caption. /// /// /// This method sends a file as if you are uploading an attachment directly from your Discord client. /// /// If you wish to upload an image and have it embedded in a embed, /// you may upload the file and refer to the file with "attachment://filename.ext" in the /// . /// /// /// 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. /// /// 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); /// /// Sends a file to this message channel with an optional caption. /// /// /// This method sends a file as if you are uploading an attachment directly from your Discord client. /// /// If you wish to upload an image and have it embedded in a embed, /// you may upload the file and refer to the file with "attachment://filename.ext" in the /// . /// /// /// 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. /// /// 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); /// /// Gets a message from this message channel. /// /// The snowflake identifier of the message. /// The options to be used when sending the request. /// /// A task that represents an asynchronous get operation for retrieving the message. The task result contains /// the retrieved message; null if no message is found with the specified identifier. /// Task GetMessageAsync(ulong id, RequestOptions options = null); /// /// Gets the last N messages from this message channel. /// /// /// /// The returned collection is an asynchronous enumerable object; one must call /// to access the individual messages as a /// collection. /// /// /// Do not fetch too many messages at once! This may cause unwanted preemptive rate limit or even actual /// rate limit, causing your bot to freeze! /// /// This method will attempt to fetch the number of messages specified under . The /// library will attempt to split up the requests according to your and /// . In other words, should the user request 500 messages, /// and the constant is 100, the request will /// be split into 5 individual requests; thus returning 5 individual asynchronous responses, hence the need /// of flattening. /// /// /// The following example downloads 300 messages and gets messages that belong to the user /// 53905483156684800. /// /// var messages = await messageChannel.GetMessagesAsync(300).FlattenAsync(); /// var userMessages = messages.Where(x => x.Author.Id == 53905483156684800); /// /// /// The numbers of message to be gotten from. /// The options to be used when sending the request. /// /// Paged collection of messages. /// IAsyncEnumerable> GetMessagesAsync(int limit = DiscordConfig.MaxMessagesPerBatch, RequestOptions options = null); /// /// Gets a collection of messages in this channel. /// /// /// /// The returned collection is an asynchronous enumerable object; one must call /// to access the individual messages as a /// collection. /// /// /// Do not fetch too many messages at once! This may cause unwanted preemptive rate limit or even actual /// rate limit, causing your bot to freeze! /// /// This method will attempt to fetch the number of messages specified under around /// the message depending on the . The library will /// attempt to split up the requests according to your and /// . In other words, should the user request 500 messages, /// and the constant is 100, the request will /// be split into 5 individual requests; thus returning 5 individual asynchronous responses, hence the need /// of flattening. /// /// /// The following example gets 5 message prior to the message identifier 442012544660537354. /// /// var messages = await channel.GetMessagesAsync(442012544660537354, Direction.Before, 5).FlattenAsync(); /// /// /// The ID of the starting message to get the messages from. /// The direction of the messages to be gotten from. /// The numbers of message to be gotten from. /// The that determines whether the object should be fetched from /// cache. /// The options to be used when sending the request. /// /// Paged collection of messages. /// IAsyncEnumerable> GetMessagesAsync(ulong fromMessageId, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch, RequestOptions options = null); /// /// Gets a collection of messages in this channel. /// /// /// /// The returned collection is an asynchronous enumerable object; one must call /// to access the individual messages as a /// collection. /// /// /// Do not fetch too many messages at once! This may cause unwanted preemptive rate limit or even actual /// rate limit, causing your bot to freeze! /// /// This method will attempt to fetch the number of messages specified under around /// the message depending on the . The library will /// attempt to split up the requests according to your and /// . In other words, should the user request 500 messages, /// and the constant is 100, the request will /// be split into 5 individual requests; thus returning 5 individual asynchronous responses, hence the need /// of flattening. /// /// /// The following example gets 5 message prior to a specific message, oldMessage. /// /// var messages = await channel.GetMessagesAsync(oldMessage, Direction.Before, 5).FlattenAsync(); /// /// /// The starting message to get the messages from. /// The direction of the messages to be gotten from. /// The numbers of message to be gotten from. /// The that determines whether the object should be fetched from /// cache. /// The options to be used when sending the request. /// /// Paged collection of messages. /// IAsyncEnumerable> GetMessagesAsync(IMessage fromMessage, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch, RequestOptions options = null); /// /// Gets a collection of pinned messages in this channel. /// /// 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 collection of messages found in the pinned messages. /// new Task> GetPinnedMessagesAsync(RequestOptions options = null); } }