* meta: bump version * meta: bump vers * Fix sticker args * Grammer fix (#179) * Added embeds for SendMessageAsync * [JsonProperty("embed")] forgot to remove this public Optional<Embed> Embed { get; set; } * It has been done as requested. * Changed the old way of handeling single embeds * Moved embeds param and added options param * xmls Co-authored-by: quin lynch <lynchquin@gmail.com>pull/1923/head
@@ -1129,7 +1129,7 @@ | |||||
<seealso cref="T:Discord.Commands.ICommandContext" /> | <seealso cref="T:Discord.Commands.ICommandContext" /> | ||||
<seealso cref="T:Discord.Commands.CommandContext" /> | <seealso cref="T:Discord.Commands.CommandContext" /> | ||||
</member> | </member> | ||||
<member name="M:Discord.Commands.ModuleBase`1.ReplyAsync(System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,Discord.AllowedMentions,Discord.MessageReference,Discord.MessageComponent,Discord.ISticker[])"> | |||||
<member name="M:Discord.Commands.ModuleBase`1.ReplyAsync(System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,Discord.AllowedMentions,Discord.MessageReference,Discord.MessageComponent,Discord.ISticker[],Discord.Embed[])"> | |||||
<summary> | <summary> | ||||
Sends a message to the source channel. | Sends a message to the source channel. | ||||
</summary> | </summary> | ||||
@@ -1138,7 +1138,7 @@ | |||||
</param> | </param> | ||||
<param name="isTTS">Specifies if Discord should read this <paramref name="message"/> aloud using text-to-speech.</param> | <param name="isTTS">Specifies if Discord should read this <paramref name="message"/> aloud using text-to-speech.</param> | ||||
<param name="embed">An embed to be displayed alongside the <paramref name="message"/>.</param> | <param name="embed">An embed to be displayed alongside the <paramref name="message"/>.</param> | ||||
<param name="allowedMentions"> | |||||
<param name="embeds">A array of <see cref="T:Discord.Embed"/>s to send with this response. Max 10</param> /// <param name="allowedMentions"> | |||||
Specifies if notifications are sent for mentioned users and roles in the <paramref name="message"/>. | Specifies if notifications are sent for mentioned users and roles in the <paramref name="message"/>. | ||||
If <c>null</c>, all mentioned roles and users will be notified. | If <c>null</c>, all mentioned roles and users will be notified. | ||||
</param> | </param> | ||||
@@ -36,12 +36,14 @@ namespace Discord.Commands | |||||
/// Specifies if notifications are sent for mentioned users and roles in the <paramref name="message"/>. | /// Specifies if notifications are sent for mentioned users and roles in the <paramref name="message"/>. | ||||
/// If <c>null</c>, all mentioned roles and users will be notified. | /// If <c>null</c>, all mentioned roles and users will be notified. | ||||
/// </param> | /// </param> | ||||
/// <param name="options">The request options for this async request.</param> | |||||
/// <param name="messageReference">The message references to be included. Used to reply to specific messages.</param> | /// <param name="messageReference">The message references to be included. Used to reply to specific messages.</param> | ||||
/// <param name="component">The message components to be included with this message. Used for interactions</param> | /// <param name="component">The message components to be included with this message. Used for interactions</param> | ||||
/// <param name="stickers">A collection of stickers to send with the file.</param> | /// <param name="stickers">A collection of stickers to send with the file.</param> | ||||
protected virtual async Task<IUserMessage> ReplyAsync(string message = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent component = null, ISticker[] stickers = null) | |||||
/// <param name="embeds">A array of <see cref="Embed"/>s to send with this response. Max 10</param> | |||||
protected virtual async Task<IUserMessage> ReplyAsync(string message = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent component = null, ISticker[] stickers = null, Embed[] embeds = null) | |||||
{ | { | ||||
return await Context.Channel.SendMessageAsync(message, isTTS, embed, options, allowedMentions, messageReference, component, stickers).ConfigureAwait(false); | |||||
return await Context.Channel.SendMessageAsync(message, isTTS, embed, options, allowedMentions, messageReference, component, stickers, embeds).ConfigureAwait(false); | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// The method to execute before executing the command. | /// The method to execute before executing the command. | ||||
@@ -1507,7 +1507,7 @@ | |||||
Represents a generic channel that can send and receive messages. | Represents a generic channel that can send and receive messages. | ||||
</summary> | </summary> | ||||
</member> | </member> | ||||
<member name="M:Discord.IMessageChannel.SendMessageAsync(System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,Discord.AllowedMentions,Discord.MessageReference,Discord.MessageComponent,Discord.ISticker[])"> | |||||
<member name="M:Discord.IMessageChannel.SendMessageAsync(System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,Discord.AllowedMentions,Discord.MessageReference,Discord.MessageComponent,Discord.ISticker[],Discord.Embed[])"> | |||||
<summary> | <summary> | ||||
Sends a message to this message channel. | Sends a message to this message channel. | ||||
</summary> | </summary> | ||||
@@ -1528,6 +1528,7 @@ | |||||
<param name="messageReference">The message references to be included. Used to reply to specific messages.</param> | <param name="messageReference">The message references to be included. Used to reply to specific messages.</param> | ||||
<param name="component">The message components to be included with this message. Used for interactions</param> | <param name="component">The message components to be included with this message. Used for interactions</param> | ||||
<param name="stickers">A collection of stickers to send with the message.</param> | <param name="stickers">A collection of stickers to send with the message.</param> | ||||
<param name="embeds">A array of <see cref="T:Discord.Embed"/>s to send with this response. Max 10</param> | |||||
<returns> | <returns> | ||||
A task that represents an asynchronous send operation for delivering the message. The task result | A task that represents an asynchronous send operation for delivering the message. The task result | ||||
contains the sent message. | contains the sent message. | ||||
@@ -11087,13 +11088,14 @@ | |||||
<seealso cref="M:Discord.IMessage.RemoveReactionAsync(Discord.IEmote,Discord.IUser,Discord.RequestOptions)"/> | <seealso cref="M:Discord.IMessage.RemoveReactionAsync(Discord.IEmote,Discord.IUser,Discord.RequestOptions)"/> | ||||
<seealso cref="T:Discord.IEmote"/> | <seealso cref="T:Discord.IEmote"/> | ||||
</member> | </member> | ||||
<member name="M:Discord.MessageExtensions.ReplyAsync(Discord.IUserMessage,System.String,System.Boolean,Discord.Embed,Discord.AllowedMentions,Discord.RequestOptions,Discord.MessageComponent,Discord.ISticker[])"> | |||||
<member name="M:Discord.MessageExtensions.ReplyAsync(Discord.IUserMessage,System.String,System.Boolean,Discord.Embed,Discord.AllowedMentions,Discord.RequestOptions,Discord.MessageComponent,Discord.ISticker[],Discord.Embed[])"> | |||||
<summary> | <summary> | ||||
Sends an inline reply that references a message. | Sends an inline reply that references a message. | ||||
</summary> | </summary> | ||||
<param name="text">The message to be sent.</param> | <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="isTTS">Determines whether the message should be read aloud by Discord or not.</param> | ||||
<param name="embed">The <see cref="F:Discord.EmbedType.Rich"/> <see cref="T:Discord.Embed"/> to be sent.</param> | <param name="embed">The <see cref="F:Discord.EmbedType.Rich"/> <see cref="T:Discord.Embed"/> to be sent.</param> | ||||
<param name="embeds">A array of <see cref="T:Discord.Embed"/>s to send with this response. Max 10</param> | |||||
<param name="allowedMentions"> | <param name="allowedMentions"> | ||||
Specifies if notifications are sent for mentioned users and roles in the message <paramref name="text"/>. | Specifies if notifications are sent for mentioned users and roles in the message <paramref name="text"/>. | ||||
If <c>null</c>, all mentioned roles and users will be notified. | If <c>null</c>, all mentioned roles and users will be notified. | ||||
@@ -11107,7 +11109,7 @@ | |||||
<member name="T:Discord.UserExtensions"> | <member name="T:Discord.UserExtensions"> | ||||
<summary> An extension class for various Discord user objects. </summary> | <summary> An extension class for various Discord user objects. </summary> | ||||
</member> | </member> | ||||
<member name="M:Discord.UserExtensions.SendMessageAsync(Discord.IUser,System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,Discord.AllowedMentions,Discord.MessageComponent)"> | |||||
<member name="M:Discord.UserExtensions.SendMessageAsync(Discord.IUser,System.String,System.Boolean,Discord.Embed,Discord.Embed[],Discord.RequestOptions,Discord.AllowedMentions,Discord.MessageComponent)"> | |||||
<summary> | <summary> | ||||
Sends a message via DM. | Sends a message via DM. | ||||
</summary> | </summary> | ||||
@@ -11128,11 +11130,13 @@ | |||||
<param name="text">The message to be sent.</param> | <param name="text">The message to be sent.</param> | ||||
<param name="isTTS">Whether the message should be read aloud by Discord or not.</param> | <param name="isTTS">Whether the message should be read aloud by Discord or not.</param> | ||||
<param name="embed">The <see cref="F:Discord.EmbedType.Rich"/> <see cref="T:Discord.Embed"/> to be sent.</param> | <param name="embed">The <see cref="F:Discord.EmbedType.Rich"/> <see cref="T:Discord.Embed"/> to be sent.</param> | ||||
<param name="embeds">A array of <see cref="T:Discord.Embed"/>s to send with this response. Max 10</param> | |||||
<param name="options">The options to be used when sending the request.</param> | <param name="options">The options to be used when sending the request.</param> | ||||
<param name="allowedMentions"> | <param name="allowedMentions"> | ||||
Specifies if notifications are sent for mentioned users and roles in the message <paramref name="text"/>. | Specifies if notifications are sent for mentioned users and roles in the message <paramref name="text"/>. | ||||
If <c>null</c>, all mentioned roles and users will be notified. | If <c>null</c>, all mentioned roles and users will be notified. | ||||
</param> | </param> | ||||
<param name="component">The message components to be included with this message. Used for interactions</param> | |||||
<returns> | <returns> | ||||
A task that represents the asynchronous send operation. The task result contains the sent message. | A task that represents the asynchronous send operation. The task result contains the sent message. | ||||
</returns> | </returns> | ||||
@@ -30,11 +30,12 @@ namespace Discord | |||||
/// <param name="messageReference">The message references to be included. Used to reply to specific messages.</param> | /// <param name="messageReference">The message references to be included. Used to reply to specific messages.</param> | ||||
/// <param name="component">The message components to be included with this message. Used for interactions</param> | /// <param name="component">The message components to be included with this message. Used for interactions</param> | ||||
/// <param name="stickers">A collection of stickers to send with the message.</param> | /// <param name="stickers">A collection of stickers to send with the message.</param> | ||||
/// <param name="embeds">A array of <see cref="Embed"/>s to send with this response. Max 10</param> | |||||
/// <returns> | /// <returns> | ||||
/// A task that represents an asynchronous send operation for delivering the message. The task result | /// A task that represents an asynchronous send operation for delivering the message. The task result | ||||
/// contains the sent message. | /// contains the sent message. | ||||
/// </returns> | /// </returns> | ||||
Task<IUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent component = null, ISticker[] stickers = null); | |||||
Task<IUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent component = null, ISticker[] stickers = null, Embed[] embeds = null); | |||||
/// <summary> | /// <summary> | ||||
/// Sends a file to this message channel with an optional caption. | /// Sends a file to this message channel with an optional caption. | ||||
/// </summary> | /// </summary> | ||||
@@ -78,6 +78,7 @@ namespace Discord | |||||
/// <param name="text">The message to be sent.</param> | /// <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="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> | /// <param name="embed">The <see cref="Discord.EmbedType.Rich"/> <see cref="Embed"/> to be sent.</param> | ||||
/// <param name="embeds">A array of <see cref="Embed"/>s to send with this response. Max 10</param> | |||||
/// <param name="allowedMentions"> | /// <param name="allowedMentions"> | ||||
/// Specifies if notifications are sent for mentioned users and roles in the message <paramref name="text"/>. | /// Specifies if notifications are sent for mentioned users and roles in the message <paramref name="text"/>. | ||||
/// If <c>null</c>, all mentioned roles and users will be notified. | /// If <c>null</c>, all mentioned roles and users will be notified. | ||||
@@ -87,9 +88,9 @@ namespace Discord | |||||
/// A task that represents an asynchronous send operation for delivering the message. The task result | /// A task that represents an asynchronous send operation for delivering the message. The task result | ||||
/// contains the sent message. | /// contains the sent message. | ||||
/// </returns> | /// </returns> | ||||
public static async Task<IUserMessage> ReplyAsync(this IUserMessage msg, string text = null, bool isTTS = false, Embed embed = null, AllowedMentions allowedMentions = null, RequestOptions options = null, MessageComponent components = null, ISticker[] stickers = null) | |||||
public static async Task<IUserMessage> ReplyAsync(this IUserMessage msg, string text = null, bool isTTS = false, Embed embed = null, AllowedMentions allowedMentions = null, RequestOptions options = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null) | |||||
{ | { | ||||
return await msg.Channel.SendMessageAsync(text, isTTS, embed, options, allowedMentions, new MessageReference(messageId: msg.Id), components, stickers).ConfigureAwait(false); | |||||
return await msg.Channel.SendMessageAsync(text, isTTS, embed, options, allowedMentions, new MessageReference(messageId: msg.Id), components, stickers, embeds).ConfigureAwait(false); | |||||
} | } | ||||
} | } | ||||
} | } |
@@ -27,11 +27,13 @@ namespace Discord | |||||
/// <param name="text">The message to be sent.</param> | /// <param name="text">The message to be sent.</param> | ||||
/// <param name="isTTS">Whether the message should be read aloud by Discord or not.</param> | /// <param name="isTTS">Whether the message should be read aloud by Discord or not.</param> | ||||
/// <param name="embed">The <see cref="EmbedType.Rich"/> <see cref="Embed"/> to be sent.</param> | /// <param name="embed">The <see cref="EmbedType.Rich"/> <see cref="Embed"/> to be sent.</param> | ||||
/// <param name="embeds">A array of <see cref="Embed"/>s to send with this response. Max 10</param> | |||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <param name="allowedMentions"> | /// <param name="allowedMentions"> | ||||
/// Specifies if notifications are sent for mentioned users and roles in the message <paramref name="text"/>. | /// Specifies if notifications are sent for mentioned users and roles in the message <paramref name="text"/>. | ||||
/// If <c>null</c>, all mentioned roles and users will be notified. | /// If <c>null</c>, all mentioned roles and users will be notified. | ||||
/// </param> | /// </param> | ||||
/// <param name="component">The message components to be included with this message. Used for interactions</param> | |||||
/// <returns> | /// <returns> | ||||
/// A task that represents the asynchronous send operation. The task result contains the sent message. | /// A task that represents the asynchronous send operation. The task result contains the sent message. | ||||
/// </returns> | /// </returns> | ||||
@@ -39,11 +41,12 @@ namespace Discord | |||||
string text = null, | string text = null, | ||||
bool isTTS = false, | bool isTTS = false, | ||||
Embed embed = null, | Embed embed = null, | ||||
Embed[] embeds = null, | |||||
RequestOptions options = null, | RequestOptions options = null, | ||||
AllowedMentions allowedMentions = null, | AllowedMentions allowedMentions = null, | ||||
MessageComponent component = null) | MessageComponent component = null) | ||||
{ | { | ||||
return await (await user.CreateDMChannelAsync().ConfigureAwait(false)).SendMessageAsync(text, isTTS, embed, options, allowedMentions, component: component).ConfigureAwait(false); | |||||
return await (await user.CreateDMChannelAsync().ConfigureAwait(false)).SendMessageAsync(text, isTTS, embed, options, allowedMentions, component: component, embeds: embeds).ConfigureAwait(false); | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||
@@ -15,8 +15,8 @@ namespace Discord.API.Rest | |||||
[JsonProperty("tts")] | [JsonProperty("tts")] | ||||
public Optional<bool> IsTTS { get; set; } | public Optional<bool> IsTTS { get; set; } | ||||
[JsonProperty("embed")] | |||||
public Optional<Embed> Embed { get; set; } | |||||
[JsonProperty("embeds")] | |||||
public Optional<Embed[]> Embeds { get; set; } | |||||
[JsonProperty("allowed_mentions")] | [JsonProperty("allowed_mentions")] | ||||
public Optional<AllowedMentions> AllowedMentions { get; set; } | public Optional<AllowedMentions> AllowedMentions { get; set; } | ||||
@@ -1718,7 +1718,7 @@ | |||||
<paramref name="maxAge"/> must be lesser than 86400. | <paramref name="maxAge"/> must be lesser than 86400. | ||||
</exception> | </exception> | ||||
</member> | </member> | ||||
<member name="M:Discord.Rest.ChannelHelper.SendMessageAsync(Discord.IMessageChannel,Discord.Rest.BaseDiscordClient,System.String,System.Boolean,Discord.Embed,Discord.AllowedMentions,Discord.MessageReference,Discord.MessageComponent,Discord.ISticker[],Discord.RequestOptions)"> | |||||
<member name="M:Discord.Rest.ChannelHelper.SendMessageAsync(Discord.IMessageChannel,Discord.Rest.BaseDiscordClient,System.String,System.Boolean,Discord.Embed,Discord.AllowedMentions,Discord.MessageReference,Discord.MessageComponent,Discord.ISticker[],Discord.RequestOptions,Discord.Embed[])"> | |||||
<exception cref="T:System.ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="F:Discord.DiscordConfig.MaxMessageSize"/>.</exception> | <exception cref="T:System.ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="F:Discord.DiscordConfig.MaxMessageSize"/>.</exception> | ||||
</member> | </member> | ||||
<member name="M:Discord.Rest.ChannelHelper.SendFileAsync(Discord.IMessageChannel,Discord.Rest.BaseDiscordClient,System.String,System.String,System.Boolean,Discord.Embed,Discord.AllowedMentions,Discord.MessageReference,Discord.MessageComponent,Discord.ISticker[],Discord.RequestOptions,System.Boolean)"> | <member name="M:Discord.Rest.ChannelHelper.SendFileAsync(Discord.IMessageChannel,Discord.Rest.BaseDiscordClient,System.String,System.String,System.Boolean,Discord.Embed,Discord.AllowedMentions,Discord.MessageReference,Discord.MessageComponent,Discord.ISticker[],Discord.RequestOptions,System.Boolean)"> | ||||
@@ -1764,12 +1764,12 @@ | |||||
Represents a REST-based channel that can send and receive messages. | Represents a REST-based channel that can send and receive messages. | ||||
</summary> | </summary> | ||||
</member> | </member> | ||||
<member name="M:Discord.Rest.IRestMessageChannel.SendMessageAsync(System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,Discord.AllowedMentions,Discord.MessageReference,Discord.MessageComponent,Discord.ISticker[])"> | |||||
<member name="M:Discord.Rest.IRestMessageChannel.SendMessageAsync(System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,Discord.AllowedMentions,Discord.MessageReference,Discord.MessageComponent,Discord.ISticker[],Discord.Embed[])"> | |||||
<summary> | <summary> | ||||
Sends a message to this message channel. | Sends a message to this message channel. | ||||
</summary> | </summary> | ||||
<remarks> | <remarks> | ||||
This method follows the same behavior as described in <see cref="M:Discord.IMessageChannel.SendMessageAsync(System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,Discord.AllowedMentions,Discord.MessageReference,Discord.MessageComponent,Discord.ISticker[])"/>. | |||||
This method follows the same behavior as described in <see cref="M:Discord.IMessageChannel.SendMessageAsync(System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,Discord.AllowedMentions,Discord.MessageReference,Discord.MessageComponent,Discord.ISticker[],Discord.Embed[])"/>. | |||||
Please visit its documentation for more details on this method. | Please visit its documentation for more details on this method. | ||||
</remarks> | </remarks> | ||||
<param name="text">The message to be sent.</param> | <param name="text">The message to be sent.</param> | ||||
@@ -1783,6 +1783,7 @@ | |||||
<param name="messageReference">The message references to be included. Used to reply to specific messages.</param> | <param name="messageReference">The message references to be included. Used to reply to specific messages.</param> | ||||
<param name="component">The message components to be included with this message. Used for interactions</param> | <param name="component">The message components to be included with this message. Used for interactions</param> | ||||
<param name="stickers">A collection of stickers to send with the message.</param> | <param name="stickers">A collection of stickers to send with the message.</param> | ||||
<param name="embeds">A array of <see cref="T:Discord.Embed"/>s to send with this response. Max 10</param> | |||||
<returns> | <returns> | ||||
A task that represents an asynchronous send operation for delivering the message. The task result | A task that represents an asynchronous send operation for delivering the message. The task result | ||||
contains the sent message. | contains the sent message. | ||||
@@ -2016,7 +2017,7 @@ | |||||
<member name="M:Discord.Rest.RestDMChannel.GetPinnedMessagesAsync(Discord.RequestOptions)"> | <member name="M:Discord.Rest.RestDMChannel.GetPinnedMessagesAsync(Discord.RequestOptions)"> | ||||
<inheritdoc /> | <inheritdoc /> | ||||
</member> | </member> | ||||
<member name="M:Discord.Rest.RestDMChannel.SendMessageAsync(System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,Discord.AllowedMentions,Discord.MessageReference,Discord.MessageComponent,Discord.ISticker[])"> | |||||
<member name="M:Discord.Rest.RestDMChannel.SendMessageAsync(System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,Discord.AllowedMentions,Discord.MessageReference,Discord.MessageComponent,Discord.ISticker[],Discord.Embed[])"> | |||||
<inheritdoc /> | <inheritdoc /> | ||||
<exception cref="T:System.ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="F:Discord.DiscordConfig.MaxMessageSize"/>.</exception> | <exception cref="T:System.ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="F:Discord.DiscordConfig.MaxMessageSize"/>.</exception> | ||||
</member> | </member> | ||||
@@ -2104,7 +2105,7 @@ | |||||
<member name="M:Discord.Rest.RestDMChannel.Discord#IMessageChannel#SendFileAsync(System.IO.Stream,System.String,System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,System.Boolean,Discord.AllowedMentions,Discord.MessageReference,Discord.MessageComponent,Discord.ISticker[])"> | <member name="M:Discord.Rest.RestDMChannel.Discord#IMessageChannel#SendFileAsync(System.IO.Stream,System.String,System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,System.Boolean,Discord.AllowedMentions,Discord.MessageReference,Discord.MessageComponent,Discord.ISticker[])"> | ||||
<inheritdoc /> | <inheritdoc /> | ||||
</member> | </member> | ||||
<member name="M:Discord.Rest.RestDMChannel.Discord#IMessageChannel#SendMessageAsync(System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,Discord.AllowedMentions,Discord.MessageReference,Discord.MessageComponent,Discord.ISticker[])"> | |||||
<member name="M:Discord.Rest.RestDMChannel.Discord#IMessageChannel#SendMessageAsync(System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,Discord.AllowedMentions,Discord.MessageReference,Discord.MessageComponent,Discord.ISticker[],Discord.Embed[])"> | |||||
<inheritdoc /> | <inheritdoc /> | ||||
</member> | </member> | ||||
<member name="P:Discord.Rest.RestDMChannel.Discord#IChannel#Name"> | <member name="P:Discord.Rest.RestDMChannel.Discord#IChannel#Name"> | ||||
@@ -2154,7 +2155,7 @@ | |||||
<member name="M:Discord.Rest.RestGroupChannel.ModifyMessageAsync(System.UInt64,System.Action{Discord.MessageProperties},Discord.RequestOptions)"> | <member name="M:Discord.Rest.RestGroupChannel.ModifyMessageAsync(System.UInt64,System.Action{Discord.MessageProperties},Discord.RequestOptions)"> | ||||
<inheritdoc /> | <inheritdoc /> | ||||
</member> | </member> | ||||
<member name="M:Discord.Rest.RestGroupChannel.SendMessageAsync(System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,Discord.AllowedMentions,Discord.MessageReference,Discord.MessageComponent,Discord.ISticker[])"> | |||||
<member name="M:Discord.Rest.RestGroupChannel.SendMessageAsync(System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,Discord.AllowedMentions,Discord.MessageReference,Discord.MessageComponent,Discord.ISticker[],Discord.Embed[])"> | |||||
<inheritdoc /> | <inheritdoc /> | ||||
<exception cref="T:System.ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="F:Discord.DiscordConfig.MaxMessageSize"/>.</exception> | <exception cref="T:System.ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="F:Discord.DiscordConfig.MaxMessageSize"/>.</exception> | ||||
</member> | </member> | ||||
@@ -2444,7 +2445,7 @@ | |||||
<member name="M:Discord.Rest.RestTextChannel.GetPinnedMessagesAsync(Discord.RequestOptions)"> | <member name="M:Discord.Rest.RestTextChannel.GetPinnedMessagesAsync(Discord.RequestOptions)"> | ||||
<inheritdoc /> | <inheritdoc /> | ||||
</member> | </member> | ||||
<member name="M:Discord.Rest.RestTextChannel.SendMessageAsync(System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,Discord.AllowedMentions,Discord.MessageReference,Discord.MessageComponent,Discord.ISticker[])"> | |||||
<member name="M:Discord.Rest.RestTextChannel.SendMessageAsync(System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,Discord.AllowedMentions,Discord.MessageReference,Discord.MessageComponent,Discord.ISticker[],Discord.Embed[])"> | |||||
<inheritdoc /> | <inheritdoc /> | ||||
<exception cref="T:System.ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="F:Discord.DiscordConfig.MaxMessageSize"/>.</exception> | <exception cref="T:System.ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="F:Discord.DiscordConfig.MaxMessageSize"/>.</exception> | ||||
</member> | </member> | ||||
@@ -2614,7 +2615,7 @@ | |||||
<member name="M:Discord.Rest.RestTextChannel.Discord#IMessageChannel#SendFileAsync(System.IO.Stream,System.String,System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,System.Boolean,Discord.AllowedMentions,Discord.MessageReference,Discord.MessageComponent,Discord.ISticker[])"> | <member name="M:Discord.Rest.RestTextChannel.Discord#IMessageChannel#SendFileAsync(System.IO.Stream,System.String,System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,System.Boolean,Discord.AllowedMentions,Discord.MessageReference,Discord.MessageComponent,Discord.ISticker[])"> | ||||
<inheritdoc /> | <inheritdoc /> | ||||
</member> | </member> | ||||
<member name="M:Discord.Rest.RestTextChannel.Discord#IMessageChannel#SendMessageAsync(System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,Discord.AllowedMentions,Discord.MessageReference,Discord.MessageComponent,Discord.ISticker[])"> | |||||
<member name="M:Discord.Rest.RestTextChannel.Discord#IMessageChannel#SendMessageAsync(System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,Discord.AllowedMentions,Discord.MessageReference,Discord.MessageComponent,Discord.ISticker[],Discord.Embed[])"> | |||||
<inheritdoc /> | <inheritdoc /> | ||||
</member> | </member> | ||||
<member name="M:Discord.Rest.RestTextChannel.Discord#IGuildChannel#GetUserAsync(System.UInt64,Discord.CacheMode,Discord.RequestOptions)"> | <member name="M:Discord.Rest.RestTextChannel.Discord#IGuildChannel#GetUserAsync(System.UInt64,Discord.CacheMode,Discord.RequestOptions)"> | ||||
@@ -745,7 +745,7 @@ namespace Discord.API | |||||
{ | { | ||||
Preconditions.NotNull(args, nameof(args)); | Preconditions.NotNull(args, nameof(args)); | ||||
Preconditions.NotEqual(channelId, 0, nameof(channelId)); | Preconditions.NotEqual(channelId, 0, nameof(channelId)); | ||||
if ((!args.Embed.IsSpecified || args.Embed.Value == null) && (!args.Stickers.IsSpecified || args.Stickers.Value == null || args.Stickers.Value.Length == 0)) | |||||
if ((!args.Embeds.IsSpecified || args.Embeds.Value == null || args.Embeds.Value.Length == 0) && (!args.Stickers.IsSpecified || args.Stickers.Value == null || args.Stickers.Value.Length == 0)) | |||||
Preconditions.NotNullOrEmpty(args.Content, nameof(args.Content)); | Preconditions.NotNullOrEmpty(args.Content, nameof(args.Content)); | ||||
if (args.Content?.Length > DiscordConfig.MaxMessageSize) | if (args.Content?.Length > DiscordConfig.MaxMessageSize) | ||||
@@ -266,10 +266,22 @@ namespace Discord.Rest | |||||
/// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception> | /// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception> | ||||
public static async Task<RestUserMessage> SendMessageAsync(IMessageChannel channel, BaseDiscordClient client, | public static async Task<RestUserMessage> SendMessageAsync(IMessageChannel channel, BaseDiscordClient client, | ||||
string text, bool isTTS, Embed embed, AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent component, ISticker[] stickers, RequestOptions options) | |||||
string text, bool isTTS, Embed embed, AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent component, ISticker[] stickers, RequestOptions options, Embed[] embeds) | |||||
{ | { | ||||
if (embed != null) | |||||
{ | |||||
if (embeds == null) | |||||
embeds = new[] { embed }; | |||||
else | |||||
{ | |||||
List<Embed> listEmbeds = embeds.ToList(); | |||||
listEmbeds.Insert(0, embed); | |||||
} | |||||
} | |||||
Preconditions.AtMost(allowedMentions?.RoleIds?.Count ?? 0, 100, nameof(allowedMentions.RoleIds), "A max of 100 role Ids are allowed."); | Preconditions.AtMost(allowedMentions?.RoleIds?.Count ?? 0, 100, nameof(allowedMentions.RoleIds), "A max of 100 role Ids are allowed."); | ||||
Preconditions.AtMost(allowedMentions?.UserIds?.Count ?? 0, 100, nameof(allowedMentions.UserIds), "A max of 100 user Ids are allowed."); | Preconditions.AtMost(allowedMentions?.UserIds?.Count ?? 0, 100, nameof(allowedMentions.UserIds), "A max of 100 user Ids are allowed."); | ||||
Preconditions.AtMost(embeds?.Length ?? 0, 10, nameof(embeds), "A max of 10 embeds are allowed."); | |||||
// check that user flag and user Id list are exclusive, same with role flag and role Id list | // check that user flag and user Id list are exclusive, same with role flag and role Id list | ||||
if (allowedMentions != null && allowedMentions.AllowedTypes.HasValue) | if (allowedMentions != null && allowedMentions.AllowedTypes.HasValue) | ||||
@@ -292,7 +304,15 @@ namespace Discord.Rest | |||||
Preconditions.AtMost(stickers.Length, 3, nameof(stickers), "A max of 3 stickers are allowed."); | Preconditions.AtMost(stickers.Length, 3, nameof(stickers), "A max of 3 stickers are allowed."); | ||||
} | } | ||||
var args = new CreateMessageParams(text) { IsTTS = isTTS, Embed = embed?.ToModel(), AllowedMentions = allowedMentions?.ToModel(), MessageReference = messageReference?.ToModel(), Components = component?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ?? Optional<API.ActionRowComponent[]>.Unspecified, Stickers = stickers?.Any() ?? false ? stickers.Select(x => x.Id).ToArray() : Optional<ulong[]>.Unspecified }; | |||||
var args = new CreateMessageParams(text) | |||||
{ | |||||
IsTTS = isTTS, | |||||
Embeds = embeds?.Select(x => x.ToModel()).ToArray() ?? Optional<API.Embed[]>.Unspecified, | |||||
AllowedMentions = allowedMentions?.ToModel(), | |||||
MessageReference = messageReference?.ToModel(), | |||||
Components = component?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ?? Optional<API.ActionRowComponent[]>.Unspecified, | |||||
Stickers = stickers?.Any() ?? false ? stickers.Select(x => x.Id).ToArray() : Optional<ulong[]>.Unspecified | |||||
}; | |||||
var model = await client.ApiClient.CreateMessageAsync(channel.Id, args, options).ConfigureAwait(false); | var model = await client.ApiClient.CreateMessageAsync(channel.Id, args, options).ConfigureAwait(false); | ||||
return RestUserMessage.Create(client, channel, client.CurrentUser, model); | return RestUserMessage.Create(client, channel, client.CurrentUser, model); | ||||
} | } | ||||
@@ -27,11 +27,12 @@ namespace Discord.Rest | |||||
/// <param name="messageReference">The message references to be included. Used to reply to specific messages.</param> | /// <param name="messageReference">The message references to be included. Used to reply to specific messages.</param> | ||||
/// <param name="component">The message components to be included with this message. Used for interactions</param> | /// <param name="component">The message components to be included with this message. Used for interactions</param> | ||||
/// <param name="stickers">A collection of stickers to send with the message.</param> | /// <param name="stickers">A collection of stickers to send with the message.</param> | ||||
/// <param name="embeds">A array of <see cref="Embed"/>s to send with this response. Max 10</param> | |||||
/// <returns> | /// <returns> | ||||
/// A task that represents an asynchronous send operation for delivering the message. The task result | /// A task that represents an asynchronous send operation for delivering the message. The task result | ||||
/// contains the sent message. | /// contains the sent message. | ||||
/// </returns> | /// </returns> | ||||
new Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent component = null, ISticker[] stickers = null); | |||||
new Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent component = null, ISticker[] stickers = null, Embed[] embeds = null); | |||||
/// <summary> | /// <summary> | ||||
/// Sends a file to this message channel with an optional caption. | /// Sends a file to this message channel with an optional caption. | ||||
/// </summary> | /// </summary> | ||||
@@ -94,8 +94,8 @@ namespace Discord.Rest | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
/// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception> | /// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception> | ||||
public Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent component = null, ISticker[] stickers = null) | |||||
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, allowedMentions, messageReference, component, stickers, options); | |||||
public Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent component = null, ISticker[] stickers = null, Embed[] embeds = null) | |||||
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, allowedMentions, messageReference, component, stickers, options, embeds); | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
/// <exception cref="ArgumentException"> | /// <exception cref="ArgumentException"> | ||||
@@ -215,8 +215,8 @@ namespace Discord.Rest | |||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS, Embed embed, RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent component, ISticker[] stickers) | async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS, Embed embed, RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent component, ISticker[] stickers) | ||||
=> await SendFileAsync(stream, filename, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference, component, stickers).ConfigureAwait(false); | => await SendFileAsync(stream, filename, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference, component, stickers).ConfigureAwait(false); | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent component, ISticker[] stickers) | |||||
=> await SendMessageAsync(text, isTTS, embed, options, allowedMentions, messageReference, component, stickers).ConfigureAwait(false); | |||||
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent component, ISticker[] stickers, Embed[] embeds) | |||||
=> await SendMessageAsync(text, isTTS, embed, options, allowedMentions, messageReference, component, stickers, embeds).ConfigureAwait(false); | |||||
#endregion | #endregion | ||||
#region IChannel | #region IChannel | ||||
@@ -100,8 +100,8 @@ namespace Discord.Rest | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
/// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception> | /// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception> | ||||
public Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent component = null, ISticker[] stickers = null) | |||||
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, allowedMentions, messageReference, component, stickers, options); | |||||
public Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent component = null, ISticker[] stickers = null, Embed[] embeds = null) | |||||
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, allowedMentions, messageReference, component, stickers, options, embeds); | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
/// <exception cref="ArgumentException"> | /// <exception cref="ArgumentException"> | ||||
@@ -133,7 +133,7 @@ namespace Discord.Rest | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
/// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception> | /// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception> | ||||
public Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text, bool isTTS = false, Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent component = null, ISticker[] stickers = null) | public Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text, bool isTTS = false, Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent component = null, ISticker[] stickers = null) | ||||
=> ChannelHelper.SendFileAsync(this, Discord, stream, filename, text, isTTS, embed, allowedMentions, messageReference, component, stickers,options, isSpoiler); | |||||
=> ChannelHelper.SendFileAsync(this, Discord, stream, filename, text, isTTS, embed, allowedMentions, messageReference, component, stickers, options, isSpoiler); | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public Task TriggerTypingAsync(RequestOptions options = null) | public Task TriggerTypingAsync(RequestOptions options = null) | ||||
@@ -192,8 +192,8 @@ namespace Discord.Rest | |||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS, Embed embed, RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent component, ISticker[] stickers) | async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS, Embed embed, RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent component, ISticker[] stickers) | ||||
=> await SendFileAsync(stream, filename, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference, component, stickers).ConfigureAwait(false); | => await SendFileAsync(stream, filename, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference, component, stickers).ConfigureAwait(false); | ||||
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent component, ISticker[] stickers) | |||||
=> await SendMessageAsync(text, isTTS, embed, options, allowedMentions, messageReference, component, stickers).ConfigureAwait(false); | |||||
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent component, ISticker[] stickers, Embed[] embeds) | |||||
=> await SendMessageAsync(text, isTTS, embed, options, allowedMentions, messageReference, component, stickers, embeds).ConfigureAwait(false); | |||||
#endregion | #endregion | ||||
#region IAudioChannel | #region IAudioChannel | ||||
@@ -103,8 +103,8 @@ namespace Discord.Rest | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
/// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception> | /// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception> | ||||
public Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent component = null, ISticker[] stickers = null) | |||||
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, allowedMentions, messageReference, component, stickers, options); | |||||
public Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent component = null, ISticker[] stickers = null, Embed[] embeds = null) | |||||
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, allowedMentions, messageReference, component, stickers, options, embeds); | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
/// <exception cref="ArgumentException"> | /// <exception cref="ArgumentException"> | ||||
@@ -326,8 +326,8 @@ namespace Discord.Rest | |||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS, Embed embed, RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent component, ISticker[] stickers) | async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS, Embed embed, RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent component, ISticker[] stickers) | ||||
=> await SendFileAsync(stream, filename, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference, component, stickers).ConfigureAwait(false); | => await SendFileAsync(stream, filename, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference, component, stickers).ConfigureAwait(false); | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent component, ISticker[] stickers) | |||||
=> await SendMessageAsync(text, isTTS, embed, options, allowedMentions, messageReference, component, stickers).ConfigureAwait(false); | |||||
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent component, ISticker[] stickers, Embed[] embeds) | |||||
=> await SendMessageAsync(text, isTTS, embed, options, allowedMentions, messageReference, component, stickers, embeds).ConfigureAwait(false); | |||||
#endregion | #endregion | ||||
#region IGuildChannel | #region IGuildChannel | ||||
@@ -1457,12 +1457,12 @@ | |||||
A read-only collection of WebSocket-based messages. | A read-only collection of WebSocket-based messages. | ||||
</returns> | </returns> | ||||
</member> | </member> | ||||
<member name="M:Discord.WebSocket.ISocketMessageChannel.SendMessageAsync(System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,Discord.AllowedMentions,Discord.MessageReference,Discord.MessageComponent,Discord.ISticker[])"> | |||||
<member name="M:Discord.WebSocket.ISocketMessageChannel.SendMessageAsync(System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,Discord.AllowedMentions,Discord.MessageReference,Discord.MessageComponent,Discord.ISticker[],Discord.Embed[])"> | |||||
<summary> | <summary> | ||||
Sends a message to this message channel. | Sends a message to this message channel. | ||||
</summary> | </summary> | ||||
<remarks> | <remarks> | ||||
This method follows the same behavior as described in <see cref="M:Discord.IMessageChannel.SendMessageAsync(System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,Discord.AllowedMentions,Discord.MessageReference,Discord.MessageComponent,Discord.ISticker[])"/>. | |||||
This method follows the same behavior as described in <see cref="M:Discord.IMessageChannel.SendMessageAsync(System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,Discord.AllowedMentions,Discord.MessageReference,Discord.MessageComponent,Discord.ISticker[],Discord.Embed[])"/>. | |||||
Please visit its documentation for more details on this method. | Please visit its documentation for more details on this method. | ||||
</remarks> | </remarks> | ||||
<param name="text">The message to be sent.</param> | <param name="text">The message to be sent.</param> | ||||
@@ -1476,6 +1476,7 @@ | |||||
<param name="messageReference">The message references to be included. Used to reply to specific messages.</param> | <param name="messageReference">The message references to be included. Used to reply to specific messages.</param> | ||||
<param name="component">The message components to be included with this message. Used for interactions</param> | <param name="component">The message components to be included with this message. Used for interactions</param> | ||||
<param name="stickers">A collection of stickers to send with the message.</param> | <param name="stickers">A collection of stickers to send with the message.</param> | ||||
<param name="embeds">A array of <see cref="T:Discord.Embed"/>s to send with this response. Max 10</param> | |||||
<returns> | <returns> | ||||
A task that represents an asynchronous send operation for delivering the message. The task result | A task that represents an asynchronous send operation for delivering the message. The task result | ||||
contains the sent message. | contains the sent message. | ||||
@@ -1811,7 +1812,7 @@ | |||||
<member name="M:Discord.WebSocket.SocketDMChannel.GetPinnedMessagesAsync(Discord.RequestOptions)"> | <member name="M:Discord.WebSocket.SocketDMChannel.GetPinnedMessagesAsync(Discord.RequestOptions)"> | ||||
<inheritdoc /> | <inheritdoc /> | ||||
</member> | </member> | ||||
<member name="M:Discord.WebSocket.SocketDMChannel.SendMessageAsync(System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,Discord.AllowedMentions,Discord.MessageReference,Discord.MessageComponent,Discord.ISticker[])"> | |||||
<member name="M:Discord.WebSocket.SocketDMChannel.SendMessageAsync(System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,Discord.AllowedMentions,Discord.MessageReference,Discord.MessageComponent,Discord.ISticker[],Discord.Embed[])"> | |||||
<inheritdoc /> | <inheritdoc /> | ||||
<exception cref="T:System.ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="F:Discord.DiscordConfig.MaxMessageSize"/>.</exception> | <exception cref="T:System.ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="F:Discord.DiscordConfig.MaxMessageSize"/>.</exception> | ||||
</member> | </member> | ||||
@@ -1887,7 +1888,7 @@ | |||||
<member name="M:Discord.WebSocket.SocketDMChannel.Discord#IMessageChannel#SendFileAsync(System.IO.Stream,System.String,System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,System.Boolean,Discord.AllowedMentions,Discord.MessageReference,Discord.MessageComponent,Discord.ISticker[])"> | <member name="M:Discord.WebSocket.SocketDMChannel.Discord#IMessageChannel#SendFileAsync(System.IO.Stream,System.String,System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,System.Boolean,Discord.AllowedMentions,Discord.MessageReference,Discord.MessageComponent,Discord.ISticker[])"> | ||||
<inheritdoc /> | <inheritdoc /> | ||||
</member> | </member> | ||||
<member name="M:Discord.WebSocket.SocketDMChannel.Discord#IMessageChannel#SendMessageAsync(System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,Discord.AllowedMentions,Discord.MessageReference,Discord.MessageComponent,Discord.ISticker[])"> | |||||
<member name="M:Discord.WebSocket.SocketDMChannel.Discord#IMessageChannel#SendMessageAsync(System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,Discord.AllowedMentions,Discord.MessageReference,Discord.MessageComponent,Discord.ISticker[],Discord.Embed[])"> | |||||
<inheritdoc /> | <inheritdoc /> | ||||
</member> | </member> | ||||
<member name="P:Discord.WebSocket.SocketDMChannel.Discord#IChannel#Name"> | <member name="P:Discord.WebSocket.SocketDMChannel.Discord#IChannel#Name"> | ||||
@@ -2002,7 +2003,7 @@ | |||||
<member name="M:Discord.WebSocket.SocketGroupChannel.GetPinnedMessagesAsync(Discord.RequestOptions)"> | <member name="M:Discord.WebSocket.SocketGroupChannel.GetPinnedMessagesAsync(Discord.RequestOptions)"> | ||||
<inheritdoc /> | <inheritdoc /> | ||||
</member> | </member> | ||||
<member name="M:Discord.WebSocket.SocketGroupChannel.SendMessageAsync(System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,Discord.AllowedMentions,Discord.MessageReference,Discord.MessageComponent,Discord.ISticker[])"> | |||||
<member name="M:Discord.WebSocket.SocketGroupChannel.SendMessageAsync(System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,Discord.AllowedMentions,Discord.MessageReference,Discord.MessageComponent,Discord.ISticker[],Discord.Embed[])"> | |||||
<inheritdoc /> | <inheritdoc /> | ||||
<exception cref="T:System.ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="F:Discord.DiscordConfig.MaxMessageSize"/>.</exception> | <exception cref="T:System.ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="F:Discord.DiscordConfig.MaxMessageSize"/>.</exception> | ||||
</member> | </member> | ||||
@@ -2075,7 +2076,7 @@ | |||||
<member name="M:Discord.WebSocket.SocketGroupChannel.Discord#IMessageChannel#SendFileAsync(System.IO.Stream,System.String,System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,System.Boolean,Discord.AllowedMentions,Discord.MessageReference,Discord.MessageComponent,Discord.ISticker[])"> | <member name="M:Discord.WebSocket.SocketGroupChannel.Discord#IMessageChannel#SendFileAsync(System.IO.Stream,System.String,System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,System.Boolean,Discord.AllowedMentions,Discord.MessageReference,Discord.MessageComponent,Discord.ISticker[])"> | ||||
<inheritdoc /> | <inheritdoc /> | ||||
</member> | </member> | ||||
<member name="M:Discord.WebSocket.SocketGroupChannel.Discord#IMessageChannel#SendMessageAsync(System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,Discord.AllowedMentions,Discord.MessageReference,Discord.MessageComponent,Discord.ISticker[])"> | |||||
<member name="M:Discord.WebSocket.SocketGroupChannel.Discord#IMessageChannel#SendMessageAsync(System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,Discord.AllowedMentions,Discord.MessageReference,Discord.MessageComponent,Discord.ISticker[],Discord.Embed[])"> | |||||
<inheritdoc /> | <inheritdoc /> | ||||
</member> | </member> | ||||
<member name="M:Discord.WebSocket.SocketGroupChannel.Discord#IAudioChannel#ConnectAsync(System.Boolean,System.Boolean,System.Boolean)"> | <member name="M:Discord.WebSocket.SocketGroupChannel.Discord#IAudioChannel#ConnectAsync(System.Boolean,System.Boolean,System.Boolean)"> | ||||
@@ -2459,7 +2460,7 @@ | |||||
<member name="M:Discord.WebSocket.SocketTextChannel.GetPinnedMessagesAsync(Discord.RequestOptions)"> | <member name="M:Discord.WebSocket.SocketTextChannel.GetPinnedMessagesAsync(Discord.RequestOptions)"> | ||||
<inheritdoc /> | <inheritdoc /> | ||||
</member> | </member> | ||||
<member name="M:Discord.WebSocket.SocketTextChannel.SendMessageAsync(System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,Discord.AllowedMentions,Discord.MessageReference,Discord.MessageComponent,Discord.ISticker[])"> | |||||
<member name="M:Discord.WebSocket.SocketTextChannel.SendMessageAsync(System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,Discord.AllowedMentions,Discord.MessageReference,Discord.MessageComponent,Discord.ISticker[],Discord.Embed[])"> | |||||
<inheritdoc /> | <inheritdoc /> | ||||
<exception cref="T:System.ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="F:Discord.DiscordConfig.MaxMessageSize"/>.</exception> | <exception cref="T:System.ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="F:Discord.DiscordConfig.MaxMessageSize"/>.</exception> | ||||
</member> | </member> | ||||
@@ -2578,7 +2579,7 @@ | |||||
<member name="M:Discord.WebSocket.SocketTextChannel.Discord#IMessageChannel#SendFileAsync(System.IO.Stream,System.String,System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,System.Boolean,Discord.AllowedMentions,Discord.MessageReference,Discord.MessageComponent,Discord.ISticker[])"> | <member name="M:Discord.WebSocket.SocketTextChannel.Discord#IMessageChannel#SendFileAsync(System.IO.Stream,System.String,System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,System.Boolean,Discord.AllowedMentions,Discord.MessageReference,Discord.MessageComponent,Discord.ISticker[])"> | ||||
<inheritdoc /> | <inheritdoc /> | ||||
</member> | </member> | ||||
<member name="M:Discord.WebSocket.SocketTextChannel.Discord#IMessageChannel#SendMessageAsync(System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,Discord.AllowedMentions,Discord.MessageReference,Discord.MessageComponent,Discord.ISticker[])"> | |||||
<member name="M:Discord.WebSocket.SocketTextChannel.Discord#IMessageChannel#SendMessageAsync(System.String,System.Boolean,Discord.Embed,Discord.RequestOptions,Discord.AllowedMentions,Discord.MessageReference,Discord.MessageComponent,Discord.ISticker[],Discord.Embed[])"> | |||||
<inheritdoc /> | <inheritdoc /> | ||||
</member> | </member> | ||||
<member name="M:Discord.WebSocket.SocketTextChannel.Discord#INestedChannel#GetCategoryAsync(Discord.CacheMode,Discord.RequestOptions)"> | <member name="M:Discord.WebSocket.SocketTextChannel.Discord#INestedChannel#GetCategoryAsync(Discord.CacheMode,Discord.RequestOptions)"> | ||||
@@ -36,11 +36,12 @@ namespace Discord.WebSocket | |||||
/// <param name="messageReference">The message references to be included. Used to reply to specific messages.</param> | /// <param name="messageReference">The message references to be included. Used to reply to specific messages.</param> | ||||
/// <param name="component">The message components to be included with this message. Used for interactions</param> | /// <param name="component">The message components to be included with this message. Used for interactions</param> | ||||
/// <param name="stickers">A collection of stickers to send with the message.</param> | /// <param name="stickers">A collection of stickers to send with the message.</param> | ||||
/// <param name="embeds">A array of <see cref="Embed"/>s to send with this response. Max 10</param> | |||||
/// <returns> | /// <returns> | ||||
/// A task that represents an asynchronous send operation for delivering the message. The task result | /// A task that represents an asynchronous send operation for delivering the message. The task result | ||||
/// contains the sent message. | /// contains the sent message. | ||||
/// </returns> | /// </returns> | ||||
new Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent component = null, ISticker[] stickers = null); | |||||
new Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent component = null, ISticker[] stickers = null, Embed[] embeds = null); | |||||
/// <summary> | /// <summary> | ||||
/// Sends a file to this message channel with an optional caption. | /// Sends a file to this message channel with an optional caption. | ||||
/// </summary> | /// </summary> | ||||
@@ -59,7 +59,7 @@ namespace Discord.WebSocket | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public Task CloseAsync(RequestOptions options = null) | public Task CloseAsync(RequestOptions options = null) | ||||
=> ChannelHelper.DeleteAsync(this, Discord, options); | => ChannelHelper.DeleteAsync(this, Discord, options); | ||||
#endregion | |||||
#endregion | |||||
#region Messages | #region Messages | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
@@ -139,8 +139,8 @@ namespace Discord.WebSocket | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
/// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception> | /// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception> | ||||
public Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent component = null, ISticker[] stickers = null) | |||||
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, allowedMentions, messageReference, component, stickers, options); | |||||
public Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent component = null, ISticker[] stickers = null, Embed[] embeds = null) | |||||
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, allowedMentions, messageReference, component, stickers, options, embeds); | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS = false, Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent component = null, ISticker[] stickers = null) | public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS = false, Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent component = null, ISticker[] stickers = null) | ||||
@@ -252,8 +252,8 @@ namespace Discord.WebSocket | |||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS, Embed embed, RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent component, ISticker[] stickers) | async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS, Embed embed, RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent component, ISticker[] stickers) | ||||
=> await SendFileAsync(stream, filename, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference, component, stickers).ConfigureAwait(false); | => await SendFileAsync(stream, filename, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference, component, stickers).ConfigureAwait(false); | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent component, ISticker[] stickers) | |||||
=> await SendMessageAsync(text, isTTS, embed, options, allowedMentions, messageReference, component, stickers).ConfigureAwait(false); | |||||
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent component, ISticker[] stickers, Embed[] embeds) | |||||
=> await SendMessageAsync(text, isTTS, embed, options, allowedMentions, messageReference, component, stickers, embeds).ConfigureAwait(false); | |||||
#endregion | #endregion | ||||
#region IChannel | #region IChannel | ||||
@@ -173,8 +173,8 @@ namespace Discord.WebSocket | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
/// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception> | /// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception> | ||||
public Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent component = null, ISticker[] stickers = null) | |||||
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, allowedMentions, messageReference, component, stickers, options); | |||||
public Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent component = null, ISticker[] stickers = null, Embed[] embeds = null) | |||||
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, allowedMentions, messageReference, component, stickers, options, embeds); | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS = false, Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent component = null, ISticker[] stickers = null) | public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS = false, Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent component = null, ISticker[] stickers = null) | ||||
@@ -320,8 +320,8 @@ namespace Discord.WebSocket | |||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS, Embed embed, RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent component, ISticker[] stickers) | async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS, Embed embed, RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent component, ISticker[] stickers) | ||||
=> await SendFileAsync(stream, filename, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference, component, stickers).ConfigureAwait(false); | => await SendFileAsync(stream, filename, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference, component, stickers).ConfigureAwait(false); | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent component, ISticker[] stickers) | |||||
=> await SendMessageAsync(text, isTTS, embed, options, allowedMentions, messageReference, component, stickers).ConfigureAwait(false); | |||||
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent component, ISticker[] stickers, Embed[] embeds) | |||||
=> await SendMessageAsync(text, isTTS, embed, options, allowedMentions, messageReference, component, stickers, embeds).ConfigureAwait(false); | |||||
#endregion | #endregion | ||||
#region IAudioChannel | #region IAudioChannel | ||||
@@ -211,8 +211,8 @@ namespace Discord.WebSocket | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
/// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception> | /// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception> | ||||
public Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent component = null, ISticker[] stickers = null) | |||||
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, allowedMentions, messageReference, component, stickers, options); | |||||
public Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent component = null, ISticker[] stickers = null, Embed[] embeds = null) | |||||
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, allowedMentions, messageReference, component, stickers, options, embeds); | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS = false, Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent component = null, ISticker[] stickers = null) | public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS = false, Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent component = null, ISticker[] stickers = null) | ||||
@@ -377,8 +377,8 @@ namespace Discord.WebSocket | |||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS, Embed embed, RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent component, ISticker[] stickers) | async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS, Embed embed, RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent component, ISticker[] stickers) | ||||
=> await SendFileAsync(stream, filename, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference, component, stickers).ConfigureAwait(false); | => await SendFileAsync(stream, filename, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference, component, stickers).ConfigureAwait(false); | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent component, ISticker[] stickers) | |||||
=> await SendMessageAsync(text, isTTS, embed, options, allowedMentions, messageReference, component, stickers).ConfigureAwait(false); | |||||
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent component, ISticker[] stickers, Embed[] embeds) | |||||
=> await SendMessageAsync(text, isTTS, embed, options, allowedMentions, messageReference, component, stickers, embeds).ConfigureAwait(false); | |||||
#endregion | #endregion | ||||
#region INestedChannel | #region INestedChannel | ||||
@@ -83,8 +83,17 @@ namespace Discord.WebSocket | |||||
{ | { | ||||
if (!IsValidToken) | if (!IsValidToken) | ||||
throw new InvalidOperationException("Interaction token is no longer valid"); | throw new InvalidOperationException("Interaction token is no longer valid"); | ||||
if (embeds == null && embed != null) | |||||
embeds = new[] { embed }; | |||||
if (embed != null) | |||||
{ | |||||
if (embeds == null) | |||||
embeds = new[] { embed }; | |||||
else | |||||
{ | |||||
List<Embed> listEmbeds = embeds.ToList(); | |||||
listEmbeds.Insert(0, embed); | |||||
} | |||||
} | |||||
Preconditions.AtMost(allowedMentions?.RoleIds?.Count ?? 0, 100, nameof(allowedMentions.RoleIds), "A max of 100 role Ids are allowed."); | Preconditions.AtMost(allowedMentions?.RoleIds?.Count ?? 0, 100, nameof(allowedMentions.RoleIds), "A max of 100 role Ids are allowed."); | ||||
Preconditions.AtMost(allowedMentions?.UserIds?.Count ?? 0, 100, nameof(allowedMentions.UserIds), "A max of 100 user Ids are allowed."); | Preconditions.AtMost(allowedMentions?.UserIds?.Count ?? 0, 100, nameof(allowedMentions.UserIds), "A max of 100 user Ids are allowed."); | ||||
@@ -108,7 +117,7 @@ namespace Discord.WebSocket | |||||
var response = new API.InteractionResponse | var response = new API.InteractionResponse | ||||
{ | { | ||||
Type = InteractionResponseType.ChannelMessageWithSource, | |||||
Type = InteractionResponseType.ChannelMessageWithSource, | |||||
Data = new API.InteractionCallbackData | Data = new API.InteractionCallbackData | ||||
{ | { | ||||
Content = text ?? Optional<string>.Unspecified, | Content = text ?? Optional<string>.Unspecified, | ||||
@@ -218,8 +227,17 @@ namespace Discord.WebSocket | |||||
if (!IsValidToken) | if (!IsValidToken) | ||||
throw new InvalidOperationException("Interaction token is no longer valid"); | throw new InvalidOperationException("Interaction token is no longer valid"); | ||||
if (embeds == null && embed != null) | |||||
embeds = new[] { embed }; | |||||
if (embed != null) | |||||
{ | |||||
if (embeds == null) | |||||
embeds = new[] { embed }; | |||||
else | |||||
{ | |||||
List<Embed> listEmbeds = embeds.ToList(); | |||||
listEmbeds.Insert(0, embed); | |||||
} | |||||
} | |||||
Preconditions.AtMost(allowedMentions?.RoleIds?.Count ?? 0, 100, nameof(allowedMentions.RoleIds), "A max of 100 role Ids are allowed."); | Preconditions.AtMost(allowedMentions?.RoleIds?.Count ?? 0, 100, nameof(allowedMentions.RoleIds), "A max of 100 role Ids are allowed."); | ||||
Preconditions.AtMost(allowedMentions?.UserIds?.Count ?? 0, 100, nameof(allowedMentions.UserIds), "A max of 100 user Ids are allowed."); | Preconditions.AtMost(allowedMentions?.UserIds?.Count ?? 0, 100, nameof(allowedMentions.UserIds), "A max of 100 user Ids are allowed."); | ||||
Preconditions.AtMost(embeds?.Length ?? 0, 10, nameof(embeds), "A max of 10 embeds are allowed."); | Preconditions.AtMost(embeds?.Length ?? 0, 10, nameof(embeds), "A max of 10 embeds are allowed."); | ||||
@@ -255,8 +273,17 @@ namespace Discord.WebSocket | |||||
if (!IsValidToken) | if (!IsValidToken) | ||||
throw new InvalidOperationException("Interaction token is no longer valid"); | throw new InvalidOperationException("Interaction token is no longer valid"); | ||||
if (embeds == null && embed != null) | |||||
embeds = new[] { embed }; | |||||
if (embed != null) | |||||
{ | |||||
if (embeds == null) | |||||
embeds = new[] { embed }; | |||||
else | |||||
{ | |||||
List<Embed> listEmbeds = embeds.ToList(); | |||||
listEmbeds.Insert(0, embed); | |||||
} | |||||
} | |||||
Preconditions.AtMost(allowedMentions?.RoleIds?.Count ?? 0, 100, nameof(allowedMentions.RoleIds), "A max of 100 role Ids are allowed."); | Preconditions.AtMost(allowedMentions?.RoleIds?.Count ?? 0, 100, nameof(allowedMentions.RoleIds), "A max of 100 role Ids are allowed."); | ||||
Preconditions.AtMost(allowedMentions?.UserIds?.Count ?? 0, 100, nameof(allowedMentions.UserIds), "A max of 100 user Ids are allowed."); | Preconditions.AtMost(allowedMentions?.UserIds?.Count ?? 0, 100, nameof(allowedMentions.UserIds), "A max of 100 user Ids are allowed."); | ||||
Preconditions.AtMost(embeds?.Length ?? 0, 10, nameof(embeds), "A max of 10 embeds are allowed."); | Preconditions.AtMost(embeds?.Length ?? 0, 10, nameof(embeds), "A max of 10 embeds are allowed."); | ||||
@@ -295,8 +322,17 @@ namespace Discord.WebSocket | |||||
if (!IsValidToken) | if (!IsValidToken) | ||||
throw new InvalidOperationException("Interaction token is no longer valid"); | throw new InvalidOperationException("Interaction token is no longer valid"); | ||||
if (embeds == null && embed != null) | |||||
embeds = new[] { embed }; | |||||
if (embed != null) | |||||
{ | |||||
if (embeds == null) | |||||
embeds = new[] { embed }; | |||||
else | |||||
{ | |||||
List<Embed> listEmbeds = embeds.ToList(); | |||||
listEmbeds.Insert(0, embed); | |||||
} | |||||
} | |||||
Preconditions.AtMost(allowedMentions?.RoleIds?.Count ?? 0, 100, nameof(allowedMentions.RoleIds), "A max of 100 role Ids are allowed."); | Preconditions.AtMost(allowedMentions?.RoleIds?.Count ?? 0, 100, nameof(allowedMentions.RoleIds), "A max of 100 role Ids are allowed."); | ||||
Preconditions.AtMost(allowedMentions?.UserIds?.Count ?? 0, 100, nameof(allowedMentions.UserIds), "A max of 100 user Ids are allowed."); | Preconditions.AtMost(allowedMentions?.UserIds?.Count ?? 0, 100, nameof(allowedMentions.UserIds), "A max of 100 user Ids are allowed."); | ||||
Preconditions.AtMost(embeds?.Length ?? 0, 10, nameof(embeds), "A max of 10 embeds are allowed."); | Preconditions.AtMost(embeds?.Length ?? 0, 10, nameof(embeds), "A max of 10 embeds are allowed."); | ||||
@@ -79,8 +79,16 @@ namespace Discord.WebSocket | |||||
if (!IsValidToken) | if (!IsValidToken) | ||||
throw new InvalidOperationException("Interaction token is no longer valid"); | throw new InvalidOperationException("Interaction token is no longer valid"); | ||||
if (embeds == null && embed != null) | |||||
embeds = new[] { embed }; | |||||
if (embed != null) | |||||
{ | |||||
if (embeds == null) | |||||
embeds = new[] { embed }; | |||||
else | |||||
{ | |||||
List<Embed> listEmbeds = embeds.ToList(); | |||||
listEmbeds.Insert(0, embed); | |||||
} | |||||
} | |||||
Preconditions.AtMost(allowedMentions?.RoleIds?.Count ?? 0, 100, nameof(allowedMentions.RoleIds), "A max of 100 role Ids are allowed."); | Preconditions.AtMost(allowedMentions?.RoleIds?.Count ?? 0, 100, nameof(allowedMentions.RoleIds), "A max of 100 role Ids are allowed."); | ||||
Preconditions.AtMost(allowedMentions?.UserIds?.Count ?? 0, 100, nameof(allowedMentions.UserIds), "A max of 100 user Ids are allowed."); | Preconditions.AtMost(allowedMentions?.UserIds?.Count ?? 0, 100, nameof(allowedMentions.UserIds), "A max of 100 user Ids are allowed."); | ||||
@@ -133,8 +141,17 @@ namespace Discord.WebSocket | |||||
if (!IsValidToken) | if (!IsValidToken) | ||||
throw new InvalidOperationException("Interaction token is no longer valid"); | throw new InvalidOperationException("Interaction token is no longer valid"); | ||||
if (embeds == null && embed != null) | |||||
embeds = new[] { embed }; | |||||
if (embed != null) | |||||
{ | |||||
if (embeds == null) | |||||
embeds = new[] { embed }; | |||||
else | |||||
{ | |||||
List<Embed> listEmbeds = embeds.ToList(); | |||||
listEmbeds.Insert(0, embed); | |||||
} | |||||
} | |||||
Preconditions.AtMost(allowedMentions?.RoleIds?.Count ?? 0, 100, nameof(allowedMentions.RoleIds), "A max of 100 role Ids are allowed."); | Preconditions.AtMost(allowedMentions?.RoleIds?.Count ?? 0, 100, nameof(allowedMentions.RoleIds), "A max of 100 role Ids are allowed."); | ||||
Preconditions.AtMost(allowedMentions?.UserIds?.Count ?? 0, 100, nameof(allowedMentions.UserIds), "A max of 100 user Ids are allowed."); | Preconditions.AtMost(allowedMentions?.UserIds?.Count ?? 0, 100, nameof(allowedMentions.UserIds), "A max of 100 user Ids are allowed."); | ||||
Preconditions.AtMost(embeds?.Length ?? 0, 10, nameof(embeds), "A max of 10 embeds are allowed."); | Preconditions.AtMost(embeds?.Length ?? 0, 10, nameof(embeds), "A max of 10 embeds are allowed."); | ||||
@@ -170,8 +187,17 @@ namespace Discord.WebSocket | |||||
if (!IsValidToken) | if (!IsValidToken) | ||||
throw new InvalidOperationException("Interaction token is no longer valid"); | throw new InvalidOperationException("Interaction token is no longer valid"); | ||||
if (embeds == null && embed != null) | |||||
embeds = new[] { embed }; | |||||
if (embed != null) | |||||
{ | |||||
if (embeds == null) | |||||
embeds = new[] { embed }; | |||||
else | |||||
{ | |||||
List<Embed> listEmbeds = embeds.ToList(); | |||||
listEmbeds.Insert(0, embed); | |||||
} | |||||
} | |||||
Preconditions.AtMost(allowedMentions?.RoleIds?.Count ?? 0, 100, nameof(allowedMentions.RoleIds), "A max of 100 role Ids are allowed."); | Preconditions.AtMost(allowedMentions?.RoleIds?.Count ?? 0, 100, nameof(allowedMentions.RoleIds), "A max of 100 role Ids are allowed."); | ||||
Preconditions.AtMost(allowedMentions?.UserIds?.Count ?? 0, 100, nameof(allowedMentions.UserIds), "A max of 100 user Ids are allowed."); | Preconditions.AtMost(allowedMentions?.UserIds?.Count ?? 0, 100, nameof(allowedMentions.UserIds), "A max of 100 user Ids are allowed."); | ||||
Preconditions.AtMost(embeds?.Length ?? 0, 10, nameof(embeds), "A max of 10 embeds are allowed."); | Preconditions.AtMost(embeds?.Length ?? 0, 10, nameof(embeds), "A max of 10 embeds are allowed."); | ||||
@@ -210,8 +236,17 @@ namespace Discord.WebSocket | |||||
if (!IsValidToken) | if (!IsValidToken) | ||||
throw new InvalidOperationException("Interaction token is no longer valid"); | throw new InvalidOperationException("Interaction token is no longer valid"); | ||||
if (embeds == null && embed != null) | |||||
embeds = new[] { embed }; | |||||
if (embed != null) | |||||
{ | |||||
if (embeds == null) | |||||
embeds = new[] { embed }; | |||||
else | |||||
{ | |||||
List<Embed> listEmbeds = embeds.ToList(); | |||||
listEmbeds.Insert(0, embed); | |||||
} | |||||
} | |||||
Preconditions.AtMost(allowedMentions?.RoleIds?.Count ?? 0, 100, nameof(allowedMentions.RoleIds), "A max of 100 role Ids are allowed."); | Preconditions.AtMost(allowedMentions?.RoleIds?.Count ?? 0, 100, nameof(allowedMentions.RoleIds), "A max of 100 role Ids are allowed."); | ||||
Preconditions.AtMost(allowedMentions?.UserIds?.Count ?? 0, 100, nameof(allowedMentions.UserIds), "A max of 100 user Ids are allowed."); | Preconditions.AtMost(allowedMentions?.UserIds?.Count ?? 0, 100, nameof(allowedMentions.UserIds), "A max of 100 user Ids are allowed."); | ||||
Preconditions.AtMost(embeds?.Length ?? 0, 10, nameof(embeds), "A max of 10 embeds are allowed."); | Preconditions.AtMost(embeds?.Length ?? 0, 10, nameof(embeds), "A max of 10 embeds are allowed."); | ||||
@@ -83,7 +83,7 @@ namespace Discord | |||||
throw new NotImplementedException(); | throw new NotImplementedException(); | ||||
} | } | ||||
public Task<IUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent component = null, ISticker[] stickers = null) => throw new NotImplementedException(); | |||||
public Task<IUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent component = null, ISticker[] stickers = null, Embed[] embeds = null) => throw new NotImplementedException(); | |||||
public Task<IUserMessage> 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 component = null, ISticker[] stickers = null) => throw new NotImplementedException(); | public Task<IUserMessage> 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 component = null, ISticker[] stickers = null) => throw new NotImplementedException(); | ||||
public Task<IUserMessage> 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 component = null, ISticker[] stickers = null) => throw new NotImplementedException(); | public Task<IUserMessage> 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 component = null, ISticker[] stickers = null) => throw new NotImplementedException(); | ||||
} | } | ||||
@@ -96,7 +96,7 @@ namespace Discord | |||||
throw new NotImplementedException(); | throw new NotImplementedException(); | ||||
} | } | ||||
public Task<IUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent component = null, ISticker[] stickers = null) | |||||
public Task<IUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent component = null, ISticker[] stickers = null, Embed[] embeds = null) | |||||
{ | { | ||||
throw new NotImplementedException(); | throw new NotImplementedException(); | ||||
} | } | ||||
@@ -186,7 +186,7 @@ namespace Discord | |||||
throw new NotImplementedException(); | throw new NotImplementedException(); | ||||
} | } | ||||
public Task<IUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent component = null, ISticker[] stickers = null) | |||||
public Task<IUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent component = null, ISticker[] stickers = null, Embed[] embeds = null) | |||||
{ | { | ||||
throw new NotImplementedException(); | throw new NotImplementedException(); | ||||
} | } | ||||