This is done by changing the documentation of the implementations required by interfaces to redirect to the interface method instead (e.g., SocketDMChannel#GetMessagesAsync refer to IMessageChannel.GetMessagesAsync within the remarks of the method).pull/1218/head
@@ -12,6 +12,10 @@ namespace Discord.Rest | |||
/// <summary> | |||
/// Sends a message to this message channel. | |||
/// </summary> | |||
/// <remarks> | |||
/// This method follows the same behavior as described in <see cref="IMessageChannel.SendMessageAsync"/>. | |||
/// Please visit its documentation for more details on this method. | |||
/// </remarks> | |||
/// <param name="text">The message to be sent.</param> | |||
/// <param name="isTTS">Determines whether the message should be read aloud by Discord or not.</param> | |||
/// <param name="embed">The <see cref="Discord.EmbedType.Rich"/> <see cref="Embed"/> to be sent.</param> | |||
@@ -25,12 +29,9 @@ namespace Discord.Rest | |||
/// Sends a file to this message channel with an optional caption. | |||
/// </summary> | |||
/// <remarks> | |||
/// This method sends a file as if you are uploading an attachment directly from your Discord client. | |||
/// <note> | |||
/// If you wish to upload an image and have it embedded in a <see cref="Discord.EmbedType.Rich"/>embed, | |||
/// you may upload the file and refer to the file with "attachment://filename.ext" in the | |||
/// <see cref="Discord.EmbedBuilder.ImageUrl"/>. | |||
/// </note> | |||
/// This method follows the same behavior as described in | |||
/// <see cref="IMessageChannel.SendFileAsync(string, string, bool, Embed, RequestOptions)"/>. Please visit | |||
/// its documentation for more details on this method. | |||
/// </remarks> | |||
/// <param name="filePath">The file path of the file.</param> | |||
/// <param name="text">The message to be sent.</param> | |||
@@ -46,12 +47,8 @@ namespace Discord.Rest | |||
/// Sends a file to this message channel with an optional caption. | |||
/// </summary> | |||
/// <remarks> | |||
/// This method sends a file as if you are uploading an attachment directly from your Discord client. | |||
/// <note> | |||
/// If you wish to upload an image and have it embedded in a <see cref="Discord.EmbedType.Rich"/>embed, | |||
/// you may upload the file and refer to the file with "attachment://filename.ext" in the | |||
/// <see cref="Discord.EmbedBuilder.ImageUrl"/>. | |||
/// </note> | |||
/// This method follows the same behavior as described in <see cref="IMessageChannel.SendFileAsync(Stream, string, string, bool, Embed, RequestOptions)"/>. | |||
/// Please visit its documentation for more details on this method. | |||
/// </remarks> | |||
/// <param name="stream">The <see cref="Stream" /> of the file to be sent.</param> | |||
/// <param name="filename">The name of the attachment.</param> | |||
@@ -68,6 +65,10 @@ namespace Discord.Rest | |||
/// <summary> | |||
/// Gets a message from this message channel. | |||
/// </summary> | |||
/// <remarks> | |||
/// This method follows the same behavior as described in <see cref="IMessageChannel.GetMessageAsync(ulong, CacheMode, RequestOptions)"/>. | |||
/// Please visit its documentation for more details on this method. | |||
/// </remarks> | |||
/// <param name="id">The snowflake identifier of the message.</param> | |||
/// <param name="options">The options to be used when sending the request.</param> | |||
/// <returns> | |||
@@ -79,30 +80,9 @@ namespace Discord.Rest | |||
/// Gets the last N messages from this message channel. | |||
/// </summary> | |||
/// <remarks> | |||
/// <note type="important"> | |||
/// The returned collection is an asynchronous enumerable object; one must call | |||
/// <see cref="AsyncEnumerableExtensions.FlattenAsync{T}"/> to access the individual messages as a | |||
/// collection. | |||
/// </note> | |||
/// <note type="warning"> | |||
/// 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! | |||
/// </note> | |||
/// This method will attempt to fetch the number of messages specified under <paramref name="limit"/>. The | |||
/// library will attempt to split up the requests according to your <paramref name="limit"/> and | |||
/// <see cref="DiscordConfig.MaxMessagesPerBatch"/>. In other words, should the user request 500 messages, | |||
/// and the <see cref="Discord.DiscordConfig.MaxMessagesPerBatch"/> constant is <c>100</c>, the request will | |||
/// be split into 5 individual requests; thus returning 5 individual asynchronous responses, hence the need | |||
/// of flattening. | |||
/// This method follows the same behavior as described in <see cref="IMessageChannel.GetMessagesAsync(int, CacheMode, RequestOptions)"/>. | |||
/// Please visit its documentation for more details on this method. | |||
/// </remarks> | |||
/// <example> | |||
/// The following example downloads 300 messages and gets messages that belong to the user | |||
/// <c>53905483156684800</c>. | |||
/// <code lang="cs"> | |||
/// var messages = await messageChannel.GetMessagesAsync(300).FlattenAsync(); | |||
/// var userMessages = messages.Where(x => x.Author.Id == 53905483156684800); | |||
/// </code> | |||
/// </example> | |||
/// <param name="limit">The numbers of message to be gotten from.</param> | |||
/// <param name="options">The options to be used when sending the request.</param> | |||
/// <returns> | |||
@@ -113,34 +93,12 @@ namespace Discord.Rest | |||
/// Gets a collection of messages in this channel. | |||
/// </summary> | |||
/// <remarks> | |||
/// <note type="important"> | |||
/// The returned collection is an asynchronous enumerable object; one must call | |||
/// <see cref="AsyncEnumerableExtensions.FlattenAsync{T}"/> to access the individual messages as a | |||
/// collection. | |||
/// </note> | |||
/// <note type="warning"> | |||
/// 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! | |||
/// </note> | |||
/// This method will attempt to fetch the number of messages specified under <paramref name="limit"/> around | |||
/// the message <paramref name="fromMessageId"/> depending on the <paramref name="dir"/>. The library will | |||
/// attempt to split up the requests according to your <paramref name="limit"/> and | |||
/// <see cref="DiscordConfig.MaxMessagesPerBatch"/>. In other words, should the user request 500 messages, | |||
/// and the <see cref="Discord.DiscordConfig.MaxMessagesPerBatch"/> constant is <c>100</c>, the request will | |||
/// be split into 5 individual requests; thus returning 5 individual asynchronous responses, hence the need | |||
/// of flattening. | |||
/// This method follows the same behavior as described in <see cref="IMessageChannel.GetMessagesAsync(ulong, Direction, int, CacheMode, RequestOptions)"/>. | |||
/// Please visit its documentation for more details on this method. | |||
/// </remarks> | |||
/// <example> | |||
/// The following example gets 5 message prior to the message identifier <c>442012544660537354</c>. | |||
/// <code lang="cs"> | |||
/// var messages = await channel.GetMessagesAsync(442012544660537354, Direction.Before, 5).FlattenAsync(); | |||
/// </code> | |||
/// </example> | |||
/// <param name="fromMessageId">The ID of the starting message to get the messages from.</param> | |||
/// <param name="dir">The direction of the messages to be gotten from.</param> | |||
/// <param name="limit">The numbers of message to be gotten from.</param> | |||
/// <param name="mode">The <see cref="CacheMode"/> that determines whether the object should be fetched from | |||
/// cache.</param> | |||
/// <param name="options">The options to be used when sending the request.</param> | |||
/// <returns> | |||
/// Paged collection of messages. | |||
@@ -150,34 +108,12 @@ namespace Discord.Rest | |||
/// Gets a collection of messages in this channel. | |||
/// </summary> | |||
/// <remarks> | |||
/// <note type="important"> | |||
/// The returned collection is an asynchronous enumerable object; one must call | |||
/// <see cref="AsyncEnumerableExtensions.FlattenAsync{T}"/> to access the individual messages as a | |||
/// collection. | |||
/// </note> | |||
/// <note type="warning"> | |||
/// 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! | |||
/// </note> | |||
/// This method will attempt to fetch the number of messages specified under <paramref name="limit"/> around | |||
/// the message <paramref name="fromMessage"/> depending on the <paramref name="dir"/>. The library will | |||
/// attempt to split up the requests according to your <paramref name="limit"/> and | |||
/// <see cref="DiscordConfig.MaxMessagesPerBatch"/>. In other words, should the user request 500 messages, | |||
/// and the <see cref="Discord.DiscordConfig.MaxMessagesPerBatch"/> constant is <c>100</c>, the request will | |||
/// be split into 5 individual requests; thus returning 5 individual asynchronous responses, hence the need | |||
/// of flattening. | |||
/// This method follows the same behavior as described in <see cref="IMessageChannel.GetMessagesAsync(IMessage, Direction, int, CacheMode, RequestOptions)"/>. | |||
/// Please visit its documentation for more details on this method. | |||
/// </remarks> | |||
/// <example> | |||
/// The following example gets 5 message prior to a specific message, <c>oldMessage</c>. | |||
/// <code lang="cs"> | |||
/// var messages = await channel.GetMessagesAsync(oldMessage, Direction.Before, 5).FlattenAsync(); | |||
/// </code> | |||
/// </example> | |||
/// <param name="fromMessage">The starting message to get the messages from.</param> | |||
/// <param name="dir">The direction of the messages to be gotten from.</param> | |||
/// <param name="limit">The numbers of message to be gotten from.</param> | |||
/// <param name="mode">The <see cref="CacheMode"/> that determines whether the object should be fetched from | |||
/// cache.</param> | |||
/// <param name="options">The options to be used when sending the request.</param> | |||
/// <returns> | |||
/// Paged collection of messages. | |||
@@ -186,6 +122,10 @@ namespace Discord.Rest | |||
/// <summary> | |||
/// Gets a collection of pinned messages in this channel. | |||
/// </summary> | |||
/// <remarks> | |||
/// This method follows the same behavior as described in <see cref="IMessageChannel.GetPinnedMessagesAsync"/>. | |||
/// Please visit its documentation for more details on this method. | |||
/// </remarks> | |||
/// <param name="options">The options to be used when sending the request.</param> | |||
/// <returns> | |||
/// A task that represents the asynchronous get operation for retrieving pinned messages in this channel. | |||
@@ -21,6 +21,10 @@ namespace Discord.WebSocket | |||
/// <summary> | |||
/// Sends a message to this message channel. | |||
/// </summary> | |||
/// <remarks> | |||
/// This method follows the same behavior as described in <see cref="IMessageChannel.SendMessageAsync"/>. | |||
/// Please visit its documentation for more details on this method. | |||
/// </remarks> | |||
/// <param name="text">The message to be sent.</param> | |||
/// <param name="isTTS">Determines whether the message should be read aloud by Discord or not.</param> | |||
/// <param name="embed">The <see cref="Discord.EmbedType.Rich"/> <see cref="Embed"/> to be sent.</param> | |||
@@ -34,12 +38,8 @@ namespace Discord.WebSocket | |||
/// Sends a file to this message channel with an optional caption. | |||
/// </summary> | |||
/// <remarks> | |||
/// This method sends a file as if you are uploading an attachment directly from your Discord client. | |||
/// <note> | |||
/// If you wish to upload an image and have it embedded in a <see cref="Discord.EmbedType.Rich"/>embed, | |||
/// you may upload the file and refer to the file with "attachment://filename.ext" in the | |||
/// <see cref="Discord.EmbedBuilder.ImageUrl"/>. | |||
/// </note> | |||
/// This method follows the same behavior as described in <see cref="IMessageChannel.SendFileAsync(string, string, bool, Embed, RequestOptions)"/>. | |||
/// Please visit its documentation for more details on this method. | |||
/// </remarks> | |||
/// <param name="filePath">The file path of the file.</param> | |||
/// <param name="text">The message to be sent.</param> | |||
@@ -55,12 +55,8 @@ namespace Discord.WebSocket | |||
/// Sends a file to this message channel with an optional caption. | |||
/// </summary> | |||
/// <remarks> | |||
/// This method sends a file as if you are uploading an attachment directly from your Discord client. | |||
/// <note> | |||
/// If you wish to upload an image and have it embedded in a <see cref="Discord.EmbedType.Rich"/>embed, | |||
/// you may upload the file and refer to the file with "attachment://filename.ext" in the | |||
/// <see cref="Discord.EmbedBuilder.ImageUrl"/>. | |||
/// </note> | |||
/// This method follows the same behavior as described in <see cref="IMessageChannel.SendFileAsync(Stream, string, string, bool, Embed, RequestOptions)"/>. | |||
/// Please visit its documentation for more details on this method. | |||
/// </remarks> | |||
/// <param name="stream">The <see cref="Stream" /> of the file to be sent.</param> | |||
/// <param name="filename">The name of the attachment.</param> | |||
@@ -163,12 +159,16 @@ namespace Discord.WebSocket | |||
/// </returns> | |||
IReadOnlyCollection<SocketMessage> GetCachedMessages(IMessage fromMessage, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch); | |||
/// <summary> | |||
/// Gets a collection of pinned messages in this channel. | |||
/// Gets a read-only collection of pinned messages in this channel. | |||
/// </summary> | |||
/// <remarks> | |||
/// This method follows the same behavior as described in <see cref="IMessageChannel.GetPinnedMessagesAsync"/>. | |||
/// Please visit its documentation for more details on this method. | |||
/// </remarks> | |||
/// <param name="options">The options to be used when sending the request.</param> | |||
/// <returns> | |||
/// 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. | |||
/// The task result contains a read-only collection of messages found in the pinned messages. | |||
/// </returns> | |||
new Task<IReadOnlyCollection<RestMessage>> GetPinnedMessagesAsync(RequestOptions options = null); | |||
} | |||
@@ -78,30 +78,9 @@ namespace Discord.WebSocket | |||
/// Gets the last N messages from this message channel. | |||
/// </summary> | |||
/// <remarks> | |||
/// <note type="important"> | |||
/// The returned collection is an asynchronous enumerable object; one must call | |||
/// <see cref="AsyncEnumerableExtensions.FlattenAsync{T}"/> to access the individual messages as a | |||
/// collection. | |||
/// </note> | |||
/// <note type="warning"> | |||
/// 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! | |||
/// </note> | |||
/// This method will attempt to fetch the number of messages specified under <paramref name="limit"/>. The | |||
/// library will attempt to split up the requests according to your <paramref name="limit"/> and | |||
/// <see cref="DiscordConfig.MaxMessagesPerBatch"/>. In other words, should the user request 500 messages, | |||
/// and the <see cref="Discord.DiscordConfig.MaxMessagesPerBatch"/> constant is <c>100</c>, the request will | |||
/// be split into 5 individual requests; thus returning 5 individual asynchronous responses, hence the need | |||
/// of flattening. | |||
/// This method follows the same behavior as described in <see cref="IMessageChannel.GetMessagesAsync(int, CacheMode, RequestOptions)"/>. | |||
/// Please visit its documentation for more details on this method. | |||
/// </remarks> | |||
/// <example> | |||
/// The following example downloads 300 messages and gets messages that belong to the user | |||
/// <c>53905483156684800</c>. | |||
/// <code lang="cs"> | |||
/// var messages = await messageChannel.GetMessagesAsync(300).FlattenAsync(); | |||
/// var userMessages = messages.Where(x => x.Author.Id == 53905483156684800); | |||
/// </code> | |||
/// </example> | |||
/// <param name="limit">The numbers of message to be gotten from.</param> | |||
/// <param name="options">The options to be used when sending the request.</param> | |||
/// <returns> | |||
@@ -113,29 +92,9 @@ namespace Discord.WebSocket | |||
/// Gets a collection of messages in this channel. | |||
/// </summary> | |||
/// <remarks> | |||
/// <note type="important"> | |||
/// The returned collection is an asynchronous enumerable object; one must call | |||
/// <see cref="AsyncEnumerableExtensions.FlattenAsync{T}"/> to access the individual messages as a | |||
/// collection. | |||
/// </note> | |||
/// <note type="warning"> | |||
/// 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! | |||
/// </note> | |||
/// This method will attempt to fetch the number of messages specified under <paramref name="limit"/> around | |||
/// the message <paramref name="fromMessageId"/> depending on the <paramref name="dir"/>. The library will | |||
/// attempt to split up the requests according to your <paramref name="limit"/> and | |||
/// <see cref="DiscordConfig.MaxMessagesPerBatch"/>. In other words, should the user request 500 messages, | |||
/// and the <see cref="Discord.DiscordConfig.MaxMessagesPerBatch"/> constant is <c>100</c>, the request will | |||
/// be split into 5 individual requests; thus returning 5 individual asynchronous responses, hence the need | |||
/// of flattening. | |||
/// This method follows the same behavior as described in <see cref="IMessageChannel.GetMessagesAsync(ulong, Direction, int, CacheMode, RequestOptions)"/>. | |||
/// Please visit its documentation for more details on this method. | |||
/// </remarks> | |||
/// <example> | |||
/// The following example gets 5 message prior to the message identifier <c>442012544660537354</c>. | |||
/// <code lang="cs"> | |||
/// var messages = await channel.GetMessagesAsync(442012544660537354, Direction.Before, 5).FlattenAsync(); | |||
/// </code> | |||
/// </example> | |||
/// <param name="fromMessageId">The ID of the starting message to get the messages from.</param> | |||
/// <param name="dir">The direction of the messages to be gotten from.</param> | |||
/// <param name="limit">The numbers of message to be gotten from.</param> | |||
@@ -149,29 +108,9 @@ namespace Discord.WebSocket | |||
/// Gets a collection of messages in this channel. | |||
/// </summary> | |||
/// <remarks> | |||
/// <note type="important"> | |||
/// The returned collection is an asynchronous enumerable object; one must call | |||
/// <see cref="AsyncEnumerableExtensions.FlattenAsync{T}"/> to access the individual messages as a | |||
/// collection. | |||
/// </note> | |||
/// <note type="warning"> | |||
/// 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! | |||
/// </note> | |||
/// This method will attempt to fetch the number of messages specified under <paramref name="limit"/> around | |||
/// the message <paramref name="fromMessage"/> depending on the <paramref name="dir"/>. The library will | |||
/// attempt to split up the requests according to your <paramref name="limit"/> and | |||
/// <see cref="DiscordConfig.MaxMessagesPerBatch"/>. In other words, should the user request 500 messages, | |||
/// and the <see cref="Discord.DiscordConfig.MaxMessagesPerBatch"/> constant is <c>100</c>, the request will | |||
/// be split into 5 individual requests; thus returning 5 individual asynchronous responses, hence the need | |||
/// of flattening. | |||
/// This method follows the same behavior as described in <see cref="IMessageChannel.GetMessagesAsync(IMessage, Direction, int, CacheMode, RequestOptions)"/>. | |||
/// Please visit its documentation for more details on this method. | |||
/// </remarks> | |||
/// <example> | |||
/// The following example gets 5 message prior to a specific message, <c>oldMessage</c>. | |||
/// <code lang="cs"> | |||
/// var messages = await channel.GetMessagesAsync(oldMessage, Direction.Before, 5).FlattenAsync(); | |||
/// </code> | |||
/// </example> | |||
/// <param name="fromMessage">The starting message to get the messages from.</param> | |||
/// <param name="dir">The direction of the messages to be gotten from.</param> | |||
/// <param name="limit">The numbers of message to be gotten from.</param> | |||
@@ -81,6 +81,19 @@ namespace Discord.WebSocket | |||
/// <inheritdoc /> | |||
public SocketMessage GetCachedMessage(ulong id) | |||
=> _messages?.Get(id); | |||
/// <summary> | |||
/// Gets a message from this message channel. | |||
/// </summary> | |||
/// <remarks> | |||
/// This method follows the same behavior as described in <see cref="IMessageChannel.GetMessageAsync"/>. | |||
/// Please visit its documentation for more details on this method. | |||
/// </remarks> | |||
/// <param name="id">The snowflake identifier of the message.</param> | |||
/// <param name="options">The options to be used when sending the request.</param> | |||
/// <returns> | |||
/// A task that represents an asynchronous get operation for retrieving the message. The task result contains | |||
/// the retrieved message; <c>null</c> if no message is found with the specified identifier. | |||
/// </returns> | |||
public async Task<IMessage> GetMessageAsync(ulong id, RequestOptions options = null) | |||
{ | |||
IMessage msg = _messages?.Get(id); | |||
@@ -88,10 +101,51 @@ namespace Discord.WebSocket | |||
msg = await ChannelHelper.GetMessageAsync(this, Discord, id, options).ConfigureAwait(false); | |||
return msg; | |||
} | |||
/// <summary> | |||
/// Gets the last N messages from this message channel. | |||
/// </summary> | |||
/// <remarks> | |||
/// This method follows the same behavior as described in <see cref="IMessageChannel.GetMessagesAsync(int, CacheMode, RequestOptions)"/>. | |||
/// Please visit its documentation for more details on this method. | |||
/// </remarks> | |||
/// <param name="limit">The numbers of message to be gotten from.</param> | |||
/// <param name="options">The options to be used when sending the request.</param> | |||
/// <returns> | |||
/// Paged collection of messages. | |||
/// </returns> | |||
public IAsyncEnumerable<IReadOnlyCollection<IMessage>> GetMessagesAsync(int limit = DiscordConfig.MaxMessagesPerBatch, RequestOptions options = null) | |||
=> SocketChannelHelper.GetMessagesAsync(this, Discord, _messages, null, Direction.Before, limit, CacheMode.AllowDownload, options); | |||
/// <summary> | |||
/// Gets a collection of messages in this channel. | |||
/// </summary> | |||
/// <remarks> | |||
/// This method follows the same behavior as described in <see cref="IMessageChannel.GetMessagesAsync(ulong, Direction, int, CacheMode, RequestOptions)"/>. | |||
/// Please visit its documentation for more details on this method. | |||
/// </remarks> | |||
/// <param name="fromMessageId">The ID of the starting message to get the messages from.</param> | |||
/// <param name="dir">The direction of the messages to be gotten from.</param> | |||
/// <param name="limit">The numbers of message to be gotten from.</param> | |||
/// <param name="options">The options to be used when sending the request.</param> | |||
/// <returns> | |||
/// Paged collection of messages. | |||
/// </returns> | |||
public IAsyncEnumerable<IReadOnlyCollection<IMessage>> GetMessagesAsync(ulong fromMessageId, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch, RequestOptions options = null) | |||
=> SocketChannelHelper.GetMessagesAsync(this, Discord, _messages, fromMessageId, dir, limit, CacheMode.AllowDownload, options); | |||
/// <summary> | |||
/// Gets a collection of messages in this channel. | |||
/// </summary> | |||
/// <remarks> | |||
/// This method follows the same behavior as described in <see cref="IMessageChannel.GetMessagesAsync(IMessage, Direction, int, CacheMode, RequestOptions)"/>. | |||
/// Please visit its documentation for more details on this method. | |||
/// </remarks> | |||
/// <param name="fromMessage">The starting message to get the messages from.</param> | |||
/// <param name="dir">The direction of the messages to be gotten from.</param> | |||
/// <param name="limit">The numbers of message to be gotten from.</param> | |||
/// <param name="options">The options to be used when sending the request.</param> | |||
/// <returns> | |||
/// Paged collection of messages. | |||
/// </returns> | |||
public IAsyncEnumerable<IReadOnlyCollection<IMessage>> GetMessagesAsync(IMessage fromMessage, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch, RequestOptions options = null) | |||
=> SocketChannelHelper.GetMessagesAsync(this, Discord, _messages, fromMessage.Id, dir, limit, CacheMode.AllowDownload, options); | |||
/// <inheritdoc /> | |||
@@ -82,6 +82,10 @@ namespace Discord.WebSocket | |||
/// <summary> | |||
/// Gets a message from this message channel. | |||
/// </summary> | |||
/// <remarks> | |||
/// This method follows the same behavior as described in <see cref="IMessageChannel.GetMessageAsync"/>. | |||
/// Please visit its documentation for more details on this method. | |||
/// </remarks> | |||
/// <param name="id">The snowflake identifier of the message.</param> | |||
/// <param name="options">The options to be used when sending the request.</param> | |||
/// <returns> | |||
@@ -95,34 +99,14 @@ namespace Discord.WebSocket | |||
msg = await ChannelHelper.GetMessageAsync(this, Discord, id, options).ConfigureAwait(false); | |||
return msg; | |||
} | |||
/// <summary> | |||
/// Gets the last N messages from this message channel. | |||
/// </summary> | |||
/// <remarks> | |||
/// <note type="important"> | |||
/// The returned collection is an asynchronous enumerable object; one must call | |||
/// <see cref="AsyncEnumerableExtensions.FlattenAsync{T}"/> to access the individual messages as a | |||
/// collection. | |||
/// </note> | |||
/// <note type="warning"> | |||
/// 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! | |||
/// </note> | |||
/// This method will attempt to fetch the number of messages specified under <paramref name="limit"/>. The | |||
/// library will attempt to split up the requests according to your <paramref name="limit"/> and | |||
/// <see cref="DiscordConfig.MaxMessagesPerBatch"/>. In other words, should the user request 500 messages, | |||
/// and the <see cref="Discord.DiscordConfig.MaxMessagesPerBatch"/> constant is <c>100</c>, the request will | |||
/// be split into 5 individual requests; thus returning 5 individual asynchronous responses, hence the need | |||
/// of flattening. | |||
/// This method follows the same behavior as described in <see cref="IMessageChannel.GetMessagesAsync(int, CacheMode, RequestOptions)"/>. | |||
/// Please visit its documentation for more details on this method. | |||
/// </remarks> | |||
/// <example> | |||
/// The following example downloads 300 messages and gets messages that belong to the user | |||
/// <c>53905483156684800</c>. | |||
/// <code lang="cs"> | |||
/// var messages = await messageChannel.GetMessagesAsync(300).FlattenAsync(); | |||
/// var userMessages = messages.Where(x => x.Author.Id == 53905483156684800); | |||
/// </code> | |||
/// </example> | |||
/// <param name="limit">The numbers of message to be gotten from.</param> | |||
/// <param name="options">The options to be used when sending the request.</param> | |||
/// <returns> | |||
@@ -134,29 +118,9 @@ namespace Discord.WebSocket | |||
/// Gets a collection of messages in this channel. | |||
/// </summary> | |||
/// <remarks> | |||
/// <note type="important"> | |||
/// The returned collection is an asynchronous enumerable object; one must call | |||
/// <see cref="AsyncEnumerableExtensions.FlattenAsync{T}"/> to access the individual messages as a | |||
/// collection. | |||
/// </note> | |||
/// <note type="warning"> | |||
/// 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! | |||
/// </note> | |||
/// This method will attempt to fetch the number of messages specified under <paramref name="limit"/> around | |||
/// the message <paramref name="fromMessageId"/> depending on the <paramref name="dir"/>. The library will | |||
/// attempt to split up the requests according to your <paramref name="limit"/> and | |||
/// <see cref="DiscordConfig.MaxMessagesPerBatch"/>. In other words, should the user request 500 messages, | |||
/// and the <see cref="Discord.DiscordConfig.MaxMessagesPerBatch"/> constant is <c>100</c>, the request will | |||
/// be split into 5 individual requests; thus returning 5 individual asynchronous responses, hence the need | |||
/// of flattening. | |||
/// This method follows the same behavior as described in <see cref="IMessageChannel.GetMessagesAsync(ulong, Direction, int, CacheMode, RequestOptions)"/>. | |||
/// Please visit its documentation for more details on this method. | |||
/// </remarks> | |||
/// <example> | |||
/// The following example gets 5 message prior to the message identifier <c>442012544660537354</c>. | |||
/// <code lang="cs"> | |||
/// var messages = await channel.GetMessagesAsync(442012544660537354, Direction.Before, 5).FlattenAsync(); | |||
/// </code> | |||
/// </example> | |||
/// <param name="fromMessageId">The ID of the starting message to get the messages from.</param> | |||
/// <param name="dir">The direction of the messages to be gotten from.</param> | |||
/// <param name="limit">The numbers of message to be gotten from.</param> | |||
@@ -170,29 +134,9 @@ namespace Discord.WebSocket | |||
/// Gets a collection of messages in this channel. | |||
/// </summary> | |||
/// <remarks> | |||
/// <note type="important"> | |||
/// The returned collection is an asynchronous enumerable object; one must call | |||
/// <see cref="AsyncEnumerableExtensions.FlattenAsync{T}"/> to access the individual messages as a | |||
/// collection. | |||
/// </note> | |||
/// <note type="warning"> | |||
/// 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! | |||
/// </note> | |||
/// This method will attempt to fetch the number of messages specified under <paramref name="limit"/> around | |||
/// the message <paramref name="fromMessage"/> depending on the <paramref name="dir"/>. The library will | |||
/// attempt to split up the requests according to your <paramref name="limit"/> and | |||
/// <see cref="DiscordConfig.MaxMessagesPerBatch"/>. In other words, should the user request 500 messages, | |||
/// and the <see cref="Discord.DiscordConfig.MaxMessagesPerBatch"/> constant is <c>100</c>, the request will | |||
/// be split into 5 individual requests; thus returning 5 individual asynchronous responses, hence the need | |||
/// of flattening. | |||
/// This method follows the same behavior as described in <see cref="IMessageChannel.GetMessagesAsync(IMessage, Direction, int, CacheMode, RequestOptions)"/>. | |||
/// Please visit its documentation for more details on this method. | |||
/// </remarks> | |||
/// <example> | |||
/// The following example gets 5 message prior to a specific message, <c>oldMessage</c>. | |||
/// <code lang="cs"> | |||
/// var messages = await channel.GetMessagesAsync(oldMessage, Direction.Before, 5).FlattenAsync(); | |||
/// </code> | |||
/// </example> | |||
/// <param name="fromMessage">The starting message to get the messages from.</param> | |||
/// <param name="dir">The direction of the messages to be gotten from.</param> | |||
/// <param name="limit">The numbers of message to be gotten from.</param> | |||