@@ -257,6 +257,21 @@ namespace Discord
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public const int MaxEntitlementsPerBatch = 100;
|
public const int MaxEntitlementsPerBatch = 100;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the maximum number of poll answer voters that can be gotten per-batch.
|
||||||
|
/// </summary>
|
||||||
|
public const int MaxPollVotersPerBatch = 100;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the maximum length of a poll answer text.
|
||||||
|
/// </summary>
|
||||||
|
public const int MaxPollAnswerTextLength = 55;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the maximum length of a poll question text.
|
||||||
|
/// </summary>
|
||||||
|
public const int MaxPollQuestionTextLength = 300;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the maximum number of bans that can be banned in a single bulk request.
|
/// Returns the maximum number of bans that can be banned in a single bulk request.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -249,7 +249,18 @@ namespace Discord
|
|||||||
|
|
||||||
#region Onboarding (350XXX)
|
#region Onboarding (350XXX)
|
||||||
CannotEnableOnboardingUnmetRequirements = 350000,
|
CannotEnableOnboardingUnmetRequirements = 350000,
|
||||||
CannotUpdateOnboardingBelowRequirements = 350001
|
CannotUpdateOnboardingBelowRequirements = 350001,
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Polls (520XXX)
|
||||||
|
|
||||||
|
PollVotingBlocked = 520000,
|
||||||
|
PollExpired = 520001,
|
||||||
|
InvalidChannelTypeForPollCreation = 520002,
|
||||||
|
CannotEditAPollMessage = 520003,
|
||||||
|
CannotUseAnEmojiIncludedWithThePoll = 520004,
|
||||||
|
CannotExpireANonPollMessage = 520006,
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,11 +33,15 @@ namespace Discord
|
|||||||
/// <param name="embeds">A array of <see cref="Embed"/>s to send with this response. Max 10.</param>
|
/// <param name="embeds">A array of <see cref="Embed"/>s to send with this response. Max 10.</param>
|
||||||
/// <param name="flags">A message flag to be applied to the sent message, only <see cref="MessageFlags.SuppressEmbeds"/>
|
/// <param name="flags">A message flag to be applied to the sent message, only <see cref="MessageFlags.SuppressEmbeds"/>
|
||||||
/// and <see cref="MessageFlags.SuppressNotification"/> is permitted.</param>
|
/// and <see cref="MessageFlags.SuppressNotification"/> is permitted.</param>
|
||||||
|
/// <param name="poll">A poll to send with the message.</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 components = null, ISticker[] stickers = null, Embed[] embeds = null, MessageFlags flags = MessageFlags.None);
|
Task<IUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null,
|
||||||
|
AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
||||||
|
Embed[] embeds = null, MessageFlags flags = MessageFlags.None, PollProperties poll = 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>
|
||||||
@@ -74,11 +78,15 @@ namespace Discord
|
|||||||
/// <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>
|
||||||
/// <param name="embeds">A array of <see cref="Embed"/>s to send with this response. Max 10.</param>
|
/// <param name="embeds">A array of <see cref="Embed"/>s to send with this response. Max 10.</param>
|
||||||
/// <param name="flags">A message flag to be applied to the sent message, only <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.SuppressNotification"/> is permitted.</param>
|
/// <param name="flags">A message flag to be applied to the sent message, only <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.SuppressNotification"/> is permitted.</param>
|
||||||
|
/// <param name="poll">A poll to send with the message.</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> SendFileAsync(string filePath, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null, MessageFlags flags = MessageFlags.None);
|
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 components = null,
|
||||||
|
ISticker[] stickers = null, Embed[] embeds = null, MessageFlags flags = MessageFlags.None, PollProperties poll = 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>
|
||||||
@@ -112,11 +120,15 @@ namespace Discord
|
|||||||
/// <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>
|
||||||
/// <param name="embeds">A array of <see cref="Embed"/>s to send with this response. Max 10.</param>
|
/// <param name="embeds">A array of <see cref="Embed"/>s to send with this response. Max 10.</param>
|
||||||
/// <param name="flags">A message flag to be applied to the sent message, only <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.SuppressNotification"/> is permitted.</param>
|
/// <param name="flags">A message flag to be applied to the sent message, only <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.SuppressNotification"/> is permitted.</param>
|
||||||
|
/// <param name="poll">A poll to send with the message.</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> SendFileAsync(Stream stream, string filename, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null, MessageFlags flags = MessageFlags.None);
|
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 components = null,
|
||||||
|
ISticker[] stickers = null, Embed[] embeds = null, MessageFlags flags = MessageFlags.None, PollProperties poll = 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>
|
||||||
@@ -142,11 +154,14 @@ namespace Discord
|
|||||||
/// <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>
|
||||||
/// <param name="embeds">A array of <see cref="Embed"/>s to send with this response. Max 10.</param>
|
/// <param name="embeds">A array of <see cref="Embed"/>s to send with this response. Max 10.</param>
|
||||||
/// <param name="flags">A message flag to be applied to the sent message, only <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.SuppressNotification"/> is permitted.</param>
|
/// <param name="flags">A message flag to be applied to the sent message, only <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.SuppressNotification"/> is permitted.</param>
|
||||||
|
/// <param name="poll">A poll to send with the message.</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> SendFileAsync(FileAttachment attachment, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null, MessageFlags flags = MessageFlags.None);
|
Task<IUserMessage> SendFileAsync(FileAttachment attachment, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null,
|
||||||
|
AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
||||||
|
Embed[] embeds = null, MessageFlags flags = MessageFlags.None, PollProperties poll = null);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sends a collection of files to this message channel.
|
/// Sends a collection of files to this message channel.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -172,11 +187,14 @@ namespace Discord
|
|||||||
/// <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>
|
||||||
/// <param name="embeds">A array of <see cref="Embed"/>s to send with this response. Max 10.</param>
|
/// <param name="embeds">A array of <see cref="Embed"/>s to send with this response. Max 10.</param>
|
||||||
/// <param name="flags">A message flag to be applied to the sent message, only <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.SuppressNotification"/> is permitted.</param>
|
/// <param name="flags">A message flag to be applied to the sent message, only <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.SuppressNotification"/> is permitted.</param>
|
||||||
|
/// <param name="poll">A poll to send with the message.</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> SendFilesAsync(IEnumerable<FileAttachment> attachments, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null, MessageFlags flags = MessageFlags.None);
|
Task<IUserMessage> SendFilesAsync(IEnumerable<FileAttachment> attachments, string text = null, bool isTTS = false, Embed embed = null,
|
||||||
|
RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null,
|
||||||
|
ISticker[] stickers = null, Embed[] embeds = null, MessageFlags flags = MessageFlags.None, PollProperties poll = null);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a message from this message channel.
|
/// Gets a message from this message channel.
|
||||||
|
|||||||
@@ -122,11 +122,12 @@ namespace Discord
|
|||||||
/// <param name="components">A <see cref="MessageComponent"/> to be sent with this response.</param>
|
/// <param name="components">A <see cref="MessageComponent"/> to be sent with this response.</param>
|
||||||
/// <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
|
/// <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
|
||||||
/// <param name="options">The request options for this response.</param>
|
/// <param name="options">The request options for this response.</param>
|
||||||
|
/// <param name="poll">A poll to send with the message.</param>
|
||||||
/// <returns>
|
/// <returns>
|
||||||
/// A task that represents an asynchronous send operation for delivering the message.
|
/// A task that represents an asynchronous send operation for delivering the message.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
Task RespondAsync(string text = null, Embed[] embeds = null, bool isTTS = false,
|
Task RespondAsync(string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, AllowedMentions allowedMentions = null,
|
||||||
bool ephemeral = false, AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null);
|
MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Responds to this interaction with a file attachment.
|
/// Responds to this interaction with a file attachment.
|
||||||
@@ -141,13 +142,14 @@ namespace Discord
|
|||||||
/// <param name="components">A <see cref="MessageComponent"/> to be sent with this response.</param>
|
/// <param name="components">A <see cref="MessageComponent"/> to be sent with this response.</param>
|
||||||
/// <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
|
/// <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
|
||||||
/// <param name="options">The request options for this response.</param>
|
/// <param name="options">The request options for this response.</param>
|
||||||
|
/// <param name="poll">A poll to send with the message.</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>
|
||||||
#if NETCOREAPP3_0_OR_GREATER
|
#if NETCOREAPP3_0_OR_GREATER
|
||||||
async Task RespondWithFileAsync(Stream fileStream, string fileName, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
async Task RespondWithFileAsync(Stream fileStream, string fileName, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
||||||
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null)
|
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null)
|
||||||
{
|
{
|
||||||
using (var file = new FileAttachment(fileStream, fileName))
|
using (var file = new FileAttachment(fileStream, fileName))
|
||||||
{
|
{
|
||||||
@@ -156,7 +158,7 @@ namespace Discord
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
Task RespondWithFileAsync(Stream fileStream, string fileName, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
Task RespondWithFileAsync(Stream fileStream, string fileName, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
||||||
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null);
|
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null);
|
||||||
#endif
|
#endif
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Responds to this interaction with a file attachment.
|
/// Responds to this interaction with a file attachment.
|
||||||
@@ -171,13 +173,14 @@ namespace Discord
|
|||||||
/// <param name="options">The request options for this response.</param>
|
/// <param name="options">The request options for this response.</param>
|
||||||
/// <param name="components">A <see cref="MessageComponent"/> to be sent with this response.</param>
|
/// <param name="components">A <see cref="MessageComponent"/> to be sent with this response.</param>
|
||||||
/// <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
|
/// <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
|
||||||
|
/// <param name="poll">A poll to send with the message.</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>
|
||||||
#if NETCOREAPP3_0_OR_GREATER
|
#if NETCOREAPP3_0_OR_GREATER
|
||||||
async Task RespondWithFileAsync(string filePath, string fileName = null, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
async Task RespondWithFileAsync(string filePath, string fileName = null, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
||||||
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null)
|
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null)
|
||||||
{
|
{
|
||||||
using (var file = new FileAttachment(filePath, fileName))
|
using (var file = new FileAttachment(filePath, fileName))
|
||||||
{
|
{
|
||||||
@@ -186,7 +189,7 @@ namespace Discord
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
Task RespondWithFileAsync(string filePath, string fileName = null, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
Task RespondWithFileAsync(string filePath, string fileName = null, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
||||||
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null);
|
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null);
|
||||||
#endif
|
#endif
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Responds to this interaction with a file attachment.
|
/// Responds to this interaction with a file attachment.
|
||||||
@@ -200,17 +203,18 @@ namespace Discord
|
|||||||
/// <param name="options">The request options for this response.</param>
|
/// <param name="options">The request options for this response.</param>
|
||||||
/// <param name="components">A <see cref="MessageComponent"/> to be sent with this response.</param>
|
/// <param name="components">A <see cref="MessageComponent"/> to be sent with this response.</param>
|
||||||
/// <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
|
/// <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
|
||||||
|
/// <param name="poll">A poll to send with the message.</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>
|
||||||
#if NETCOREAPP3_0_OR_GREATER
|
#if NETCOREAPP3_0_OR_GREATER
|
||||||
Task RespondWithFileAsync(FileAttachment attachment, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
Task RespondWithFileAsync(FileAttachment attachment, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
||||||
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null)
|
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null)
|
||||||
=> RespondWithFilesAsync(new FileAttachment[] { attachment }, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options);
|
=> RespondWithFilesAsync(new FileAttachment[] { attachment }, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options, poll);
|
||||||
#else
|
#else
|
||||||
Task RespondWithFileAsync(FileAttachment attachment, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
Task RespondWithFileAsync(FileAttachment attachment, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
||||||
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null);
|
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null);
|
||||||
#endif
|
#endif
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Responds to this interaction with a collection of file attachments.
|
/// Responds to this interaction with a collection of file attachments.
|
||||||
@@ -224,12 +228,13 @@ namespace Discord
|
|||||||
/// <param name="options">The request options for this response.</param>
|
/// <param name="options">The request options for this response.</param>
|
||||||
/// <param name="components">A <see cref="MessageComponent"/> to be sent with this response.</param>
|
/// <param name="components">A <see cref="MessageComponent"/> to be sent with this response.</param>
|
||||||
/// <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
|
/// <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
|
||||||
|
/// <param name="poll">A poll to send with the message.</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 RespondWithFilesAsync(IEnumerable<FileAttachment> attachments, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
Task RespondWithFilesAsync(IEnumerable<FileAttachment> attachments, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
||||||
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null);
|
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sends a followup message for this interaction.
|
/// Sends a followup message for this interaction.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -241,12 +246,13 @@ namespace Discord
|
|||||||
/// <param name="options">The request options for this response.</param>
|
/// <param name="options">The request options for this response.</param>
|
||||||
/// <param name="components">A <see cref="MessageComponent"/> to be sent with this response.</param>
|
/// <param name="components">A <see cref="MessageComponent"/> to be sent with this response.</param>
|
||||||
/// <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
|
/// <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
|
||||||
|
/// <param name="poll">A poll to send with the message.</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> FollowupAsync(string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
Task<IUserMessage> FollowupAsync(string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
||||||
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null);
|
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sends a followup message for this interaction.
|
/// Sends a followup message for this interaction.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -260,22 +266,23 @@ namespace Discord
|
|||||||
/// <param name="options">The request options for this response.</param>
|
/// <param name="options">The request options for this response.</param>
|
||||||
/// <param name="components">A <see cref="MessageComponent"/> to be sent with this response.</param>
|
/// <param name="components">A <see cref="MessageComponent"/> to be sent with this response.</param>
|
||||||
/// <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
|
/// <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
|
||||||
|
/// <param name="poll">A poll to send with the message.</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>
|
||||||
#if NETCOREAPP3_0_OR_GREATER
|
#if NETCOREAPP3_0_OR_GREATER
|
||||||
async Task<IUserMessage> FollowupWithFileAsync(Stream fileStream, string fileName, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
async Task<IUserMessage> FollowupWithFileAsync(Stream fileStream, string fileName, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
||||||
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null)
|
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null)
|
||||||
{
|
{
|
||||||
using (var file = new FileAttachment(fileStream, fileName))
|
using (var file = new FileAttachment(fileStream, fileName))
|
||||||
{
|
{
|
||||||
return await FollowupWithFileAsync(file, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options).ConfigureAwait(false);
|
return await FollowupWithFileAsync(file, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options, poll).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
Task<IUserMessage> FollowupWithFileAsync(Stream fileStream, string fileName, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
Task<IUserMessage> FollowupWithFileAsync(Stream fileStream, string fileName, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
||||||
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null);
|
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null);
|
||||||
#endif
|
#endif
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sends a followup message for this interaction.
|
/// Sends a followup message for this interaction.
|
||||||
@@ -290,22 +297,23 @@ namespace Discord
|
|||||||
/// <param name="options">The request options for this response.</param>
|
/// <param name="options">The request options for this response.</param>
|
||||||
/// <param name="components">A <see cref="MessageComponent"/> to be sent with this response.</param>
|
/// <param name="components">A <see cref="MessageComponent"/> to be sent with this response.</param>
|
||||||
/// <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
|
/// <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
|
||||||
|
/// <param name="poll">A poll to send with the message.</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>
|
||||||
#if NETCOREAPP3_0_OR_GREATER
|
#if NETCOREAPP3_0_OR_GREATER
|
||||||
async Task<IUserMessage> FollowupWithFileAsync(string filePath, string fileName = null, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
async Task<IUserMessage> FollowupWithFileAsync(string filePath, string fileName = null, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
||||||
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null)
|
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null)
|
||||||
{
|
{
|
||||||
using (var file = new FileAttachment(filePath, fileName))
|
using (var file = new FileAttachment(filePath, fileName))
|
||||||
{
|
{
|
||||||
return await FollowupWithFileAsync(file, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options).ConfigureAwait(false);
|
return await FollowupWithFileAsync(file, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options, poll).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
Task<IUserMessage> FollowupWithFileAsync(string filePath, string fileName = null, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
Task<IUserMessage> FollowupWithFileAsync(string filePath, string fileName = null, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
||||||
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null);
|
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null);
|
||||||
#endif
|
#endif
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sends a followup message for this interaction.
|
/// Sends a followup message for this interaction.
|
||||||
@@ -319,17 +327,18 @@ namespace Discord
|
|||||||
/// <param name="options">The request options for this response.</param>
|
/// <param name="options">The request options for this response.</param>
|
||||||
/// <param name="components">A <see cref="MessageComponent"/> to be sent with this response.</param>
|
/// <param name="components">A <see cref="MessageComponent"/> to be sent with this response.</param>
|
||||||
/// <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
|
/// <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
|
||||||
|
/// <param name="poll">A poll to send with the message.</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>
|
||||||
#if NETCOREAPP3_0_OR_GREATER
|
#if NETCOREAPP3_0_OR_GREATER
|
||||||
Task<IUserMessage> FollowupWithFileAsync(FileAttachment attachment, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
Task<IUserMessage> FollowupWithFileAsync(FileAttachment attachment, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
||||||
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null)
|
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null)
|
||||||
=> FollowupWithFilesAsync(new FileAttachment[] { attachment }, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options);
|
=> FollowupWithFilesAsync(new FileAttachment[] { attachment }, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options, poll);
|
||||||
#else
|
#else
|
||||||
Task<IUserMessage> FollowupWithFileAsync(FileAttachment attachment, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
Task<IUserMessage> FollowupWithFileAsync(FileAttachment attachment, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
||||||
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null);
|
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null);
|
||||||
#endif
|
#endif
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sends a followup message for this interaction.
|
/// Sends a followup message for this interaction.
|
||||||
@@ -343,12 +352,13 @@ namespace Discord
|
|||||||
/// <param name="options">The request options for this response.</param>
|
/// <param name="options">The request options for this response.</param>
|
||||||
/// <param name="components">A <see cref="MessageComponent"/> to be sent with this response.</param>
|
/// <param name="components">A <see cref="MessageComponent"/> to be sent with this response.</param>
|
||||||
/// <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
|
/// <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
|
||||||
|
/// <param name="poll">A poll to send with the message.</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> FollowupWithFilesAsync(IEnumerable<FileAttachment> attachments, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
Task<IUserMessage> FollowupWithFilesAsync(IEnumerable<FileAttachment> attachments, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
||||||
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null);
|
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the original response for this interaction.
|
/// Gets the original response for this interaction.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Discord
|
namespace Discord
|
||||||
@@ -29,6 +30,14 @@ namespace Discord
|
|||||||
/// </remarks>
|
/// </remarks>
|
||||||
IMessageInteractionMetadata InteractionMetadata { get; }
|
IMessageInteractionMetadata InteractionMetadata { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the poll sent with this message.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Will be <see langword="null"/> if the message has no poll.
|
||||||
|
/// </remarks>
|
||||||
|
Poll? Poll { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Modifies this message.
|
/// Modifies this message.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -94,5 +103,23 @@ namespace Discord
|
|||||||
TagHandling roleHandling = TagHandling.Name,
|
TagHandling roleHandling = TagHandling.Name,
|
||||||
TagHandling everyoneHandling = TagHandling.Ignore,
|
TagHandling everyoneHandling = TagHandling.Ignore,
|
||||||
TagHandling emojiHandling = TagHandling.Name);
|
TagHandling emojiHandling = TagHandling.Name);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Immediately ends the poll.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// You cannot end polls from other users.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="options">The options to be used when sending the request.</param>
|
||||||
|
Task EndPollAsync(RequestOptions options);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get users that voted for this specific answer.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="answerId">The id on the answer to fetch voters for</param>
|
||||||
|
/// <param name="options">The options to be used when sending the request.</param>
|
||||||
|
/// <param name="afterId">The id of a user to start after.</param>
|
||||||
|
/// <param name="limit">The number of users to request.</param>
|
||||||
|
IAsyncEnumerable<IReadOnlyCollection<IUser>> GetPollAnswerVotersAsync(uint answerId, int? limit = null, ulong? afterId = null, RequestOptions options = null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
50
src/Discord.Net.Core/Entities/Messages/Polls/Poll.cs
Normal file
50
src/Discord.Net.Core/Entities/Messages/Polls/Poll.cs
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Discord;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a poll object.
|
||||||
|
/// </summary>
|
||||||
|
public readonly struct Poll
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the question for the poll.
|
||||||
|
/// </summary>
|
||||||
|
public readonly PollMedia Question;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the answers for the poll.
|
||||||
|
/// </summary>
|
||||||
|
public readonly IReadOnlyCollection<PollAnswer> Answers;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the expiration date for the poll.
|
||||||
|
/// </summary>
|
||||||
|
public readonly DateTimeOffset ExpiresAt;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets whether the poll allows multiple answers.
|
||||||
|
/// </summary>
|
||||||
|
public readonly bool AllowMultiselect;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the layout type for the poll.
|
||||||
|
/// </summary>
|
||||||
|
public readonly PollLayout LayoutType;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the results of the poll. This is <see langword="null"/> if the poll is not finalized.
|
||||||
|
/// </summary>
|
||||||
|
public readonly PollResults? Results;
|
||||||
|
|
||||||
|
internal Poll(PollMedia question, IReadOnlyCollection<PollAnswer> answers, DateTimeOffset expiresAt, bool allowMultiselect, PollLayout layoutType, PollResults? results)
|
||||||
|
{
|
||||||
|
Question = question;
|
||||||
|
Answers = answers;
|
||||||
|
ExpiresAt = expiresAt;
|
||||||
|
AllowMultiselect = allowMultiselect;
|
||||||
|
LayoutType = layoutType;
|
||||||
|
Results = results;
|
||||||
|
}
|
||||||
|
}
|
||||||
23
src/Discord.Net.Core/Entities/Messages/Polls/PollAnswer.cs
Normal file
23
src/Discord.Net.Core/Entities/Messages/Polls/PollAnswer.cs
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
namespace Discord;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a poll answer object.
|
||||||
|
/// </summary>
|
||||||
|
public readonly struct PollAnswer
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the Id of the answer.
|
||||||
|
/// </summary>
|
||||||
|
public readonly uint AnswerId;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the poll media of this answer.
|
||||||
|
/// </summary>
|
||||||
|
public readonly PollMedia PollMedia;
|
||||||
|
|
||||||
|
internal PollAnswer(uint id, PollMedia media)
|
||||||
|
{
|
||||||
|
AnswerId = id;
|
||||||
|
PollMedia = media;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
namespace Discord;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a poll answer counts object.
|
||||||
|
/// </summary>
|
||||||
|
public readonly struct PollAnswerCounts
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the Id of the answer.
|
||||||
|
/// </summary>
|
||||||
|
public readonly ulong AnswerId;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the count of votes for this answer.
|
||||||
|
/// </summary>
|
||||||
|
public readonly uint Count;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets whether the current user voted for this answer.
|
||||||
|
/// </summary>
|
||||||
|
public readonly bool MeVoted;
|
||||||
|
|
||||||
|
internal PollAnswerCounts(ulong answerId, uint count, bool meVoted)
|
||||||
|
{
|
||||||
|
AnswerId = answerId;
|
||||||
|
Count = count;
|
||||||
|
MeVoted = meVoted;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
namespace Discord;
|
||||||
|
|
||||||
|
public enum PollLayout
|
||||||
|
{
|
||||||
|
Default = 1
|
||||||
|
}
|
||||||
23
src/Discord.Net.Core/Entities/Messages/Polls/PollMedia.cs
Normal file
23
src/Discord.Net.Core/Entities/Messages/Polls/PollMedia.cs
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
namespace Discord;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a poll media object.
|
||||||
|
/// </summary>
|
||||||
|
public readonly struct PollMedia
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the text of the field.
|
||||||
|
/// </summary>
|
||||||
|
public readonly string Text;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the emoji of the field. <see langword="null"/> if no emoji is set.
|
||||||
|
/// </summary>
|
||||||
|
public readonly IEmote Emoji;
|
||||||
|
|
||||||
|
internal PollMedia(string text, IEmote emoji)
|
||||||
|
{
|
||||||
|
Text = text;
|
||||||
|
Emoji = emoji;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
namespace Discord;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Properties used to create a poll question.
|
||||||
|
/// </summary>
|
||||||
|
public class PollMediaProperties
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the text of the question for the poll.
|
||||||
|
/// </summary>
|
||||||
|
public string Text { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the emoji of the question for the poll.
|
||||||
|
/// </summary>
|
||||||
|
public IEmote Emoji { get; set; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Discord;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Properties used to create a poll.
|
||||||
|
/// </summary>
|
||||||
|
public class PollProperties
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the question for the poll.
|
||||||
|
/// </summary>
|
||||||
|
public PollMediaProperties Question { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the answers for the poll.
|
||||||
|
/// </summary>
|
||||||
|
public List<PollMediaProperties> Answers { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the duration for the poll in hours. Max duration is 168 hours (7 days).
|
||||||
|
/// </summary>
|
||||||
|
public uint Duration { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets whether the poll allows multiple answers.
|
||||||
|
/// </summary>
|
||||||
|
public bool AllowMultiselect { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the layout type for the poll.
|
||||||
|
/// </summary>
|
||||||
|
public PollLayout LayoutType { get; set; }
|
||||||
|
}
|
||||||
25
src/Discord.Net.Core/Entities/Messages/Polls/PollResults.cs
Normal file
25
src/Discord.Net.Core/Entities/Messages/Polls/PollResults.cs
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Discord;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents the results of a poll.
|
||||||
|
/// </summary>
|
||||||
|
public readonly struct PollResults
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets whether the poll results are finalized.
|
||||||
|
/// </summary>
|
||||||
|
public readonly bool IsFinalized;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the answer counts for the poll.
|
||||||
|
/// </summary>
|
||||||
|
public readonly IReadOnlyCollection<PollAnswerCounts> AnswerCounts;
|
||||||
|
|
||||||
|
internal PollResults(bool isFinalized, IReadOnlyCollection<PollAnswerCounts> answerCounts)
|
||||||
|
{
|
||||||
|
IsFinalized = isFinalized;
|
||||||
|
AnswerCounts = answerCounts;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -192,5 +192,10 @@ namespace Discord
|
|||||||
/// Allows setting voice channel status.
|
/// Allows setting voice channel status.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
SetVoiceChannelStatus = 1L << 48,
|
SetVoiceChannelStatus = 1L << 48,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Allows sending polls.
|
||||||
|
/// </summary>
|
||||||
|
SendPolls = 1L << 49,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,17 +18,17 @@ namespace Discord
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a <see cref="ChannelPermissions"/> that grants all permissions for text channels.
|
/// Gets a <see cref="ChannelPermissions"/> that grants all permissions for text channels.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static readonly ChannelPermissions Text = new(0b110001_001111_110010_110011_111101_111111_111101_010001);
|
public static readonly ChannelPermissions Text = new(0b10_110001_001111_110010_110011_111101_111111_111101_010001);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a <see cref="ChannelPermissions"/> that grants all permissions for voice channels.
|
/// Gets a <see cref="ChannelPermissions"/> that grants all permissions for voice channels.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static readonly ChannelPermissions Voice = new(0b1_110001_001010_001010_110011_111101_111111_111101_010001);
|
public static readonly ChannelPermissions Voice = new(0b11_110001_001010_001010_110011_111101_111111_111101_010001);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a <see cref="ChannelPermissions"/> that grants all permissions for stage channels.
|
/// Gets a <see cref="ChannelPermissions"/> that grants all permissions for stage channels.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static readonly ChannelPermissions Stage = new(0b110000_000010_001110_010001_010101_111111_111001_010001);
|
public static readonly ChannelPermissions Stage = new(0b10_110000_000010_001110_010001_010101_111111_111001_010001);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a <see cref="ChannelPermissions"/> that grants all permissions for category channels.
|
/// Gets a <see cref="ChannelPermissions"/> that grants all permissions for category channels.
|
||||||
@@ -151,7 +151,9 @@ namespace Discord
|
|||||||
/// <summary> If <see langword="true"/>, a user can use the Clyde AI bot in this channel.</summary>
|
/// <summary> If <see langword="true"/>, a user can use the Clyde AI bot in this channel.</summary>
|
||||||
public bool UseClydeAI => Permissions.GetValue(RawValue, ChannelPermission.UseClydeAI);
|
public bool UseClydeAI => Permissions.GetValue(RawValue, ChannelPermission.UseClydeAI);
|
||||||
/// <summary> If <see langword="true"/>, a user can set the status of a voice channel.</summary>
|
/// <summary> If <see langword="true"/>, a user can set the status of a voice channel.</summary>
|
||||||
public bool SetVoiceChannelStatus => Permissions.GetValue(RawValue, GuildPermission.SetVoiceChannelStatus);
|
public bool SetVoiceChannelStatus => Permissions.GetValue(RawValue, ChannelPermission.SetVoiceChannelStatus);
|
||||||
|
/// <summary> If <see langword="true"/>, a user can send polls.</summary>
|
||||||
|
public bool SendPolls => Permissions.GetValue(RawValue, ChannelPermission.SendPolls);
|
||||||
|
|
||||||
/// <summary> Creates a new <see cref="ChannelPermissions"/> with the provided packed value.</summary>
|
/// <summary> Creates a new <see cref="ChannelPermissions"/> with the provided packed value.</summary>
|
||||||
public ChannelPermissions(ulong rawValue) { RawValue = rawValue; }
|
public ChannelPermissions(ulong rawValue) { RawValue = rawValue; }
|
||||||
@@ -191,7 +193,8 @@ namespace Discord
|
|||||||
bool? createEvents = null,
|
bool? createEvents = null,
|
||||||
bool? sendVoiceMessages = null,
|
bool? sendVoiceMessages = null,
|
||||||
bool? useClydeAI = null,
|
bool? useClydeAI = null,
|
||||||
bool? setVoiceChannelStatus = null)
|
bool? setVoiceChannelStatus = null,
|
||||||
|
bool? sendPolls = null)
|
||||||
{
|
{
|
||||||
ulong value = initialValue;
|
ulong value = initialValue;
|
||||||
|
|
||||||
@@ -230,6 +233,7 @@ namespace Discord
|
|||||||
Permissions.SetValue(ref value, sendVoiceMessages, ChannelPermission.SendVoiceMessages);
|
Permissions.SetValue(ref value, sendVoiceMessages, ChannelPermission.SendVoiceMessages);
|
||||||
Permissions.SetValue(ref value, useClydeAI, ChannelPermission.UseClydeAI);
|
Permissions.SetValue(ref value, useClydeAI, ChannelPermission.UseClydeAI);
|
||||||
Permissions.SetValue(ref value, setVoiceChannelStatus, ChannelPermission.SetVoiceChannelStatus);
|
Permissions.SetValue(ref value, setVoiceChannelStatus, ChannelPermission.SetVoiceChannelStatus);
|
||||||
|
Permissions.SetValue(ref value, sendPolls, ChannelPermission.SendPolls);
|
||||||
|
|
||||||
RawValue = value;
|
RawValue = value;
|
||||||
}
|
}
|
||||||
@@ -270,12 +274,13 @@ namespace Discord
|
|||||||
bool createEvents = false,
|
bool createEvents = false,
|
||||||
bool sendVoiceMessages = false,
|
bool sendVoiceMessages = false,
|
||||||
bool useClydeAI = false,
|
bool useClydeAI = false,
|
||||||
bool setVoiceChannelStatus = false)
|
bool setVoiceChannelStatus = false,
|
||||||
|
bool sendPolls = false)
|
||||||
: this(0, createInstantInvite, manageChannel, addReactions, viewChannel, sendMessages, sendTTSMessages, manageMessages,
|
: this(0, createInstantInvite, manageChannel, addReactions, viewChannel, sendMessages, sendTTSMessages, manageMessages,
|
||||||
embedLinks, attachFiles, readMessageHistory, mentionEveryone, useExternalEmojis, connect,
|
embedLinks, attachFiles, readMessageHistory, mentionEveryone, useExternalEmojis, connect,
|
||||||
speak, muteMembers, deafenMembers, moveMembers, useVoiceActivation, prioritySpeaker, stream, manageRoles, manageWebhooks,
|
speak, muteMembers, deafenMembers, moveMembers, useVoiceActivation, prioritySpeaker, stream, manageRoles, manageWebhooks,
|
||||||
useApplicationCommands, requestToSpeak, manageThreads, createPublicThreads, createPrivateThreads, useExternalStickers, sendMessagesInThreads,
|
useApplicationCommands, requestToSpeak, manageThreads, createPublicThreads, createPrivateThreads, useExternalStickers, sendMessagesInThreads,
|
||||||
startEmbeddedActivities, useSoundboard, createEvents, sendVoiceMessages, useClydeAI, setVoiceChannelStatus)
|
startEmbeddedActivities, useSoundboard, createEvents, sendVoiceMessages, useClydeAI, setVoiceChannelStatus, sendPolls)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
/// <summary> Creates a new <see cref="ChannelPermissions"/> from this one, changing the provided non-null permissions.</summary>
|
/// <summary> Creates a new <see cref="ChannelPermissions"/> from this one, changing the provided non-null permissions.</summary>
|
||||||
@@ -314,7 +319,8 @@ namespace Discord
|
|||||||
bool? createEvents = null,
|
bool? createEvents = null,
|
||||||
bool? sendVoiceMessages = null,
|
bool? sendVoiceMessages = null,
|
||||||
bool? useClydeAI = null,
|
bool? useClydeAI = null,
|
||||||
bool? setVoiceChannelStatus = null)
|
bool? setVoiceChannelStatus = null,
|
||||||
|
bool? sendPolls = null)
|
||||||
=> new ChannelPermissions(RawValue,
|
=> new ChannelPermissions(RawValue,
|
||||||
createInstantInvite,
|
createInstantInvite,
|
||||||
manageChannel,
|
manageChannel,
|
||||||
@@ -350,7 +356,8 @@ namespace Discord
|
|||||||
createEvents,
|
createEvents,
|
||||||
sendVoiceMessages,
|
sendVoiceMessages,
|
||||||
useClydeAI,
|
useClydeAI,
|
||||||
setVoiceChannelStatus);
|
setVoiceChannelStatus,
|
||||||
|
sendPolls);
|
||||||
|
|
||||||
public bool Has(ChannelPermission permission) => Permissions.GetValue(RawValue, permission);
|
public bool Has(ChannelPermission permission) => Permissions.GetValue(RawValue, permission);
|
||||||
|
|
||||||
|
|||||||
@@ -282,5 +282,10 @@ namespace Discord
|
|||||||
/// Allows setting voice channel status.
|
/// Allows setting voice channel status.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
SetVoiceChannelStatus = 1L << 48,
|
SetVoiceChannelStatus = 1L << 48,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Allows sending polls.
|
||||||
|
/// </summary>
|
||||||
|
SendPolls = 1L << 49,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,6 +116,9 @@ namespace Discord
|
|||||||
public bool CreateGuildExpressions => Permissions.GetValue(RawValue, GuildPermission.CreateGuildExpressions);
|
public bool CreateGuildExpressions => Permissions.GetValue(RawValue, GuildPermission.CreateGuildExpressions);
|
||||||
/// <summary> If <see langword="true"/>, a user can set the status of a voice channel.</summary>
|
/// <summary> If <see langword="true"/>, a user can set the status of a voice channel.</summary>
|
||||||
public bool SetVoiceChannelStatus => Permissions.GetValue(RawValue, GuildPermission.SetVoiceChannelStatus);
|
public bool SetVoiceChannelStatus => Permissions.GetValue(RawValue, GuildPermission.SetVoiceChannelStatus);
|
||||||
|
/// <summary> If <see langword="true"/>, a user can send polls.</summary>
|
||||||
|
public bool SendPolls => Permissions.GetValue(RawValue, GuildPermission.SendPolls);
|
||||||
|
|
||||||
|
|
||||||
/// <summary> Creates a new <see cref="GuildPermissions"/> with the provided packed value. </summary>
|
/// <summary> Creates a new <see cref="GuildPermissions"/> with the provided packed value. </summary>
|
||||||
public GuildPermissions(ulong rawValue) { RawValue = rawValue; }
|
public GuildPermissions(ulong rawValue) { RawValue = rawValue; }
|
||||||
@@ -170,7 +173,8 @@ namespace Discord
|
|||||||
bool? sendVoiceMessages = null,
|
bool? sendVoiceMessages = null,
|
||||||
bool? useClydeAI = null,
|
bool? useClydeAI = null,
|
||||||
bool? createGuildExpressions = null,
|
bool? createGuildExpressions = null,
|
||||||
bool? setVoiceChannelStatus = null)
|
bool? setVoiceChannelStatus = null,
|
||||||
|
bool? sendPolls = null)
|
||||||
{
|
{
|
||||||
ulong value = initialValue;
|
ulong value = initialValue;
|
||||||
|
|
||||||
@@ -221,6 +225,7 @@ namespace Discord
|
|||||||
Permissions.SetValue(ref value, useClydeAI, GuildPermission.UseClydeAI);
|
Permissions.SetValue(ref value, useClydeAI, GuildPermission.UseClydeAI);
|
||||||
Permissions.SetValue(ref value, createGuildExpressions, GuildPermission.CreateGuildExpressions);
|
Permissions.SetValue(ref value, createGuildExpressions, GuildPermission.CreateGuildExpressions);
|
||||||
Permissions.SetValue(ref value, setVoiceChannelStatus, GuildPermission.SetVoiceChannelStatus);
|
Permissions.SetValue(ref value, setVoiceChannelStatus, GuildPermission.SetVoiceChannelStatus);
|
||||||
|
Permissions.SetValue(ref value, sendPolls, GuildPermission.SendPolls);
|
||||||
|
|
||||||
RawValue = value;
|
RawValue = value;
|
||||||
}
|
}
|
||||||
@@ -273,7 +278,8 @@ namespace Discord
|
|||||||
bool sendVoiceMessages = false,
|
bool sendVoiceMessages = false,
|
||||||
bool useClydeAI = false,
|
bool useClydeAI = false,
|
||||||
bool createGuildExpressions = false,
|
bool createGuildExpressions = false,
|
||||||
bool setVoiceChannelStatus = false)
|
bool setVoiceChannelStatus = false,
|
||||||
|
bool sendPolls = false)
|
||||||
: this(0,
|
: this(0,
|
||||||
createInstantInvite: createInstantInvite,
|
createInstantInvite: createInstantInvite,
|
||||||
manageRoles: manageRoles,
|
manageRoles: manageRoles,
|
||||||
@@ -321,7 +327,8 @@ namespace Discord
|
|||||||
sendVoiceMessages: sendVoiceMessages,
|
sendVoiceMessages: sendVoiceMessages,
|
||||||
useClydeAI: useClydeAI,
|
useClydeAI: useClydeAI,
|
||||||
createGuildExpressions: createGuildExpressions,
|
createGuildExpressions: createGuildExpressions,
|
||||||
setVoiceChannelStatus: setVoiceChannelStatus)
|
setVoiceChannelStatus: setVoiceChannelStatus,
|
||||||
|
sendPolls: sendPolls)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
/// <summary> Creates a new <see cref="GuildPermissions"/> from this one, changing the provided non-null permissions. </summary>
|
/// <summary> Creates a new <see cref="GuildPermissions"/> from this one, changing the provided non-null permissions. </summary>
|
||||||
@@ -372,13 +379,15 @@ namespace Discord
|
|||||||
bool? sendVoiceMessages = null,
|
bool? sendVoiceMessages = null,
|
||||||
bool? useClydeAI = null,
|
bool? useClydeAI = null,
|
||||||
bool? createGuildExpressions = null,
|
bool? createGuildExpressions = null,
|
||||||
bool? setVoiceChannelStatus = null)
|
bool? setVoiceChannelStatus = null,
|
||||||
|
bool? sendPolls = null)
|
||||||
=> new GuildPermissions(RawValue, createInstantInvite, kickMembers, banMembers, administrator, manageChannels, manageGuild, addReactions,
|
=> new GuildPermissions(RawValue, createInstantInvite, kickMembers, banMembers, administrator, manageChannels, manageGuild, addReactions,
|
||||||
viewAuditLog, viewGuildInsights, viewChannel, sendMessages, sendTTSMessages, manageMessages, embedLinks, attachFiles,
|
viewAuditLog, viewGuildInsights, viewChannel, sendMessages, sendTTSMessages, manageMessages, embedLinks, attachFiles,
|
||||||
readMessageHistory, mentionEveryone, useExternalEmojis, connect, speak, muteMembers, deafenMembers, moveMembers,
|
readMessageHistory, mentionEveryone, useExternalEmojis, connect, speak, muteMembers, deafenMembers, moveMembers,
|
||||||
useVoiceActivation, prioritySpeaker, stream, changeNickname, manageNicknames, manageRoles, manageWebhooks, manageEmojisAndStickers,
|
useVoiceActivation, prioritySpeaker, stream, changeNickname, manageNicknames, manageRoles, manageWebhooks, manageEmojisAndStickers,
|
||||||
useApplicationCommands, requestToSpeak, manageEvents, manageThreads, createPublicThreads, createPrivateThreads, useExternalStickers, sendMessagesInThreads,
|
useApplicationCommands, requestToSpeak, manageEvents, manageThreads, createPublicThreads, createPrivateThreads, useExternalStickers, sendMessagesInThreads,
|
||||||
startEmbeddedActivities, moderateMembers, useSoundboard, viewMonetizationAnalytics, sendVoiceMessages, useClydeAI, createGuildExpressions, setVoiceChannelStatus);
|
startEmbeddedActivities, moderateMembers, useSoundboard, viewMonetizationAnalytics, sendVoiceMessages, useClydeAI, createGuildExpressions, setVoiceChannelStatus,
|
||||||
|
sendPolls);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a value that indicates if a specific <see cref="GuildPermission"/> is enabled
|
/// Returns a value that indicates if a specific <see cref="GuildPermission"/> is enabled
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ namespace Discord
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <example>
|
/// <example>
|
||||||
/// <para>The following example checks if the current user has the ability to send a message with attachment in
|
/// <para>The following example checks if the current user has the ability to send a message with attachment in
|
||||||
/// this channel; if so, uploads a file via <see cref="IMessageChannel.SendFileAsync(string, string, bool, Embed, RequestOptions, bool, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[], MessageFlags)"/>.</para>
|
/// this channel; if so, uploads a file via <see cref="IMessageChannel.SendFileAsync(string, string, bool, Embed, RequestOptions, bool, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[], MessageFlags, PollProperties)"/>.</para>
|
||||||
/// <code language="cs">
|
/// <code language="cs">
|
||||||
/// if (currentUser?.GetPermissions(targetChannel)?.AttachFiles)
|
/// if (currentUser?.GetPermissions(targetChannel)?.AttachFiles)
|
||||||
/// await targetChannel.SendFileAsync("fortnite.png");
|
/// await targetChannel.SendFileAsync("fortnite.png");
|
||||||
|
|||||||
@@ -59,6 +59,16 @@ namespace Discord
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
AutoModerationActionExecution = 1 << 21,
|
AutoModerationActionExecution = 1 << 21,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This intent includes MESSAGE_POLL_VOTE_ADD and MESSAGE_POLL_VOTE_REMOVE
|
||||||
|
/// </summary>
|
||||||
|
GuildMessagePolls = 1 << 24,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This intent includes MESSAGE_POLL_VOTE_ADD and MESSAGE_POLL_VOTE_REMOVE
|
||||||
|
/// </summary>
|
||||||
|
DirectMessagePolls = 1 << 25,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This intent includes all but <see cref="GuildMembers"/>, <see cref="GuildPresences"/> and <see cref="MessageContent"/>
|
/// This intent includes all but <see cref="GuildMembers"/>, <see cref="GuildPresences"/> and <see cref="MessageContent"/>
|
||||||
/// which are privileged and must be enabled in the Developer Portal.
|
/// which are privileged and must be enabled in the Developer Portal.
|
||||||
@@ -66,7 +76,7 @@ namespace Discord
|
|||||||
AllUnprivileged = Guilds | GuildBans | GuildEmojis | GuildIntegrations | GuildWebhooks | GuildInvites |
|
AllUnprivileged = Guilds | GuildBans | GuildEmojis | GuildIntegrations | GuildWebhooks | GuildInvites |
|
||||||
GuildVoiceStates | GuildMessages | GuildMessageReactions | GuildMessageTyping | DirectMessages |
|
GuildVoiceStates | GuildMessages | GuildMessageReactions | GuildMessageTyping | DirectMessages |
|
||||||
DirectMessageReactions | DirectMessageTyping | GuildScheduledEvents | AutoModerationConfiguration |
|
DirectMessageReactions | DirectMessageTyping | GuildScheduledEvents | AutoModerationConfiguration |
|
||||||
AutoModerationActionExecution,
|
AutoModerationActionExecution | GuildMessagePolls | DirectMessagePolls,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This intent includes all of them, including privileged ones.
|
/// This intent includes all of them, including privileged ones.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ namespace Discord
|
|||||||
#region Message Validation
|
#region Message Validation
|
||||||
|
|
||||||
public static void WebhookMessageAtLeastOneOf(string text = null, MessageComponent components = null, ICollection<IEmbed> embeds = null,
|
public static void WebhookMessageAtLeastOneOf(string text = null, MessageComponent components = null, ICollection<IEmbed> embeds = null,
|
||||||
IEnumerable<FileAttachment> attachments = null)
|
IEnumerable<FileAttachment> attachments = null, PollProperties poll = null)
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(text))
|
if (!string.IsNullOrEmpty(text))
|
||||||
return;
|
return;
|
||||||
@@ -91,11 +91,14 @@ namespace Discord
|
|||||||
if (embeds != null && embeds.Count != 0)
|
if (embeds != null && embeds.Count != 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
throw new ArgumentException($"At least one of 'Content', 'Embeds', 'Components' or 'Attachments' must be specified.");
|
if (poll is not null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
throw new ArgumentException($"At least one of 'Content', 'Embeds', 'Components', 'Attachments' or 'Poll' must be specified.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void MessageAtLeastOneOf(string text = null, MessageComponent components = null, ICollection<IEmbed> embeds = null,
|
public static void MessageAtLeastOneOf(string text = null, MessageComponent components = null, ICollection<IEmbed> embeds = null,
|
||||||
ICollection<ISticker> stickers = null, IEnumerable<FileAttachment> attachments = null)
|
ICollection<ISticker> stickers = null, IEnumerable<FileAttachment> attachments = null, PollProperties poll = null)
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(text))
|
if (!string.IsNullOrEmpty(text))
|
||||||
return;
|
return;
|
||||||
@@ -112,7 +115,31 @@ namespace Discord
|
|||||||
if (embeds != null && embeds.Count != 0)
|
if (embeds != null && embeds.Count != 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
throw new ArgumentException($"At least one of 'Content', 'Embeds', 'Components', 'Stickers' or 'Attachments' must be specified.");
|
if (poll is not null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
throw new ArgumentException($"At least one of 'Content', 'Embeds', 'Components', 'Stickers', 'Attachments' or 'Poll' must be specified.");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ValidatePoll(PollProperties poll)
|
||||||
|
{
|
||||||
|
if (poll is null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (poll.Answers.Count is < 1 or > 10)
|
||||||
|
throw new ArgumentOutOfRangeException(nameof(poll.Answers), "Poll answers must be between 1 and 10.");
|
||||||
|
if (poll.Answers.Any(x => x.Text.Length > DiscordConfig.MaxPollAnswerTextLength))
|
||||||
|
throw new ArgumentOutOfRangeException(nameof(poll.Answers), $"Poll answer text must be less than or equal to {DiscordConfig.MaxPollAnswerTextLength} characters.");
|
||||||
|
if (poll.Answers.All(x => string.IsNullOrWhiteSpace(x.Text) && x.Emoji is null))
|
||||||
|
throw new ArgumentException("Poll answers must have at least one of text or emoji.", nameof(poll.Answers));
|
||||||
|
if (poll.Question is null)
|
||||||
|
throw new ArgumentNullException(nameof(poll.Question), "Poll question must not be null.");
|
||||||
|
if (poll.Question.Text.Length > DiscordConfig.MaxPollQuestionTextLength)
|
||||||
|
throw new ArgumentOutOfRangeException(nameof(poll.Question), $"Poll question text must be less than or equal to {DiscordConfig.MaxPollQuestionTextLength} characters.");
|
||||||
|
if (string.IsNullOrWhiteSpace(poll.Question.Text) && poll.Question.Emoji is null)
|
||||||
|
throw new ArgumentException("Poll question must have at least one of text or emoji.", nameof(poll.Question));
|
||||||
|
if (poll.Duration is > 168 or 0)
|
||||||
|
throw new ArgumentOutOfRangeException(nameof(poll.Duration), "Poll duration must be between 1 and 168 hours.");
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -44,61 +44,61 @@ namespace Discord.Interactions
|
|||||||
protected virtual Task DeferAsync(bool ephemeral = false, RequestOptions options = null)
|
protected virtual Task DeferAsync(bool ephemeral = false, RequestOptions options = null)
|
||||||
=> Context.Interaction.DeferAsync(ephemeral, options);
|
=> Context.Interaction.DeferAsync(ephemeral, options);
|
||||||
|
|
||||||
/// <inheritdoc cref="IDiscordInteraction.RespondAsync(string, Embed[], bool, bool, AllowedMentions, MessageComponent, Embed, RequestOptions)"/>
|
/// <inheritdoc cref="IDiscordInteraction.RespondAsync(string, Embed[], bool, bool, AllowedMentions, MessageComponent, Embed, RequestOptions, PollProperties)"/>
|
||||||
protected virtual Task RespondAsync(string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
protected virtual Task RespondAsync(string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
||||||
AllowedMentions allowedMentions = null, RequestOptions options = null, MessageComponent components = null, Embed embed = null)
|
AllowedMentions allowedMentions = null, RequestOptions options = null, MessageComponent components = null, Embed embed = null, PollProperties poll = null)
|
||||||
=> Context.Interaction.RespondAsync(text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options);
|
=> Context.Interaction.RespondAsync(text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options, poll);
|
||||||
|
|
||||||
/// <inheritdoc cref="IDiscordInteraction.RespondWithFileAsync(Stream, string, string, Embed[], bool, bool, AllowedMentions, MessageComponent, Embed, RequestOptions)"/>
|
/// <inheritdoc cref="IDiscordInteraction.RespondWithFileAsync(Stream, string, string, Embed[], bool, bool, AllowedMentions, MessageComponent, Embed, RequestOptions, PollProperties)"/>
|
||||||
protected virtual Task RespondWithFileAsync(Stream fileStream, string fileName, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
protected virtual Task RespondWithFileAsync(Stream fileStream, string fileName, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
||||||
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null)
|
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null)
|
||||||
=> Context.Interaction.RespondWithFileAsync(fileStream, fileName, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options);
|
=> Context.Interaction.RespondWithFileAsync(fileStream, fileName, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options, poll);
|
||||||
|
|
||||||
/// <inheritdoc cref="IDiscordInteraction.RespondWithFileAsync(string, string, string, Embed[], bool, bool, AllowedMentions, MessageComponent, Embed, RequestOptions)"/>
|
/// <inheritdoc cref="IDiscordInteraction.RespondWithFileAsync(string, string, string, Embed[], bool, bool, AllowedMentions, MessageComponent, Embed, RequestOptions, PollProperties)"/>
|
||||||
protected virtual Task RespondWithFileAsync(string filePath, string fileName = null, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
protected virtual Task RespondWithFileAsync(string filePath, string fileName = null, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
||||||
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null)
|
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null)
|
||||||
=> Context.Interaction.RespondWithFileAsync(filePath, fileName, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options);
|
=> Context.Interaction.RespondWithFileAsync(filePath, fileName, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options, poll);
|
||||||
|
|
||||||
/// <inheritdoc cref="IDiscordInteraction.RespondWithFileAsync(FileAttachment, string, Embed[], bool, bool, AllowedMentions, MessageComponent, Embed, RequestOptions)"/>
|
/// <inheritdoc cref="IDiscordInteraction.RespondWithFileAsync(FileAttachment, string, Embed[], bool, bool, AllowedMentions, MessageComponent, Embed, RequestOptions, PollProperties)"/>
|
||||||
protected virtual Task RespondWithFileAsync(FileAttachment attachment, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
protected virtual Task RespondWithFileAsync(FileAttachment attachment, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
||||||
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null)
|
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null)
|
||||||
=> Context.Interaction.RespondWithFileAsync(attachment, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options);
|
=> Context.Interaction.RespondWithFileAsync(attachment, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options, poll);
|
||||||
|
|
||||||
/// <inheritdoc cref="IDiscordInteraction.RespondWithFilesAsync(IEnumerable{FileAttachment}, string, Embed[], bool, bool, AllowedMentions, MessageComponent, Embed, RequestOptions)"/>
|
/// <inheritdoc cref="IDiscordInteraction.RespondWithFilesAsync(IEnumerable{FileAttachment}, string, Embed[], bool, bool, AllowedMentions, MessageComponent, Embed, RequestOptions, PollProperties)"/>
|
||||||
protected virtual Task RespondWithFilesAsync(IEnumerable<FileAttachment> attachments, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
protected virtual Task RespondWithFilesAsync(IEnumerable<FileAttachment> attachments, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
||||||
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null)
|
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null)
|
||||||
=> Context.Interaction.RespondWithFilesAsync(attachments, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options);
|
=> Context.Interaction.RespondWithFilesAsync(attachments, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options, poll);
|
||||||
|
|
||||||
/// <inheritdoc cref="IDiscordInteraction.FollowupAsync(string, Embed[], bool, bool, AllowedMentions, MessageComponent, Embed, RequestOptions)"/>
|
/// <inheritdoc cref="IDiscordInteraction.FollowupAsync(string, Embed[], bool, bool, AllowedMentions, MessageComponent, Embed, RequestOptions, PollProperties)"/>
|
||||||
protected virtual Task<IUserMessage> FollowupAsync(string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
protected virtual Task<IUserMessage> FollowupAsync(string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
||||||
AllowedMentions allowedMentions = null, RequestOptions options = null, MessageComponent components = null, Embed embed = null)
|
AllowedMentions allowedMentions = null, RequestOptions options = null, MessageComponent components = null, Embed embed = null, PollProperties poll = null)
|
||||||
=> Context.Interaction.FollowupAsync(text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options);
|
=> Context.Interaction.FollowupAsync(text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options, poll);
|
||||||
|
|
||||||
/// <inheritdoc cref="IDiscordInteraction.FollowupWithFileAsync(Stream, string, string, Embed[], bool, bool, AllowedMentions, MessageComponent, Embed, RequestOptions)"/>
|
/// <inheritdoc cref="IDiscordInteraction.FollowupWithFileAsync(Stream, string, string, Embed[], bool, bool, AllowedMentions, MessageComponent, Embed, RequestOptions, PollProperties)"/>
|
||||||
protected virtual Task<IUserMessage> FollowupWithFileAsync(Stream fileStream, string fileName, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
protected virtual Task<IUserMessage> FollowupWithFileAsync(Stream fileStream, string fileName, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
||||||
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null)
|
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null)
|
||||||
=> Context.Interaction.FollowupWithFileAsync(fileStream, fileName, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options);
|
=> Context.Interaction.FollowupWithFileAsync(fileStream, fileName, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options);
|
||||||
|
|
||||||
/// <inheritdoc cref="IDiscordInteraction.FollowupWithFileAsync(string, string, string, Embed[], bool, bool, AllowedMentions, MessageComponent, Embed, RequestOptions)"/>
|
/// <inheritdoc cref="IDiscordInteraction.FollowupWithFileAsync(string, string, string, Embed[], bool, bool, AllowedMentions, MessageComponent, Embed, RequestOptions, PollProperties)"/>
|
||||||
protected virtual Task<IUserMessage> FollowupWithFileAsync(string filePath, string fileName = null, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
protected virtual Task<IUserMessage> FollowupWithFileAsync(string filePath, string fileName = null, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
||||||
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null)
|
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null)
|
||||||
=> Context.Interaction.FollowupWithFileAsync(filePath, fileName, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options);
|
=> Context.Interaction.FollowupWithFileAsync(filePath, fileName, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options, poll);
|
||||||
|
|
||||||
/// <inheritdoc cref="IDiscordInteraction.FollowupWithFileAsync(FileAttachment, string, Embed[], bool, bool, AllowedMentions, MessageComponent, Embed, RequestOptions)"/>
|
/// <inheritdoc cref="IDiscordInteraction.FollowupWithFileAsync(FileAttachment, string, Embed[], bool, bool, AllowedMentions, MessageComponent, Embed, RequestOptions, PollProperties)"/>
|
||||||
protected virtual Task<IUserMessage> FollowupWithFileAsync(FileAttachment attachment, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
protected virtual Task<IUserMessage> FollowupWithFileAsync(FileAttachment attachment, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
||||||
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null)
|
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null)
|
||||||
=> Context.Interaction.FollowupWithFileAsync(attachment, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options);
|
=> Context.Interaction.FollowupWithFileAsync(attachment, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options, poll);
|
||||||
|
|
||||||
/// <inheritdoc cref="IDiscordInteraction.FollowupWithFilesAsync(IEnumerable{FileAttachment}, string, Embed[], bool, bool, AllowedMentions, MessageComponent, Embed, RequestOptions)"/>
|
/// <inheritdoc cref="IDiscordInteraction.FollowupWithFilesAsync(IEnumerable{FileAttachment}, string, Embed[], bool, bool, AllowedMentions, MessageComponent, Embed, RequestOptions, PollProperties)"/>
|
||||||
protected virtual Task<IUserMessage> FollowupWithFilesAsync(IEnumerable<FileAttachment> attachments, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
protected virtual Task<IUserMessage> FollowupWithFilesAsync(IEnumerable<FileAttachment> attachments, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
||||||
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null)
|
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null)
|
||||||
=> Context.Interaction.FollowupWithFilesAsync(attachments, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options);
|
=> Context.Interaction.FollowupWithFilesAsync(attachments, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options, poll);
|
||||||
|
|
||||||
/// <inheritdoc cref="IMessageChannel.SendMessageAsync(string, bool, Embed, RequestOptions, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[], MessageFlags)"/>
|
/// <inheritdoc cref="IMessageChannel.SendMessageAsync(string, bool, Embed, RequestOptions, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[], MessageFlags, PollProperties)"/>
|
||||||
protected virtual Task<IUserMessage> ReplyAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null,
|
protected virtual Task<IUserMessage> ReplyAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null,
|
||||||
AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
||||||
Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
|
Embed[] embeds = null, MessageFlags flags = MessageFlags.None, PollProperties poll = null)
|
||||||
=> Context.Channel.SendMessageAsync(text, false, embed, options, allowedMentions, messageReference, components, stickers, embeds, flags);
|
=> Context.Channel.SendMessageAsync(text, false, embed, options, allowedMentions, messageReference, components, stickers, embeds, flags, poll);
|
||||||
|
|
||||||
/// <inheritdoc cref="IDiscordInteraction.GetOriginalResponseAsync(RequestOptions)"/>
|
/// <inheritdoc cref="IDiscordInteraction.GetOriginalResponseAsync(RequestOptions)"/>
|
||||||
protected virtual Task<IUserMessage> GetOriginalResponseAsync(RequestOptions options = null)
|
protected virtual Task<IUserMessage> GetOriginalResponseAsync(RequestOptions options = null)
|
||||||
|
|||||||
@@ -43,8 +43,8 @@ namespace Discord.Interactions
|
|||||||
/// A Task representing the operation of creating the interaction response.
|
/// A Task representing the operation of creating the interaction response.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
/// <exception cref="InvalidOperationException">Thrown if the interaction isn't a type of <see cref="RestInteraction"/>.</exception>
|
/// <exception cref="InvalidOperationException">Thrown if the interaction isn't a type of <see cref="RestInteraction"/>.</exception>
|
||||||
protected override Task RespondAsync(string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, AllowedMentions allowedMentions = null, RequestOptions options = null, MessageComponent components = null, Embed embed = null)
|
protected override Task RespondAsync(string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, AllowedMentions allowedMentions = null, RequestOptions options = null, MessageComponent components = null, Embed embed = null, PollProperties poll = null)
|
||||||
=> HandleInteractionAsync(x => x.Respond(text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options));
|
=> HandleInteractionAsync(x => x.Respond(text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options, poll));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Responds to the interaction with a modal.
|
/// Responds to the interaction with a modal.
|
||||||
|
|||||||
@@ -1,33 +1,30 @@
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Discord.API
|
namespace Discord.API.Rest;
|
||||||
|
|
||||||
|
internal class ForumThreadMessage
|
||||||
{
|
{
|
||||||
internal class ForumThreadMessage
|
[JsonProperty("content")]
|
||||||
{
|
public Optional<string> Content { get; set; }
|
||||||
[JsonProperty("content")]
|
|
||||||
public Optional<string> Content { get; set; }
|
|
||||||
|
|
||||||
[JsonProperty("nonce")]
|
[JsonProperty("nonce")]
|
||||||
public Optional<string> Nonce { get; set; }
|
public Optional<string> Nonce { get; set; }
|
||||||
|
|
||||||
[JsonProperty("embeds")]
|
[JsonProperty("embeds")]
|
||||||
public Optional<Embed[]> Embeds { get; set; }
|
public Optional<Embed[]> Embeds { get; set; }
|
||||||
|
|
||||||
[JsonProperty("allowed_mentions")]
|
[JsonProperty("allowed_mentions")]
|
||||||
public Optional<AllowedMentions> AllowedMentions { get; set; }
|
public Optional<AllowedMentions> AllowedMentions { get; set; }
|
||||||
|
|
||||||
[JsonProperty("components")]
|
[JsonProperty("components")]
|
||||||
public Optional<API.ActionRowComponent[]> Components { get; set; }
|
public Optional<API.ActionRowComponent[]> Components { get; set; }
|
||||||
|
|
||||||
[JsonProperty("sticker_ids")]
|
[JsonProperty("sticker_ids")]
|
||||||
public Optional<ulong[]> Stickers { get; set; }
|
public Optional<ulong[]> Stickers { get; set; }
|
||||||
|
|
||||||
[JsonProperty("flags")]
|
[JsonProperty("flags")]
|
||||||
public Optional<MessageFlags> Flags { get; set; }
|
public Optional<MessageFlags> Flags { get; set; }
|
||||||
}
|
|
||||||
|
[JsonProperty("poll")]
|
||||||
|
public Optional<CreatePollParams> Poll { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using Discord.API.Rest;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace Discord.API
|
namespace Discord.API
|
||||||
@@ -30,5 +31,8 @@ namespace Discord.API
|
|||||||
|
|
||||||
[JsonProperty("custom_id")]
|
[JsonProperty("custom_id")]
|
||||||
public Optional<string> CustomId { get; set; }
|
public Optional<string> CustomId { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("poll")]
|
||||||
|
public Optional<CreatePollParams> Poll { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,4 +101,7 @@ internal class Message
|
|||||||
|
|
||||||
[JsonProperty("interaction_metadata")]
|
[JsonProperty("interaction_metadata")]
|
||||||
public Optional<MessageInteractionMetadata> InteractionMetadata { get; set; }
|
public Optional<MessageInteractionMetadata> InteractionMetadata { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("poll")]
|
||||||
|
public Optional<Poll> Poll { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
25
src/Discord.Net.Rest/API/Common/Poll.cs
Normal file
25
src/Discord.Net.Rest/API/Common/Poll.cs
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Discord.API;
|
||||||
|
|
||||||
|
internal class Poll
|
||||||
|
{
|
||||||
|
[JsonProperty("question")]
|
||||||
|
public PollMedia Question { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("answers")]
|
||||||
|
public PollAnswer[] Answers { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("expiry")]
|
||||||
|
public DateTimeOffset Expiry { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("allow_multiselect")]
|
||||||
|
public bool AllowMultiselect { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("layout_type")]
|
||||||
|
public PollLayout LayoutType { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("results")]
|
||||||
|
public Optional<PollResults> PollResults { get; set; }
|
||||||
|
}
|
||||||
12
src/Discord.Net.Rest/API/Common/PollAnswer.cs
Normal file
12
src/Discord.Net.Rest/API/Common/PollAnswer.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace Discord.API;
|
||||||
|
|
||||||
|
internal class PollAnswer
|
||||||
|
{
|
||||||
|
[JsonProperty("answer_id")]
|
||||||
|
public uint AnswerId { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("poll_media")]
|
||||||
|
public PollMedia PollMedia { get; set; }
|
||||||
|
}
|
||||||
15
src/Discord.Net.Rest/API/Common/PollAnswerCount.cs
Normal file
15
src/Discord.Net.Rest/API/Common/PollAnswerCount.cs
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace Discord.API;
|
||||||
|
|
||||||
|
internal class PollAnswerCount
|
||||||
|
{
|
||||||
|
[JsonProperty("id")]
|
||||||
|
public ulong Id { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("count")]
|
||||||
|
public uint Count { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("me_voted")]
|
||||||
|
public bool MeVoted { get; set; }
|
||||||
|
}
|
||||||
9
src/Discord.Net.Rest/API/Common/PollAnswerVoters.cs
Normal file
9
src/Discord.Net.Rest/API/Common/PollAnswerVoters.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace Discord.API;
|
||||||
|
|
||||||
|
internal class PollAnswerVoters
|
||||||
|
{
|
||||||
|
[JsonProperty("users")]
|
||||||
|
public User[] Users { get; set; }
|
||||||
|
}
|
||||||
12
src/Discord.Net.Rest/API/Common/PollMedia.cs
Normal file
12
src/Discord.Net.Rest/API/Common/PollMedia.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace Discord.API;
|
||||||
|
|
||||||
|
internal class PollMedia
|
||||||
|
{
|
||||||
|
[JsonProperty("text")]
|
||||||
|
public string Text { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("emoji")]
|
||||||
|
public Optional<Emoji> Emoji { get; set; }
|
||||||
|
}
|
||||||
12
src/Discord.Net.Rest/API/Common/PollResults.cs
Normal file
12
src/Discord.Net.Rest/API/Common/PollResults.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace Discord.API;
|
||||||
|
|
||||||
|
internal class PollResults
|
||||||
|
{
|
||||||
|
[JsonProperty("is_finalized")]
|
||||||
|
public bool IsFinalized { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("answer_counts")]
|
||||||
|
public PollAnswerCount[] AnswerCounts { get; set; }
|
||||||
|
}
|
||||||
@@ -31,5 +31,8 @@ namespace Discord.API.Rest
|
|||||||
|
|
||||||
[JsonProperty("flags")]
|
[JsonProperty("flags")]
|
||||||
public Optional<MessageFlags> Flags { get; set; }
|
public Optional<MessageFlags> Flags { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("poll")]
|
||||||
|
public Optional<CreatePollParams> Poll { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ namespace Discord.API.Rest
|
|||||||
public Optional<MessageFlags?> Flags { get; set; }
|
public Optional<MessageFlags?> Flags { get; set; }
|
||||||
public Optional<ulong[]> Stickers { get; set; }
|
public Optional<ulong[]> Stickers { get; set; }
|
||||||
public Optional<ulong[]> TagIds { get; set; }
|
public Optional<ulong[]> TagIds { get; set; }
|
||||||
|
public Optional<CreatePollParams> Poll { get; set; }
|
||||||
|
|
||||||
public CreateMultipartPostAsync(params FileAttachment[] attachments)
|
public CreateMultipartPostAsync(params FileAttachment[] attachments)
|
||||||
{
|
{
|
||||||
@@ -62,6 +63,8 @@ namespace Discord.API.Rest
|
|||||||
message["sticker_ids"] = Stickers.Value;
|
message["sticker_ids"] = Stickers.Value;
|
||||||
if (Flags.IsSpecified)
|
if (Flags.IsSpecified)
|
||||||
message["flags"] = Flags.Value;
|
message["flags"] = Flags.Value;
|
||||||
|
if (Poll.IsSpecified)
|
||||||
|
message["poll"] = Poll.Value;
|
||||||
|
|
||||||
List<object> attachments = new();
|
List<object> attachments = new();
|
||||||
|
|
||||||
|
|||||||
21
src/Discord.Net.Rest/API/Rest/CreatePollParams.cs
Normal file
21
src/Discord.Net.Rest/API/Rest/CreatePollParams.cs
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace Discord.API.Rest;
|
||||||
|
|
||||||
|
internal class CreatePollParams
|
||||||
|
{
|
||||||
|
[JsonProperty("question")]
|
||||||
|
public PollMedia Question { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("answers")]
|
||||||
|
public PollAnswer[] Answers { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("duration")]
|
||||||
|
public uint Duration { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("allow_multiselect")]
|
||||||
|
public bool AllowMultiselect { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("layout_type")]
|
||||||
|
public Optional<PollLayout> LayoutType { get; set; }
|
||||||
|
}
|
||||||
@@ -48,6 +48,9 @@ namespace Discord.API.Rest
|
|||||||
[JsonProperty("applied_tags")]
|
[JsonProperty("applied_tags")]
|
||||||
public Optional<ulong[]> AppliedTags { get; set; }
|
public Optional<ulong[]> AppliedTags { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("poll")]
|
||||||
|
public Optional<CreatePollParams> Poll { get; set; }
|
||||||
|
|
||||||
public IReadOnlyDictionary<string, object> ToDictionary()
|
public IReadOnlyDictionary<string, object> ToDictionary()
|
||||||
{
|
{
|
||||||
var d = new Dictionary<string, object>();
|
var d = new Dictionary<string, object>();
|
||||||
@@ -80,6 +83,11 @@ namespace Discord.API.Rest
|
|||||||
payload["thread_name"] = ThreadName.Value;
|
payload["thread_name"] = ThreadName.Value;
|
||||||
if (AppliedTags.IsSpecified)
|
if (AppliedTags.IsSpecified)
|
||||||
payload["applied_tags"] = AppliedTags.Value;
|
payload["applied_tags"] = AppliedTags.Value;
|
||||||
|
if (Flags.IsSpecified)
|
||||||
|
payload["flags"] = Flags.Value;
|
||||||
|
if (Poll.IsSpecified)
|
||||||
|
payload["poll"] = Poll.Value;
|
||||||
|
|
||||||
|
|
||||||
var json = new StringBuilder();
|
var json = new StringBuilder();
|
||||||
using (var text = new StringWriter(json))
|
using (var text = new StringWriter(json))
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ namespace Discord.API.Rest
|
|||||||
public Optional<ActionRowComponent[]> MessageComponent { get; set; }
|
public Optional<ActionRowComponent[]> MessageComponent { get; set; }
|
||||||
public Optional<MessageFlags?> Flags { get; set; }
|
public Optional<MessageFlags?> Flags { get; set; }
|
||||||
public Optional<ulong[]> Stickers { get; set; }
|
public Optional<ulong[]> Stickers { get; set; }
|
||||||
|
public Optional<CreatePollParams> Poll { get; set; }
|
||||||
|
|
||||||
public UploadFileParams(params Discord.FileAttachment[] attachments)
|
public UploadFileParams(params Discord.FileAttachment[] attachments)
|
||||||
{
|
{
|
||||||
@@ -52,6 +53,8 @@ namespace Discord.API.Rest
|
|||||||
payload["sticker_ids"] = Stickers.Value;
|
payload["sticker_ids"] = Stickers.Value;
|
||||||
if (Flags.IsSpecified)
|
if (Flags.IsSpecified)
|
||||||
payload["flags"] = Flags.Value;
|
payload["flags"] = Flags.Value;
|
||||||
|
if (Poll.IsSpecified)
|
||||||
|
payload["poll"] = Poll.Value;
|
||||||
|
|
||||||
List<object> attachments = new();
|
List<object> attachments = new();
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ namespace Discord.API.Rest
|
|||||||
public Optional<AllowedMentions> AllowedMentions { get; set; }
|
public Optional<AllowedMentions> AllowedMentions { get; set; }
|
||||||
public Optional<ActionRowComponent[]> MessageComponents { get; set; }
|
public Optional<ActionRowComponent[]> MessageComponents { get; set; }
|
||||||
public Optional<MessageFlags> Flags { get; set; }
|
public Optional<MessageFlags> Flags { get; set; }
|
||||||
|
public Optional<CreatePollParams> Poll { get; set; }
|
||||||
|
|
||||||
public bool HasData
|
public bool HasData
|
||||||
=> Content.IsSpecified ||
|
=> Content.IsSpecified ||
|
||||||
@@ -31,7 +32,8 @@ namespace Discord.API.Rest
|
|||||||
AllowedMentions.IsSpecified ||
|
AllowedMentions.IsSpecified ||
|
||||||
MessageComponents.IsSpecified ||
|
MessageComponents.IsSpecified ||
|
||||||
Flags.IsSpecified ||
|
Flags.IsSpecified ||
|
||||||
Files.Any();
|
Files.Any()
|
||||||
|
|| Poll.IsSpecified;
|
||||||
|
|
||||||
public UploadInteractionFileParams(params FileAttachment[] files)
|
public UploadInteractionFileParams(params FileAttachment[] files)
|
||||||
{
|
{
|
||||||
@@ -59,6 +61,8 @@ namespace Discord.API.Rest
|
|||||||
data["allowed_mentions"] = AllowedMentions.Value;
|
data["allowed_mentions"] = AllowedMentions.Value;
|
||||||
if (Flags.IsSpecified)
|
if (Flags.IsSpecified)
|
||||||
data["flags"] = Flags.Value;
|
data["flags"] = Flags.Value;
|
||||||
|
if (Poll.IsSpecified)
|
||||||
|
data["poll"] = Poll.Value;
|
||||||
|
|
||||||
List<object> attachments = new();
|
List<object> attachments = new();
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ namespace Discord.API.Rest
|
|||||||
public Optional<MessageFlags> Flags { get; set; }
|
public Optional<MessageFlags> Flags { get; set; }
|
||||||
public Optional<string> ThreadName { get; set; }
|
public Optional<string> ThreadName { get; set; }
|
||||||
public Optional<ulong[]> AppliedTags { get; set; }
|
public Optional<ulong[]> AppliedTags { get; set; }
|
||||||
|
public Optional<CreatePollParams> Poll { get; set; }
|
||||||
|
|
||||||
public UploadWebhookFileParams(params FileAttachment[] files)
|
public UploadWebhookFileParams(params FileAttachment[] files)
|
||||||
{
|
{
|
||||||
@@ -57,6 +58,8 @@ namespace Discord.API.Rest
|
|||||||
payload["thread_name"] = ThreadName.Value;
|
payload["thread_name"] = ThreadName.Value;
|
||||||
if (AppliedTags.IsSpecified)
|
if (AppliedTags.IsSpecified)
|
||||||
payload["applied_tags"] = AppliedTags.Value;
|
payload["applied_tags"] = AppliedTags.Value;
|
||||||
|
if (Poll.IsSpecified)
|
||||||
|
payload["poll"] = Poll.Value;
|
||||||
|
|
||||||
List<object> attachments = new();
|
List<object> attachments = new();
|
||||||
|
|
||||||
|
|||||||
@@ -2832,5 +2832,18 @@ namespace Discord.API
|
|||||||
=> SendAsync("POST", () => $"applications/{CurrentApplicationId}/entitlements/{entitlementId}/consume", new BucketIds(), options: options);
|
=> SendAsync("POST", () => $"applications/{CurrentApplicationId}/entitlements/{entitlementId}/consume", new BucketIds(), options: options);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Polls
|
||||||
|
|
||||||
|
public Task<PollAnswerVoters> GetPollAnswerVotersAsync(ulong channelId, ulong messageId, uint answerId, int limit = 100, ulong? afterId = null, RequestOptions options = null)
|
||||||
|
{
|
||||||
|
var urlParams = $"?limit={limit}{(afterId is not null ? $"&after={afterId}" : string.Empty)}";
|
||||||
|
return SendAsync<PollAnswerVoters>("GET", () => $"channels/{channelId}/polls/{messageId}/answers/{answerId}{urlParams}", new BucketIds(channelId: channelId), options: options);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<Message> ExpirePollAsync(ulong channelId, ulong messageId, RequestOptions options = null)
|
||||||
|
=> SendAsync<Message>("POST", () => $"channels/{channelId}/polls/{messageId}/expire", new BucketIds(channelId: channelId), options: options);
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -274,7 +274,7 @@ namespace Discord.Rest
|
|||||||
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</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,
|
string text, bool isTTS, Embed embed, AllowedMentions allowedMentions, MessageReference messageReference,
|
||||||
MessageComponent components, ISticker[] stickers, RequestOptions options, Embed[] embeds, MessageFlags flags)
|
MessageComponent components, ISticker[] stickers, RequestOptions options, Embed[] embeds, MessageFlags flags, PollProperties poll)
|
||||||
{
|
{
|
||||||
embeds ??= Array.Empty<Embed>();
|
embeds ??= Array.Empty<Embed>();
|
||||||
if (embed != null)
|
if (embed != null)
|
||||||
@@ -284,7 +284,8 @@ namespace Discord.Rest
|
|||||||
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, DiscordConfig.MaxEmbedsPerMessage, nameof(embeds), $"A max of {DiscordConfig.MaxEmbedsPerMessage} Embeds are allowed.");
|
Preconditions.AtMost(embeds.Length, DiscordConfig.MaxEmbedsPerMessage, nameof(embeds), $"A max of {DiscordConfig.MaxEmbedsPerMessage} Embeds are allowed.");
|
||||||
|
|
||||||
Preconditions.MessageAtLeastOneOf(text, components, embeds, stickers);
|
Preconditions.MessageAtLeastOneOf(text, components, embeds, stickers, poll: poll);
|
||||||
|
Preconditions.ValidatePoll(poll);
|
||||||
|
|
||||||
// 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)
|
||||||
@@ -308,7 +309,9 @@ namespace Discord.Rest
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (flags is not MessageFlags.None and not MessageFlags.SuppressEmbeds and not MessageFlags.SuppressNotification)
|
if (flags is not MessageFlags.None and not MessageFlags.SuppressEmbeds and not MessageFlags.SuppressNotification)
|
||||||
throw new ArgumentException("The only valid MessageFlags are SuppressEmbeds and none.", nameof(flags));
|
throw new ArgumentException("The only valid MessageFlags are SuppressEmbeds, SuppressNotification and none.", nameof(flags));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var args = new CreateMessageParams
|
var args = new CreateMessageParams
|
||||||
{
|
{
|
||||||
@@ -319,7 +322,8 @@ namespace Discord.Rest
|
|||||||
MessageReference = messageReference?.ToModel(),
|
MessageReference = messageReference?.ToModel(),
|
||||||
Components = components?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ?? Optional<API.ActionRowComponent[]>.Unspecified,
|
Components = components?.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,
|
Stickers = stickers?.Any() ?? false ? stickers.Select(x => x.Id).ToArray() : Optional<ulong[]>.Unspecified,
|
||||||
Flags = flags
|
Flags = flags,
|
||||||
|
Poll = poll?.ToModel() ?? Optional<CreatePollParams>.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);
|
||||||
@@ -353,12 +357,12 @@ namespace Discord.Rest
|
|||||||
public static async Task<RestUserMessage> SendFileAsync(IMessageChannel channel, BaseDiscordClient client,
|
public static async Task<RestUserMessage> SendFileAsync(IMessageChannel channel, BaseDiscordClient client,
|
||||||
string filePath, string text, bool isTTS, Embed embed, AllowedMentions allowedMentions,
|
string filePath, string text, bool isTTS, Embed embed, AllowedMentions allowedMentions,
|
||||||
MessageReference messageReference, MessageComponent components, ISticker[] stickers, RequestOptions options,
|
MessageReference messageReference, MessageComponent components, ISticker[] stickers, RequestOptions options,
|
||||||
bool isSpoiler, Embed[] embeds, MessageFlags flags = MessageFlags.None)
|
bool isSpoiler, Embed[] embeds, MessageFlags flags = MessageFlags.None, PollProperties poll = null)
|
||||||
{
|
{
|
||||||
string filename = Path.GetFileName(filePath);
|
string filename = Path.GetFileName(filePath);
|
||||||
using (var file = File.OpenRead(filePath))
|
using (var file = File.OpenRead(filePath))
|
||||||
return await SendFileAsync(channel, client, file, filename, text, isTTS, embed, allowedMentions,
|
return await SendFileAsync(channel, client, file, filename, text, isTTS, embed, allowedMentions,
|
||||||
messageReference, components, stickers, options, isSpoiler, embeds, flags).ConfigureAwait(false);
|
messageReference, components, stickers, options, isSpoiler, embeds, flags, poll).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <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>
|
||||||
@@ -366,11 +370,11 @@ namespace Discord.Rest
|
|||||||
public static async Task<RestUserMessage> SendFileAsync(IMessageChannel channel, BaseDiscordClient client,
|
public static async Task<RestUserMessage> SendFileAsync(IMessageChannel channel, BaseDiscordClient client,
|
||||||
Stream stream, string filename, string text, bool isTTS, Embed embed, AllowedMentions allowedMentions,
|
Stream stream, string filename, string text, bool isTTS, Embed embed, AllowedMentions allowedMentions,
|
||||||
MessageReference messageReference, MessageComponent components, ISticker[] stickers, RequestOptions options,
|
MessageReference messageReference, MessageComponent components, ISticker[] stickers, RequestOptions options,
|
||||||
bool isSpoiler, Embed[] embeds, MessageFlags flags = MessageFlags.None)
|
bool isSpoiler, Embed[] embeds, MessageFlags flags = MessageFlags.None, PollProperties poll = null)
|
||||||
{
|
{
|
||||||
using (var file = new FileAttachment(stream, filename, isSpoiler: isSpoiler))
|
using (var file = new FileAttachment(stream, filename, isSpoiler: isSpoiler))
|
||||||
return await SendFileAsync(channel, client, file, text, isTTS, embed, allowedMentions, messageReference,
|
return await SendFileAsync(channel, client, file, text, isTTS, embed, allowedMentions, messageReference,
|
||||||
components, stickers, options, embeds, flags).ConfigureAwait(false);
|
components, stickers, options, embeds, flags, poll).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <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>
|
||||||
@@ -378,15 +382,15 @@ namespace Discord.Rest
|
|||||||
public static Task<RestUserMessage> SendFileAsync(IMessageChannel channel, BaseDiscordClient client,
|
public static Task<RestUserMessage> SendFileAsync(IMessageChannel channel, BaseDiscordClient client,
|
||||||
FileAttachment attachment, string text, bool isTTS, Embed embed, AllowedMentions allowedMentions,
|
FileAttachment attachment, string text, bool isTTS, Embed embed, AllowedMentions allowedMentions,
|
||||||
MessageReference messageReference, MessageComponent components, ISticker[] stickers, RequestOptions options,
|
MessageReference messageReference, MessageComponent components, ISticker[] stickers, RequestOptions options,
|
||||||
Embed[] embeds, MessageFlags flags = MessageFlags.None)
|
Embed[] embeds, MessageFlags flags = MessageFlags.None, PollProperties poll = null)
|
||||||
=> SendFilesAsync(channel, client, new[] { attachment }, text, isTTS, embed, allowedMentions, messageReference,
|
=> SendFilesAsync(channel, client, new[] { attachment }, text, isTTS, embed, allowedMentions, messageReference,
|
||||||
components, stickers, options, embeds, flags);
|
components, stickers, options, embeds, flags, poll);
|
||||||
|
|
||||||
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/>, <see cref="MessageFlags.SuppressNotification"/> and <see cref="MessageFlags.None"/>.</exception>
|
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/>, <see cref="MessageFlags.SuppressNotification"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||||
public static async Task<RestUserMessage> SendFilesAsync(IMessageChannel channel, BaseDiscordClient client,
|
public static async Task<RestUserMessage> SendFilesAsync(IMessageChannel channel, BaseDiscordClient client,
|
||||||
IEnumerable<FileAttachment> attachments, string text, bool isTTS, Embed embed, AllowedMentions allowedMentions,
|
IEnumerable<FileAttachment> attachments, string text, bool isTTS, Embed embed, AllowedMentions allowedMentions,
|
||||||
MessageReference messageReference, MessageComponent components, ISticker[] stickers, RequestOptions options,
|
MessageReference messageReference, MessageComponent components, ISticker[] stickers, RequestOptions options,
|
||||||
Embed[] embeds, MessageFlags flags)
|
Embed[] embeds, MessageFlags flags, PollProperties poll = null)
|
||||||
{
|
{
|
||||||
embeds ??= Array.Empty<Embed>();
|
embeds ??= Array.Empty<Embed>();
|
||||||
if (embed != null)
|
if (embed != null)
|
||||||
@@ -396,7 +400,8 @@ namespace Discord.Rest
|
|||||||
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, DiscordConfig.MaxEmbedsPerMessage, nameof(embeds), $"A max of {DiscordConfig.MaxEmbedsPerMessage} Embeds are allowed.");
|
Preconditions.AtMost(embeds.Length, DiscordConfig.MaxEmbedsPerMessage, nameof(embeds), $"A max of {DiscordConfig.MaxEmbedsPerMessage} Embeds are allowed.");
|
||||||
|
|
||||||
Preconditions.MessageAtLeastOneOf(text, components, embeds, stickers, attachments);
|
Preconditions.MessageAtLeastOneOf(text, components, embeds, stickers, attachments, poll);
|
||||||
|
Preconditions.ValidatePoll(poll);
|
||||||
|
|
||||||
foreach (var attachment in attachments)
|
foreach (var attachment in attachments)
|
||||||
{
|
{
|
||||||
@@ -446,7 +451,8 @@ namespace Discord.Rest
|
|||||||
MessageReference = messageReference?.ToModel() ?? Optional<API.MessageReference>.Unspecified,
|
MessageReference = messageReference?.ToModel() ?? Optional<API.MessageReference>.Unspecified,
|
||||||
MessageComponent = components?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ?? Optional<API.ActionRowComponent[]>.Unspecified,
|
MessageComponent = components?.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,
|
Stickers = stickers?.Any() ?? false ? stickers.Select(x => x.Id).ToArray() : Optional<ulong[]>.Unspecified,
|
||||||
Flags = flags
|
Flags = flags,
|
||||||
|
Poll = poll?.ToModel() ?? Optional<CreatePollParams>.Unspecified
|
||||||
};
|
};
|
||||||
|
|
||||||
var model = await client.ApiClient.UploadFileAsync(channel.Id, args, options).ConfigureAwait(false);
|
var model = await client.ApiClient.UploadFileAsync(channel.Id, args, options).ConfigureAwait(false);
|
||||||
|
|||||||
@@ -9,20 +9,20 @@ namespace Discord.Rest
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IRestMessageChannel : IMessageChannel
|
public interface IRestMessageChannel : IMessageChannel
|
||||||
{
|
{
|
||||||
/// <inheritdoc cref="IMessageChannel.SendMessageAsync(string, bool, Embed, RequestOptions, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[], MessageFlags)"/>
|
/// <inheritdoc cref="IMessageChannel.SendMessageAsync(string, bool, Embed, RequestOptions, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[], MessageFlags, PollProperties)"/>
|
||||||
new Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null, MessageFlags flags = MessageFlags.None);
|
new Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null, MessageFlags flags = MessageFlags.None, PollProperties poll = null);
|
||||||
|
|
||||||
/// <inheritdoc cref="IMessageChannel.SendFileAsync(string, string, bool, Embed, RequestOptions, bool, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[], MessageFlags)"/>
|
/// <inheritdoc cref="IMessageChannel.SendFileAsync(string, string, bool, Embed, RequestOptions, bool, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[], MessageFlags, PollProperties)"/>
|
||||||
new Task<RestUserMessage> SendFileAsync(string filePath, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null, MessageFlags flags = MessageFlags.None);
|
new Task<RestUserMessage> SendFileAsync(string filePath, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null, MessageFlags flags = MessageFlags.None, PollProperties poll = null);
|
||||||
|
|
||||||
/// <inheritdoc cref="IMessageChannel.SendFileAsync(Stream, string, string, bool, Embed, RequestOptions, bool, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[], MessageFlags)"/>
|
/// <inheritdoc cref="IMessageChannel.SendFileAsync(Stream, string, string, bool, Embed, RequestOptions, bool, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[], MessageFlags, PollProperties)"/>
|
||||||
new Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null, MessageFlags flags = MessageFlags.None);
|
new Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null, MessageFlags flags = MessageFlags.None, PollProperties poll = null);
|
||||||
|
|
||||||
/// <inheritdoc cref="IMessageChannel.SendFileAsync(FileAttachment, string, bool, Embed, RequestOptions, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[], MessageFlags)"/>
|
/// <inheritdoc cref="IMessageChannel.SendFileAsync(FileAttachment, string, bool, Embed, RequestOptions, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[], MessageFlags, PollProperties)"/>
|
||||||
new Task<RestUserMessage> SendFileAsync(FileAttachment attachment, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null, MessageFlags flags = MessageFlags.None);
|
new Task<RestUserMessage> SendFileAsync(FileAttachment attachment, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null, MessageFlags flags = MessageFlags.None, PollProperties poll = null);
|
||||||
|
|
||||||
/// <inheritdoc cref="IMessageChannel.SendFilesAsync(IEnumerable{FileAttachment}, string, bool, Embed, RequestOptions, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[], MessageFlags)"/>
|
/// <inheritdoc cref="IMessageChannel.SendFilesAsync(IEnumerable{FileAttachment}, string, bool, Embed, RequestOptions, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[], MessageFlags, PollProperties)"/>
|
||||||
new Task<RestUserMessage> SendFilesAsync(IEnumerable<FileAttachment> attachments, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null, MessageFlags flags = MessageFlags.None);
|
new Task<RestUserMessage> SendFilesAsync(IEnumerable<FileAttachment> attachments, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null, MessageFlags flags = MessageFlags.None, PollProperties poll = null);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a message from this message channel.
|
/// Gets a message from this message channel.
|
||||||
|
|||||||
@@ -100,9 +100,9 @@ namespace Discord.Rest
|
|||||||
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||||
public Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null,
|
public Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null,
|
||||||
RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null,
|
RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null,
|
||||||
MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
|
MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null, MessageFlags flags = MessageFlags.None, PollProperties poll = null)
|
||||||
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, allowedMentions, messageReference,
|
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, allowedMentions, messageReference,
|
||||||
components, stickers, options, embeds, flags);
|
components, stickers, options, embeds, flags, poll);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
/// <exception cref="ArgumentException">
|
/// <exception cref="ArgumentException">
|
||||||
@@ -133,35 +133,35 @@ namespace Discord.Rest
|
|||||||
public Task<RestUserMessage> SendFileAsync(string filePath, string text = null, bool isTTS = false, Embed embed = null,
|
public Task<RestUserMessage> SendFileAsync(string filePath, string text = null, bool isTTS = false, Embed embed = null,
|
||||||
RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null,
|
RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null,
|
||||||
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
||||||
Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
|
Embed[] embeds = null, MessageFlags flags = MessageFlags.None, PollProperties poll = null)
|
||||||
=> ChannelHelper.SendFileAsync(this, Discord, filePath, text, isTTS, embed, allowedMentions, messageReference,
|
=> ChannelHelper.SendFileAsync(this, Discord, filePath, text, isTTS, embed, allowedMentions, messageReference,
|
||||||
components, stickers, options, isSpoiler, embeds, flags);
|
components, stickers, options, isSpoiler, embeds, flags, poll);
|
||||||
/// <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 = null, bool isTTS = false,
|
public Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text = null, bool isTTS = false,
|
||||||
Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null,
|
Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null,
|
||||||
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
||||||
Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
|
Embed[] embeds = null, MessageFlags flags = MessageFlags.None, PollProperties poll = null)
|
||||||
=> ChannelHelper.SendFileAsync(this, Discord, stream, filename, text, isTTS, embed, allowedMentions,
|
=> ChannelHelper.SendFileAsync(this, Discord, stream, filename, text, isTTS, embed, allowedMentions,
|
||||||
messageReference, components, stickers, options, isSpoiler, embeds, flags);
|
messageReference, components, stickers, options, isSpoiler, embeds, flags, poll);
|
||||||
|
|
||||||
/// <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(FileAttachment attachment, string text = null, bool isTTS = false,
|
public Task<RestUserMessage> SendFileAsync(FileAttachment attachment, string text = null, bool isTTS = false,
|
||||||
Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null,
|
Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null,
|
||||||
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
||||||
Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
|
Embed[] embeds = null, MessageFlags flags = MessageFlags.None, PollProperties poll = null)
|
||||||
=> ChannelHelper.SendFileAsync(this, Discord, attachment, text, isTTS, embed, allowedMentions, messageReference,
|
=> ChannelHelper.SendFileAsync(this, Discord, attachment, text, isTTS, embed, allowedMentions, messageReference,
|
||||||
components, stickers, options, embeds, flags);
|
components, stickers, options, embeds, flags, poll);
|
||||||
|
|
||||||
/// <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> SendFilesAsync(IEnumerable<FileAttachment> attachments, string text = null, bool isTTS = false,
|
public Task<RestUserMessage> SendFilesAsync(IEnumerable<FileAttachment> attachments, string text = null, bool isTTS = false,
|
||||||
Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null,
|
Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null,
|
||||||
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
||||||
Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
|
Embed[] embeds = null, MessageFlags flags = MessageFlags.None, PollProperties poll = null)
|
||||||
=> ChannelHelper.SendFilesAsync(this, Discord, attachments, text, isTTS, embed, allowedMentions, messageReference,
|
=> ChannelHelper.SendFilesAsync(this, Discord, attachments, text, isTTS, embed, allowedMentions, messageReference,
|
||||||
components, stickers, options, embeds, flags);
|
components, stickers, options, embeds, flags, poll);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public Task DeleteMessageAsync(ulong messageId, RequestOptions options = null)
|
public Task DeleteMessageAsync(ulong messageId, RequestOptions options = null)
|
||||||
@@ -245,35 +245,35 @@ namespace Discord.Rest
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(string filePath, string text, bool isTTS, Embed embed,
|
async Task<IUserMessage> IMessageChannel.SendFileAsync(string filePath, string text, bool isTTS, Embed embed,
|
||||||
RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference,
|
RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference,
|
||||||
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags, PollProperties poll)
|
||||||
=> await SendFileAsync(filePath, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference,
|
=> await SendFileAsync(filePath, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference,
|
||||||
components, stickers, embeds, flags).ConfigureAwait(false);
|
components, stickers, embeds, flags, poll).ConfigureAwait(false);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS,
|
async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS,
|
||||||
Embed embed, RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference,
|
Embed embed, RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference,
|
||||||
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags, PollProperties poll)
|
||||||
=> await SendFileAsync(stream, filename, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference,
|
=> await SendFileAsync(stream, filename, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference,
|
||||||
components, stickers, embeds, flags).ConfigureAwait(false);
|
components, stickers, embeds, flags, poll).ConfigureAwait(false);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(FileAttachment attachment, string text, bool isTTS,
|
async Task<IUserMessage> IMessageChannel.SendFileAsync(FileAttachment attachment, string text, bool isTTS,
|
||||||
Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference,
|
Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference,
|
||||||
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags, PollProperties poll)
|
||||||
=> await SendFileAsync(attachment, text, isTTS, embed, options, allowedMentions, messageReference, components,
|
=> await SendFileAsync(attachment, text, isTTS, embed, options, allowedMentions, messageReference, components,
|
||||||
stickers, embeds, flags).ConfigureAwait(false);
|
stickers, embeds, flags, poll).ConfigureAwait(false);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
async Task<IUserMessage> IMessageChannel.SendFilesAsync(IEnumerable<FileAttachment> attachments, string text,
|
async Task<IUserMessage> IMessageChannel.SendFilesAsync(IEnumerable<FileAttachment> attachments, string text,
|
||||||
bool isTTS, Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference,
|
bool isTTS, Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference,
|
||||||
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags, PollProperties poll)
|
||||||
=> await SendFilesAsync(attachments, text, isTTS, embed, options, allowedMentions, messageReference, components, stickers, embeds, flags).ConfigureAwait(false);
|
=> await SendFilesAsync(attachments, text, isTTS, embed, options, allowedMentions, messageReference, components, stickers, embeds, flags, poll).ConfigureAwait(false);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options,
|
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options,
|
||||||
AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent components,
|
AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent components,
|
||||||
ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
ISticker[] stickers, Embed[] embeds, MessageFlags flags, PollProperties poll)
|
||||||
=> await SendMessageAsync(text, isTTS, embed, options, allowedMentions, messageReference, components, stickers, embeds, flags).ConfigureAwait(false);
|
=> await SendMessageAsync(text, isTTS, embed, options, allowedMentions, messageReference, components, stickers, embeds, flags, poll).ConfigureAwait(false);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@@ -107,9 +107,9 @@ namespace Discord.Rest
|
|||||||
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||||
public Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null,
|
public Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null,
|
||||||
RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null,
|
RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null,
|
||||||
MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
|
MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null, MessageFlags flags = MessageFlags.None, PollProperties poll = null)
|
||||||
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, allowedMentions, messageReference,
|
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, allowedMentions, messageReference,
|
||||||
components, stickers, options, embeds, flags);
|
components, stickers, options, embeds, flags, poll);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
/// <exception cref="ArgumentException">
|
/// <exception cref="ArgumentException">
|
||||||
@@ -140,36 +140,36 @@ namespace Discord.Rest
|
|||||||
public Task<RestUserMessage> SendFileAsync(string filePath, string text = null, bool isTTS = false, Embed embed = null,
|
public Task<RestUserMessage> SendFileAsync(string filePath, string text = null, bool isTTS = false, Embed embed = null,
|
||||||
RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null,
|
RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null,
|
||||||
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
||||||
Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
|
Embed[] embeds = null, MessageFlags flags = MessageFlags.None, PollProperties poll = null)
|
||||||
=> ChannelHelper.SendFileAsync(this, Discord, filePath, text, isTTS, embed, allowedMentions, messageReference,
|
=> ChannelHelper.SendFileAsync(this, Discord, filePath, text, isTTS, embed, allowedMentions, messageReference,
|
||||||
components, stickers, options, isSpoiler, embeds, flags);
|
components, stickers, options, isSpoiler, embeds, flags, poll);
|
||||||
/// <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>
|
||||||
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||||
public Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text = null, bool isTTS = false,
|
public Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text = null, bool isTTS = false,
|
||||||
Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null,
|
Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null,
|
||||||
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
||||||
Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
|
Embed[] embeds = null, MessageFlags flags = MessageFlags.None, PollProperties poll = null)
|
||||||
=> ChannelHelper.SendFileAsync(this, Discord, stream, filename, text, isTTS, embed, allowedMentions,
|
=> ChannelHelper.SendFileAsync(this, Discord, stream, filename, text, isTTS, embed, allowedMentions,
|
||||||
messageReference, components, stickers, options, isSpoiler, embeds, flags);
|
messageReference, components, stickers, options, isSpoiler, embeds, flags, poll);
|
||||||
/// <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>
|
||||||
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||||
public Task<RestUserMessage> SendFileAsync(FileAttachment attachment, string text = null, bool isTTS = false,
|
public Task<RestUserMessage> SendFileAsync(FileAttachment attachment, string text = null, bool isTTS = false,
|
||||||
Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null,
|
Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null,
|
||||||
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
||||||
Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
|
Embed[] embeds = null, MessageFlags flags = MessageFlags.None, PollProperties poll = null)
|
||||||
=> ChannelHelper.SendFileAsync(this, Discord, attachment, text, isTTS, embed, allowedMentions, messageReference,
|
=> ChannelHelper.SendFileAsync(this, Discord, attachment, text, isTTS, embed, allowedMentions, messageReference,
|
||||||
components, stickers, options, embeds, flags);
|
components, stickers, options, embeds, flags, poll);
|
||||||
/// <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>
|
||||||
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||||
public Task<RestUserMessage> SendFilesAsync(IEnumerable<FileAttachment> attachments, string text = null, bool isTTS = false,
|
public Task<RestUserMessage> SendFilesAsync(IEnumerable<FileAttachment> attachments, string text = null, bool isTTS = false,
|
||||||
Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null,
|
Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null,
|
||||||
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
||||||
Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
|
Embed[] embeds = null, MessageFlags flags = MessageFlags.None, PollProperties poll = null)
|
||||||
=> ChannelHelper.SendFilesAsync(this, Discord, attachments, text, isTTS, embed, allowedMentions,
|
=> ChannelHelper.SendFilesAsync(this, Discord, attachments, text, isTTS, embed, allowedMentions,
|
||||||
messageReference, components, stickers, options, embeds, flags);
|
messageReference, components, stickers, options, embeds, flags, poll);
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public Task TriggerTypingAsync(RequestOptions options = null)
|
public Task TriggerTypingAsync(RequestOptions options = null)
|
||||||
=> ChannelHelper.TriggerTypingAsync(this, Discord, options);
|
=> ChannelHelper.TriggerTypingAsync(this, Discord, options);
|
||||||
@@ -224,37 +224,37 @@ namespace Discord.Rest
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(string filePath, string text, bool isTTS, Embed embed,
|
async Task<IUserMessage> IMessageChannel.SendFileAsync(string filePath, string text, bool isTTS, Embed embed,
|
||||||
RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference,
|
RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference,
|
||||||
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags, PollProperties poll)
|
||||||
=> await SendFileAsync(filePath, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference,
|
=> await SendFileAsync(filePath, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference,
|
||||||
components, stickers, embeds, flags).ConfigureAwait(false);
|
components, stickers, embeds, flags, poll).ConfigureAwait(false);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS,
|
async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS,
|
||||||
Embed embed, RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference,
|
Embed embed, RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference,
|
||||||
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags, PollProperties poll)
|
||||||
=> await SendFileAsync(stream, filename, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference,
|
=> await SendFileAsync(stream, filename, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference,
|
||||||
components, stickers, embeds, flags).ConfigureAwait(false);
|
components, stickers, embeds, flags, poll).ConfigureAwait(false);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(FileAttachment attachment, string text, bool isTTS,
|
async Task<IUserMessage> IMessageChannel.SendFileAsync(FileAttachment attachment, string text, bool isTTS,
|
||||||
Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference,
|
Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference,
|
||||||
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags, PollProperties poll)
|
||||||
=> await SendFileAsync(attachment, text, isTTS, embed, options, allowedMentions, messageReference, components,
|
=> await SendFileAsync(attachment, text, isTTS, embed, options, allowedMentions, messageReference, components,
|
||||||
stickers, embeds, flags).ConfigureAwait(false);
|
stickers, embeds, flags, poll).ConfigureAwait(false);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
async Task<IUserMessage> IMessageChannel.SendFilesAsync(IEnumerable<FileAttachment> attachments, string text,
|
async Task<IUserMessage> IMessageChannel.SendFilesAsync(IEnumerable<FileAttachment> attachments, string text,
|
||||||
bool isTTS, Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference,
|
bool isTTS, Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference,
|
||||||
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags, PollProperties poll)
|
||||||
=> await SendFilesAsync(attachments, text, isTTS, embed, options, allowedMentions, messageReference, components,
|
=> await SendFilesAsync(attachments, text, isTTS, embed, options, allowedMentions, messageReference, components,
|
||||||
stickers, embeds, flags).ConfigureAwait(false);
|
stickers, embeds, flags, poll).ConfigureAwait(false);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options,
|
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options,
|
||||||
AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent components,
|
AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent components,
|
||||||
ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
ISticker[] stickers, Embed[] embeds, MessageFlags flags, PollProperties poll)
|
||||||
=> await SendMessageAsync(text, isTTS, embed, options, allowedMentions, messageReference, components,
|
=> await SendMessageAsync(text, isTTS, embed, options, allowedMentions, messageReference, components,
|
||||||
stickers, embeds, flags).ConfigureAwait(false);
|
stickers, embeds, flags, poll).ConfigureAwait(false);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@@ -117,9 +117,9 @@ namespace Discord.Rest
|
|||||||
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/>, <see cref="MessageFlags.SuppressNotification"/> and <see cref="MessageFlags.None"/>.</exception>
|
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/>, <see cref="MessageFlags.SuppressNotification"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||||
public virtual Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null,
|
public virtual Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null,
|
||||||
RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null,
|
RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null,
|
||||||
MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
|
MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null, MessageFlags flags = MessageFlags.None, PollProperties poll = null)
|
||||||
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, allowedMentions, messageReference,
|
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, allowedMentions, messageReference,
|
||||||
components, stickers, options, embeds, flags);
|
components, stickers, options, embeds, flags, poll);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
/// <exception cref="ArgumentException">
|
/// <exception cref="ArgumentException">
|
||||||
@@ -150,9 +150,9 @@ namespace Discord.Rest
|
|||||||
public virtual Task<RestUserMessage> SendFileAsync(string filePath, string text = null, bool isTTS = false, Embed embed = null,
|
public virtual Task<RestUserMessage> SendFileAsync(string filePath, string text = null, bool isTTS = false, Embed embed = null,
|
||||||
RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null,
|
RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null,
|
||||||
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
||||||
Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
|
Embed[] embeds = null, MessageFlags flags = MessageFlags.None, PollProperties poll = null)
|
||||||
=> ChannelHelper.SendFileAsync(this, Discord, filePath, text, isTTS, embed, allowedMentions, messageReference,
|
=> ChannelHelper.SendFileAsync(this, Discord, filePath, text, isTTS, embed, allowedMentions, messageReference,
|
||||||
components, stickers, options, isSpoiler, embeds, flags);
|
components, stickers, options, isSpoiler, embeds, flags, poll);
|
||||||
|
|
||||||
/// <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>
|
||||||
@@ -160,9 +160,9 @@ namespace Discord.Rest
|
|||||||
public virtual Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text = null, bool isTTS = false,
|
public virtual Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text = null, bool isTTS = false,
|
||||||
Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null,
|
Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null,
|
||||||
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
||||||
Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
|
Embed[] embeds = null, MessageFlags flags = MessageFlags.None, PollProperties poll = null)
|
||||||
=> ChannelHelper.SendFileAsync(this, Discord, stream, filename, text, isTTS, embed, allowedMentions, messageReference,
|
=> ChannelHelper.SendFileAsync(this, Discord, stream, filename, text, isTTS, embed, allowedMentions, messageReference,
|
||||||
components, stickers, options, isSpoiler, embeds, flags);
|
components, stickers, options, isSpoiler, embeds, flags, poll);
|
||||||
|
|
||||||
/// <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>
|
||||||
@@ -170,9 +170,9 @@ namespace Discord.Rest
|
|||||||
public virtual Task<RestUserMessage> SendFileAsync(FileAttachment attachment, string text = null, bool isTTS = false,
|
public virtual Task<RestUserMessage> SendFileAsync(FileAttachment attachment, string text = null, bool isTTS = false,
|
||||||
Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null,
|
Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null,
|
||||||
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
||||||
Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
|
Embed[] embeds = null, MessageFlags flags = MessageFlags.None, PollProperties poll = null)
|
||||||
=> ChannelHelper.SendFileAsync(this, Discord, attachment, text, isTTS, embed, allowedMentions, messageReference,
|
=> ChannelHelper.SendFileAsync(this, Discord, attachment, text, isTTS, embed, allowedMentions, messageReference,
|
||||||
components, stickers, options, embeds, flags);
|
components, stickers, options, embeds, flags, poll);
|
||||||
|
|
||||||
/// <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>
|
||||||
@@ -180,8 +180,8 @@ namespace Discord.Rest
|
|||||||
public virtual Task<RestUserMessage> SendFilesAsync(IEnumerable<FileAttachment> attachments, string text = null, bool isTTS = false,
|
public virtual Task<RestUserMessage> SendFilesAsync(IEnumerable<FileAttachment> attachments, string text = null, bool isTTS = false,
|
||||||
Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null,
|
Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null,
|
||||||
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
||||||
Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
|
Embed[] embeds = null, MessageFlags flags = MessageFlags.None, PollProperties poll = null)
|
||||||
=> ChannelHelper.SendFilesAsync(this, Discord, attachments, text, isTTS, embed, allowedMentions, messageReference, components, stickers, options, embeds, flags);
|
=> ChannelHelper.SendFilesAsync(this, Discord, attachments, text, isTTS, embed, allowedMentions, messageReference, components, stickers, options, embeds, flags, poll);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public virtual Task DeleteMessageAsync(ulong messageId, RequestOptions options = null)
|
public virtual Task DeleteMessageAsync(ulong messageId, RequestOptions options = null)
|
||||||
@@ -376,35 +376,35 @@ namespace Discord.Rest
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(string filePath, string text, bool isTTS, Embed embed,
|
async Task<IUserMessage> IMessageChannel.SendFileAsync(string filePath, string text, bool isTTS, Embed embed,
|
||||||
RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference,
|
RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference,
|
||||||
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags, PollProperties poll)
|
||||||
=> await SendFileAsync(filePath, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference,
|
=> await SendFileAsync(filePath, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference,
|
||||||
components, stickers, embeds, flags).ConfigureAwait(false);
|
components, stickers, embeds, flags, poll).ConfigureAwait(false);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS,
|
async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS,
|
||||||
Embed embed, RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference,
|
Embed embed, RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference,
|
||||||
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags, PollProperties poll)
|
||||||
=> await SendFileAsync(stream, filename, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference,
|
=> await SendFileAsync(stream, filename, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference,
|
||||||
components, stickers, embeds, flags).ConfigureAwait(false);
|
components, stickers, embeds, flags, poll).ConfigureAwait(false);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(FileAttachment attachment, string text, bool isTTS,
|
async Task<IUserMessage> IMessageChannel.SendFileAsync(FileAttachment attachment, string text, bool isTTS,
|
||||||
Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference,
|
Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference,
|
||||||
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags, PollProperties poll)
|
||||||
=> await SendFileAsync(attachment, text, isTTS, embed, options, allowedMentions, messageReference, components,
|
=> await SendFileAsync(attachment, text, isTTS, embed, options, allowedMentions, messageReference, components,
|
||||||
stickers, embeds, flags).ConfigureAwait(false);
|
stickers, embeds, flags, poll).ConfigureAwait(false);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
async Task<IUserMessage> IMessageChannel.SendFilesAsync(IEnumerable<FileAttachment> attachments, string text,
|
async Task<IUserMessage> IMessageChannel.SendFilesAsync(IEnumerable<FileAttachment> attachments, string text,
|
||||||
bool isTTS, Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference,
|
bool isTTS, Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference,
|
||||||
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags, PollProperties poll)
|
||||||
=> await SendFilesAsync(attachments, text, isTTS, embed, options, allowedMentions, messageReference, components, stickers, embeds, flags).ConfigureAwait(false);
|
=> await SendFilesAsync(attachments, text, isTTS, embed, options, allowedMentions, messageReference, components, stickers, embeds, flags, poll).ConfigureAwait(false);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options,
|
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options,
|
||||||
AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent components,
|
AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent components,
|
||||||
ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
ISticker[] stickers, Embed[] embeds, MessageFlags flags, PollProperties poll)
|
||||||
=> await SendMessageAsync(text, isTTS, embed, options, allowedMentions, messageReference, components, stickers, embeds, flags).ConfigureAwait(false);
|
=> await SendMessageAsync(text, isTTS, embed, options, allowedMentions, messageReference, components, stickers, embeds, flags, poll).ConfigureAwait(false);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region IGuildChannel
|
#region IGuildChannel
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using Discord.API.Rest;
|
||||||
using Discord.Net.Rest;
|
using Discord.Net.Rest;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -65,6 +66,7 @@ namespace Discord.Rest
|
|||||||
/// <param name="options">The request options for this response.</param>
|
/// <param name="options">The request options for this response.</param>
|
||||||
/// <param name="components">A <see cref="MessageComponent"/> to be sent with this response.</param>
|
/// <param name="components">A <see cref="MessageComponent"/> to be sent with this response.</param>
|
||||||
/// <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
|
/// <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
|
||||||
|
/// <param name="poll">A poll to send with the message.</param>
|
||||||
/// <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>
|
||||||
/// <exception cref="InvalidOperationException">The parameters provided were invalid or the token was invalid.</exception>
|
/// <exception cref="InvalidOperationException">The parameters provided were invalid or the token was invalid.</exception>
|
||||||
/// <returns>
|
/// <returns>
|
||||||
@@ -78,7 +80,8 @@ namespace Discord.Rest
|
|||||||
AllowedMentions allowedMentions = null,
|
AllowedMentions allowedMentions = null,
|
||||||
MessageComponent components = null,
|
MessageComponent components = null,
|
||||||
Embed embed = null,
|
Embed embed = null,
|
||||||
RequestOptions options = null)
|
RequestOptions options = null,
|
||||||
|
PollProperties poll = null)
|
||||||
{
|
{
|
||||||
if (!IsValidToken)
|
if (!IsValidToken)
|
||||||
throw new InvalidOperationException("Interaction token is no longer valid");
|
throw new InvalidOperationException("Interaction token is no longer valid");
|
||||||
@@ -109,6 +112,7 @@ namespace Discord.Rest
|
|||||||
throw new ArgumentException("The Roles flag is mutually exclusive with the list of Role Ids.", nameof(allowedMentions));
|
throw new ArgumentException("The Roles flag is mutually exclusive with the list of Role Ids.", nameof(allowedMentions));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Preconditions.ValidatePoll(poll);
|
||||||
|
|
||||||
var response = new API.InteractionResponse
|
var response = new API.InteractionResponse
|
||||||
{
|
{
|
||||||
@@ -120,7 +124,8 @@ namespace Discord.Rest
|
|||||||
Embeds = embeds.Select(x => x.ToModel()).ToArray(),
|
Embeds = embeds.Select(x => x.ToModel()).ToArray(),
|
||||||
TTS = isTTS,
|
TTS = isTTS,
|
||||||
Components = components?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ?? Optional<API.ActionRowComponent[]>.Unspecified,
|
Components = components?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ?? Optional<API.ActionRowComponent[]>.Unspecified,
|
||||||
Flags = ephemeral ? MessageFlags.Ephemeral : Optional<MessageFlags>.Unspecified
|
Flags = ephemeral ? MessageFlags.Ephemeral : Optional<MessageFlags>.Unspecified,
|
||||||
|
Poll = poll?.ToModel() ?? Optional<CreatePollParams>.Unspecified
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -146,7 +151,8 @@ namespace Discord.Rest
|
|||||||
AllowedMentions allowedMentions = null,
|
AllowedMentions allowedMentions = null,
|
||||||
MessageComponent components = null,
|
MessageComponent components = null,
|
||||||
Embed embed = null,
|
Embed embed = null,
|
||||||
RequestOptions options = null)
|
RequestOptions options = null,
|
||||||
|
PollProperties poll = null)
|
||||||
{
|
{
|
||||||
if (!IsValidToken)
|
if (!IsValidToken)
|
||||||
throw new InvalidOperationException("Interaction token is no longer valid");
|
throw new InvalidOperationException("Interaction token is no longer valid");
|
||||||
@@ -158,6 +164,7 @@ namespace Discord.Rest
|
|||||||
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, 10, nameof(embeds), "A max of 10 embeds are allowed.");
|
Preconditions.AtMost(embeds.Length, 10, nameof(embeds), "A max of 10 embeds are allowed.");
|
||||||
|
Preconditions.ValidatePoll(poll);
|
||||||
|
|
||||||
var args = new API.Rest.CreateWebhookMessageParams
|
var args = new API.Rest.CreateWebhookMessageParams
|
||||||
{
|
{
|
||||||
@@ -165,7 +172,8 @@ namespace Discord.Rest
|
|||||||
AllowedMentions = allowedMentions?.ToModel() ?? Optional<API.AllowedMentions>.Unspecified,
|
AllowedMentions = allowedMentions?.ToModel() ?? Optional<API.AllowedMentions>.Unspecified,
|
||||||
IsTTS = isTTS,
|
IsTTS = isTTS,
|
||||||
Embeds = embeds.Select(x => x.ToModel()).ToArray(),
|
Embeds = embeds.Select(x => x.ToModel()).ToArray(),
|
||||||
Components = components?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ?? Optional<API.ActionRowComponent[]>.Unspecified
|
Components = components?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ?? Optional<API.ActionRowComponent[]>.Unspecified,
|
||||||
|
Poll = poll?.ToModel() ?? Optional<CreatePollParams>.Unspecified
|
||||||
};
|
};
|
||||||
|
|
||||||
if (ephemeral)
|
if (ephemeral)
|
||||||
@@ -185,7 +193,8 @@ namespace Discord.Rest
|
|||||||
AllowedMentions allowedMentions = null,
|
AllowedMentions allowedMentions = null,
|
||||||
MessageComponent components = null,
|
MessageComponent components = null,
|
||||||
Embed embed = null,
|
Embed embed = null,
|
||||||
RequestOptions options = null)
|
RequestOptions options = null,
|
||||||
|
PollProperties poll = null)
|
||||||
{
|
{
|
||||||
if (!IsValidToken)
|
if (!IsValidToken)
|
||||||
throw new InvalidOperationException("Interaction token is no longer valid");
|
throw new InvalidOperationException("Interaction token is no longer valid");
|
||||||
@@ -194,7 +203,7 @@ namespace Discord.Rest
|
|||||||
Preconditions.NotNullOrEmpty(fileName, nameof(fileName), "File Name must not be empty or null");
|
Preconditions.NotNullOrEmpty(fileName, nameof(fileName), "File Name must not be empty or null");
|
||||||
|
|
||||||
using (var file = new FileAttachment(fileStream, fileName))
|
using (var file = new FileAttachment(fileStream, fileName))
|
||||||
return await FollowupWithFileAsync(file, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options).ConfigureAwait(false);
|
return await FollowupWithFileAsync(file, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options, poll).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
@@ -208,7 +217,8 @@ namespace Discord.Rest
|
|||||||
AllowedMentions allowedMentions = null,
|
AllowedMentions allowedMentions = null,
|
||||||
MessageComponent components = null,
|
MessageComponent components = null,
|
||||||
Embed embed = null,
|
Embed embed = null,
|
||||||
RequestOptions options = null)
|
RequestOptions options = null,
|
||||||
|
PollProperties poll = null)
|
||||||
{
|
{
|
||||||
Preconditions.NotNullOrEmpty(filePath, nameof(filePath), "Path must exist");
|
Preconditions.NotNullOrEmpty(filePath, nameof(filePath), "Path must exist");
|
||||||
|
|
||||||
@@ -216,7 +226,7 @@ namespace Discord.Rest
|
|||||||
Preconditions.NotNullOrEmpty(fileName, nameof(fileName), "File Name must not be empty or null");
|
Preconditions.NotNullOrEmpty(fileName, nameof(fileName), "File Name must not be empty or null");
|
||||||
|
|
||||||
using (var file = new FileAttachment(File.OpenRead(filePath), fileName))
|
using (var file = new FileAttachment(File.OpenRead(filePath), fileName))
|
||||||
return await FollowupWithFileAsync(file, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options).ConfigureAwait(false);
|
return await FollowupWithFileAsync(file, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options, poll).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
@@ -229,9 +239,10 @@ namespace Discord.Rest
|
|||||||
AllowedMentions allowedMentions = null,
|
AllowedMentions allowedMentions = null,
|
||||||
MessageComponent components = null,
|
MessageComponent components = null,
|
||||||
Embed embed = null,
|
Embed embed = null,
|
||||||
RequestOptions options = null)
|
RequestOptions options = null,
|
||||||
|
PollProperties poll = null)
|
||||||
{
|
{
|
||||||
return FollowupWithFilesAsync(new FileAttachment[] { attachment }, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options);
|
return FollowupWithFilesAsync(new FileAttachment[] { attachment }, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options, poll);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
@@ -244,7 +255,8 @@ namespace Discord.Rest
|
|||||||
AllowedMentions allowedMentions = null,
|
AllowedMentions allowedMentions = null,
|
||||||
MessageComponent components = null,
|
MessageComponent components = null,
|
||||||
Embed embed = null,
|
Embed embed = null,
|
||||||
RequestOptions options = null)
|
RequestOptions options = null,
|
||||||
|
PollProperties poll = null)
|
||||||
{
|
{
|
||||||
if (!IsValidToken)
|
if (!IsValidToken)
|
||||||
throw new InvalidOperationException("Interaction token is no longer valid");
|
throw new InvalidOperationException("Interaction token is no longer valid");
|
||||||
@@ -256,6 +268,7 @@ namespace Discord.Rest
|
|||||||
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, 10, nameof(embeds), "A max of 10 embeds are allowed.");
|
Preconditions.AtMost(embeds.Length, 10, nameof(embeds), "A max of 10 embeds are allowed.");
|
||||||
|
Preconditions.ValidatePoll(poll);
|
||||||
|
|
||||||
foreach (var attachment in attachments)
|
foreach (var attachment in attachments)
|
||||||
{
|
{
|
||||||
@@ -283,7 +296,16 @@ namespace Discord.Rest
|
|||||||
if (ephemeral)
|
if (ephemeral)
|
||||||
flags |= MessageFlags.Ephemeral;
|
flags |= MessageFlags.Ephemeral;
|
||||||
|
|
||||||
var args = new API.Rest.UploadWebhookFileParams(attachments.ToArray()) { Flags = flags, Content = text, IsTTS = isTTS, Embeds = embeds.Any() ? embeds.Select(x => x.ToModel()).ToArray() : Optional<API.Embed[]>.Unspecified, AllowedMentions = allowedMentions?.ToModel() ?? Optional<API.AllowedMentions>.Unspecified, MessageComponents = components?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ?? Optional<API.ActionRowComponent[]>.Unspecified };
|
var args = new API.Rest.UploadWebhookFileParams(attachments.ToArray())
|
||||||
|
{
|
||||||
|
Flags = flags,
|
||||||
|
Content = text,
|
||||||
|
IsTTS = isTTS,
|
||||||
|
Embeds = embeds.Any() ? embeds.Select(x => x.ToModel()).ToArray() : Optional<API.Embed[]>.Unspecified,
|
||||||
|
AllowedMentions = allowedMentions?.ToModel() ?? Optional<API.AllowedMentions>.Unspecified,
|
||||||
|
MessageComponents = components?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ?? Optional<API.ActionRowComponent[]>.Unspecified,
|
||||||
|
Poll = poll?.ToModel() ?? Optional<CreatePollParams>.Unspecified
|
||||||
|
};
|
||||||
return InteractionHelper.SendFollowupAsync(Discord, args, Token, Channel, options);
|
return InteractionHelper.SendFollowupAsync(Discord, args, Token, Channel, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using Discord.API.Rest;
|
||||||
using Discord.Net.Rest;
|
using Discord.Net.Rest;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -75,7 +76,8 @@ namespace Discord.Rest
|
|||||||
AllowedMentions allowedMentions = null,
|
AllowedMentions allowedMentions = null,
|
||||||
MessageComponent components = null,
|
MessageComponent components = null,
|
||||||
Embed embed = null,
|
Embed embed = null,
|
||||||
RequestOptions options = null)
|
RequestOptions options = null,
|
||||||
|
PollProperties poll = null)
|
||||||
{
|
{
|
||||||
if (!IsValidToken)
|
if (!IsValidToken)
|
||||||
throw new InvalidOperationException("Interaction token is no longer valid");
|
throw new InvalidOperationException("Interaction token is no longer valid");
|
||||||
@@ -90,6 +92,7 @@ namespace Discord.Rest
|
|||||||
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, 10, nameof(embeds), "A max of 10 embeds are allowed.");
|
Preconditions.AtMost(embeds.Length, 10, nameof(embeds), "A max of 10 embeds are allowed.");
|
||||||
|
Preconditions.ValidatePoll(poll);
|
||||||
|
|
||||||
// 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)
|
||||||
@@ -116,7 +119,8 @@ namespace Discord.Rest
|
|||||||
AllowedMentions = allowedMentions?.ToModel(),
|
AllowedMentions = allowedMentions?.ToModel(),
|
||||||
Embeds = embeds.Select(x => x.ToModel()).ToArray(),
|
Embeds = embeds.Select(x => x.ToModel()).ToArray(),
|
||||||
TTS = isTTS,
|
TTS = isTTS,
|
||||||
Components = components?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ?? Optional<API.ActionRowComponent[]>.Unspecified
|
Components = components?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ?? Optional<API.ActionRowComponent[]>.Unspecified,
|
||||||
|
Poll = poll?.ToModel() ?? Optional<CreatePollParams>.Unspecified
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -251,7 +255,8 @@ namespace Discord.Rest
|
|||||||
AllowedMentions allowedMentions = null,
|
AllowedMentions allowedMentions = null,
|
||||||
MessageComponent components = null,
|
MessageComponent components = null,
|
||||||
Embed embed = null,
|
Embed embed = null,
|
||||||
RequestOptions options = null)
|
RequestOptions options = null,
|
||||||
|
PollProperties poll = null)
|
||||||
{
|
{
|
||||||
if (!IsValidToken)
|
if (!IsValidToken)
|
||||||
throw new InvalidOperationException("Interaction token is no longer valid");
|
throw new InvalidOperationException("Interaction token is no longer valid");
|
||||||
@@ -263,6 +268,7 @@ namespace Discord.Rest
|
|||||||
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, 10, nameof(embeds), "A max of 10 embeds are allowed.");
|
Preconditions.AtMost(embeds.Length, 10, nameof(embeds), "A max of 10 embeds are allowed.");
|
||||||
|
Preconditions.ValidatePoll(poll);
|
||||||
|
|
||||||
var args = new API.Rest.CreateWebhookMessageParams
|
var args = new API.Rest.CreateWebhookMessageParams
|
||||||
{
|
{
|
||||||
@@ -270,7 +276,9 @@ namespace Discord.Rest
|
|||||||
AllowedMentions = allowedMentions?.ToModel() ?? Optional<API.AllowedMentions>.Unspecified,
|
AllowedMentions = allowedMentions?.ToModel() ?? Optional<API.AllowedMentions>.Unspecified,
|
||||||
IsTTS = isTTS,
|
IsTTS = isTTS,
|
||||||
Embeds = embeds.Select(x => x.ToModel()).ToArray(),
|
Embeds = embeds.Select(x => x.ToModel()).ToArray(),
|
||||||
Components = components?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ?? Optional<API.ActionRowComponent[]>.Unspecified
|
Components = components?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ?? Optional<API.ActionRowComponent[]>.Unspecified,
|
||||||
|
Flags = ephemeral ? MessageFlags.Ephemeral : MessageFlags.None,
|
||||||
|
Poll = poll.ToModel() ?? Optional<CreatePollParams>.Unspecified
|
||||||
};
|
};
|
||||||
|
|
||||||
if (ephemeral)
|
if (ephemeral)
|
||||||
@@ -290,7 +298,8 @@ namespace Discord.Rest
|
|||||||
AllowedMentions allowedMentions = null,
|
AllowedMentions allowedMentions = null,
|
||||||
MessageComponent components = null,
|
MessageComponent components = null,
|
||||||
Embed embed = null,
|
Embed embed = null,
|
||||||
RequestOptions options = null)
|
RequestOptions options = null,
|
||||||
|
PollProperties poll = null)
|
||||||
{
|
{
|
||||||
if (!IsValidToken)
|
if (!IsValidToken)
|
||||||
throw new InvalidOperationException("Interaction token is no longer valid");
|
throw new InvalidOperationException("Interaction token is no longer valid");
|
||||||
@@ -299,7 +308,7 @@ namespace Discord.Rest
|
|||||||
Preconditions.NotNullOrEmpty(fileName, nameof(fileName), "File Name must not be empty or null");
|
Preconditions.NotNullOrEmpty(fileName, nameof(fileName), "File Name must not be empty or null");
|
||||||
|
|
||||||
using (var file = new FileAttachment(fileStream, fileName))
|
using (var file = new FileAttachment(fileStream, fileName))
|
||||||
return await FollowupWithFileAsync(file, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options).ConfigureAwait(false);
|
return await FollowupWithFileAsync(file, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options, poll).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
@@ -313,7 +322,8 @@ namespace Discord.Rest
|
|||||||
AllowedMentions allowedMentions = null,
|
AllowedMentions allowedMentions = null,
|
||||||
MessageComponent components = null,
|
MessageComponent components = null,
|
||||||
Embed embed = null,
|
Embed embed = null,
|
||||||
RequestOptions options = null)
|
RequestOptions options = null,
|
||||||
|
PollProperties poll = null)
|
||||||
{
|
{
|
||||||
Preconditions.NotNullOrEmpty(filePath, nameof(filePath), "Path must exist");
|
Preconditions.NotNullOrEmpty(filePath, nameof(filePath), "Path must exist");
|
||||||
|
|
||||||
@@ -321,7 +331,7 @@ namespace Discord.Rest
|
|||||||
Preconditions.NotNullOrEmpty(fileName, nameof(fileName), "File Name must not be empty or null");
|
Preconditions.NotNullOrEmpty(fileName, nameof(fileName), "File Name must not be empty or null");
|
||||||
|
|
||||||
using (var file = new FileAttachment(File.OpenRead(filePath), fileName))
|
using (var file = new FileAttachment(File.OpenRead(filePath), fileName))
|
||||||
return await FollowupWithFileAsync(file, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options).ConfigureAwait(false);
|
return await FollowupWithFileAsync(file, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options, poll).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
@@ -334,9 +344,10 @@ namespace Discord.Rest
|
|||||||
AllowedMentions allowedMentions = null,
|
AllowedMentions allowedMentions = null,
|
||||||
MessageComponent components = null,
|
MessageComponent components = null,
|
||||||
Embed embed = null,
|
Embed embed = null,
|
||||||
RequestOptions options = null)
|
RequestOptions options = null,
|
||||||
|
PollProperties poll = null)
|
||||||
{
|
{
|
||||||
return FollowupWithFilesAsync(new FileAttachment[] { attachment }, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options);
|
return FollowupWithFilesAsync(new FileAttachment[] { attachment }, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options, poll);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
@@ -349,7 +360,8 @@ namespace Discord.Rest
|
|||||||
AllowedMentions allowedMentions = null,
|
AllowedMentions allowedMentions = null,
|
||||||
MessageComponent components = null,
|
MessageComponent components = null,
|
||||||
Embed embed = null,
|
Embed embed = null,
|
||||||
RequestOptions options = null)
|
RequestOptions options = null,
|
||||||
|
PollProperties poll = null)
|
||||||
{
|
{
|
||||||
if (!IsValidToken)
|
if (!IsValidToken)
|
||||||
throw new InvalidOperationException("Interaction token is no longer valid");
|
throw new InvalidOperationException("Interaction token is no longer valid");
|
||||||
@@ -361,6 +373,7 @@ namespace Discord.Rest
|
|||||||
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, 10, nameof(embeds), "A max of 10 embeds are allowed.");
|
Preconditions.AtMost(embeds.Length, 10, nameof(embeds), "A max of 10 embeds are allowed.");
|
||||||
|
Preconditions.ValidatePoll(poll);
|
||||||
|
|
||||||
foreach (var attachment in attachments)
|
foreach (var attachment in attachments)
|
||||||
{
|
{
|
||||||
@@ -388,7 +401,16 @@ namespace Discord.Rest
|
|||||||
if (ephemeral)
|
if (ephemeral)
|
||||||
flags |= MessageFlags.Ephemeral;
|
flags |= MessageFlags.Ephemeral;
|
||||||
|
|
||||||
var args = new API.Rest.UploadWebhookFileParams(attachments.ToArray()) { Flags = flags, Content = text, IsTTS = isTTS, Embeds = embeds.Any() ? embeds.Select(x => x.ToModel()).ToArray() : Optional<API.Embed[]>.Unspecified, AllowedMentions = allowedMentions?.ToModel() ?? Optional<API.AllowedMentions>.Unspecified, MessageComponents = components?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ?? Optional<API.ActionRowComponent[]>.Unspecified };
|
var args = new API.Rest.UploadWebhookFileParams(attachments.ToArray())
|
||||||
|
{
|
||||||
|
Flags = flags,
|
||||||
|
Content = text,
|
||||||
|
IsTTS = isTTS,
|
||||||
|
Embeds = embeds.Any() ? embeds.Select(x => x.ToModel()).ToArray() : Optional<API.Embed[]>.Unspecified,
|
||||||
|
AllowedMentions = allowedMentions?.ToModel() ?? Optional<API.AllowedMentions>.Unspecified,
|
||||||
|
MessageComponents = components?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ?? Optional<API.ActionRowComponent[]>.Unspecified,
|
||||||
|
Poll = poll.ToModel() ?? Optional<CreatePollParams>.Unspecified
|
||||||
|
};
|
||||||
return InteractionHelper.SendFollowupAsync(Discord, args, Token, Channel, options);
|
return InteractionHelper.SendFollowupAsync(Discord, args, Token, Channel, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -136,7 +136,8 @@ namespace Discord.Rest
|
|||||||
AllowedMentions allowedMentions = null,
|
AllowedMentions allowedMentions = null,
|
||||||
MessageComponent component = null,
|
MessageComponent component = null,
|
||||||
Embed embed = null,
|
Embed embed = null,
|
||||||
RequestOptions options = null)
|
RequestOptions options = null,
|
||||||
|
PollProperties poll = null)
|
||||||
{
|
{
|
||||||
if (!IsValidToken)
|
if (!IsValidToken)
|
||||||
throw new InvalidOperationException("Interaction token is no longer valid");
|
throw new InvalidOperationException("Interaction token is no longer valid");
|
||||||
@@ -148,6 +149,7 @@ namespace Discord.Rest
|
|||||||
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, 10, nameof(embeds), "A max of 10 embeds are allowed.");
|
Preconditions.AtMost(embeds.Length, 10, nameof(embeds), "A max of 10 embeds are allowed.");
|
||||||
|
Preconditions.ValidatePoll(poll);
|
||||||
|
|
||||||
var args = new API.Rest.CreateWebhookMessageParams
|
var args = new API.Rest.CreateWebhookMessageParams
|
||||||
{
|
{
|
||||||
@@ -155,7 +157,8 @@ namespace Discord.Rest
|
|||||||
AllowedMentions = allowedMentions?.ToModel() ?? Optional<API.AllowedMentions>.Unspecified,
|
AllowedMentions = allowedMentions?.ToModel() ?? Optional<API.AllowedMentions>.Unspecified,
|
||||||
IsTTS = isTTS,
|
IsTTS = isTTS,
|
||||||
Embeds = embeds.Select(x => x.ToModel()).ToArray(),
|
Embeds = embeds.Select(x => x.ToModel()).ToArray(),
|
||||||
Components = component?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ?? Optional<API.ActionRowComponent[]>.Unspecified
|
Components = component?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ??Optional<API.ActionRowComponent[]>.Unspecified,
|
||||||
|
Poll = poll?.ToModel() ?? Optional<API.Rest.CreatePollParams>.Unspecified
|
||||||
};
|
};
|
||||||
|
|
||||||
if (ephemeral)
|
if (ephemeral)
|
||||||
@@ -190,7 +193,8 @@ namespace Discord.Rest
|
|||||||
AllowedMentions allowedMentions = null,
|
AllowedMentions allowedMentions = null,
|
||||||
MessageComponent component = null,
|
MessageComponent component = null,
|
||||||
Embed embed = null,
|
Embed embed = null,
|
||||||
RequestOptions options = null)
|
RequestOptions options = null,
|
||||||
|
PollProperties poll = null)
|
||||||
{
|
{
|
||||||
if (!IsValidToken)
|
if (!IsValidToken)
|
||||||
throw new InvalidOperationException("Interaction token is no longer valid");
|
throw new InvalidOperationException("Interaction token is no longer valid");
|
||||||
@@ -204,6 +208,7 @@ namespace Discord.Rest
|
|||||||
Preconditions.AtMost(embeds.Length, 10, nameof(embeds), "A max of 10 embeds are allowed.");
|
Preconditions.AtMost(embeds.Length, 10, nameof(embeds), "A max of 10 embeds are allowed.");
|
||||||
Preconditions.NotNull(fileStream, nameof(fileStream), "File Stream must have data");
|
Preconditions.NotNull(fileStream, nameof(fileStream), "File Stream must have data");
|
||||||
Preconditions.NotNullOrEmpty(fileName, nameof(fileName), "File Name must not be empty or null");
|
Preconditions.NotNullOrEmpty(fileName, nameof(fileName), "File Name must not be empty or null");
|
||||||
|
Preconditions.ValidatePoll(poll);
|
||||||
|
|
||||||
var args = new API.Rest.CreateWebhookMessageParams
|
var args = new API.Rest.CreateWebhookMessageParams
|
||||||
{
|
{
|
||||||
@@ -212,7 +217,8 @@ namespace Discord.Rest
|
|||||||
IsTTS = isTTS,
|
IsTTS = isTTS,
|
||||||
Embeds = embeds.Select(x => x.ToModel()).ToArray(),
|
Embeds = embeds.Select(x => x.ToModel()).ToArray(),
|
||||||
Components = component?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ?? Optional<API.ActionRowComponent[]>.Unspecified,
|
Components = component?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ?? Optional<API.ActionRowComponent[]>.Unspecified,
|
||||||
File = fileStream is not null ? new MultipartFile(fileStream, fileName) : Optional<MultipartFile>.Unspecified
|
File = fileStream is not null ? new MultipartFile(fileStream, fileName) : Optional<MultipartFile>.Unspecified,
|
||||||
|
Poll = poll?.ToModel() ?? Optional<API.Rest.CreatePollParams>.Unspecified,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (ephemeral)
|
if (ephemeral)
|
||||||
@@ -247,7 +253,8 @@ namespace Discord.Rest
|
|||||||
AllowedMentions allowedMentions = null,
|
AllowedMentions allowedMentions = null,
|
||||||
MessageComponent component = null,
|
MessageComponent component = null,
|
||||||
Embed embed = null,
|
Embed embed = null,
|
||||||
RequestOptions options = null)
|
RequestOptions options = null,
|
||||||
|
PollProperties poll = null)
|
||||||
{
|
{
|
||||||
if (!IsValidToken)
|
if (!IsValidToken)
|
||||||
throw new InvalidOperationException("Interaction token is no longer valid");
|
throw new InvalidOperationException("Interaction token is no longer valid");
|
||||||
@@ -260,6 +267,7 @@ namespace Discord.Rest
|
|||||||
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, 10, nameof(embeds), "A max of 10 embeds are allowed.");
|
Preconditions.AtMost(embeds.Length, 10, nameof(embeds), "A max of 10 embeds are allowed.");
|
||||||
Preconditions.NotNullOrEmpty(filePath, nameof(filePath), "Path must exist");
|
Preconditions.NotNullOrEmpty(filePath, nameof(filePath), "Path must exist");
|
||||||
|
Preconditions.ValidatePoll(poll);
|
||||||
|
|
||||||
fileName ??= Path.GetFileName(filePath);
|
fileName ??= Path.GetFileName(filePath);
|
||||||
Preconditions.NotNullOrEmpty(fileName, nameof(fileName), "File Name must not be empty or null");
|
Preconditions.NotNullOrEmpty(fileName, nameof(fileName), "File Name must not be empty or null");
|
||||||
@@ -272,7 +280,8 @@ namespace Discord.Rest
|
|||||||
IsTTS = isTTS,
|
IsTTS = isTTS,
|
||||||
Embeds = embeds.Select(x => x.ToModel()).ToArray(),
|
Embeds = embeds.Select(x => x.ToModel()).ToArray(),
|
||||||
Components = component?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ?? Optional<API.ActionRowComponent[]>.Unspecified,
|
Components = component?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ?? Optional<API.ActionRowComponent[]>.Unspecified,
|
||||||
File = fileStream != null ? new MultipartFile(fileStream, fileName) : Optional<MultipartFile>.Unspecified
|
File = fileStream != null ? new MultipartFile(fileStream, fileName) : Optional<MultipartFile>.Unspecified,
|
||||||
|
Poll = poll?.ToModel() ?? Optional<API.Rest.CreatePollParams>.Unspecified
|
||||||
};
|
};
|
||||||
|
|
||||||
if (ephemeral)
|
if (ephemeral)
|
||||||
@@ -305,7 +314,8 @@ namespace Discord.Rest
|
|||||||
AllowedMentions allowedMentions = null,
|
AllowedMentions allowedMentions = null,
|
||||||
MessageComponent component = null,
|
MessageComponent component = null,
|
||||||
Embed embed = null,
|
Embed embed = null,
|
||||||
RequestOptions options = null)
|
RequestOptions options = null,
|
||||||
|
PollProperties poll = null)
|
||||||
{
|
{
|
||||||
if (!IsValidToken)
|
if (!IsValidToken)
|
||||||
throw new InvalidOperationException("Interaction token is no longer valid");
|
throw new InvalidOperationException("Interaction token is no longer valid");
|
||||||
@@ -320,6 +330,7 @@ namespace Discord.Rest
|
|||||||
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, 10, nameof(embeds), "A max of 10 embeds are allowed.");
|
Preconditions.AtMost(embeds.Length, 10, nameof(embeds), "A max of 10 embeds are allowed.");
|
||||||
|
Preconditions.ValidatePoll(poll);
|
||||||
|
|
||||||
// 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)
|
||||||
@@ -347,7 +358,8 @@ namespace Discord.Rest
|
|||||||
Embeds = embeds.Select(x => x.ToModel()).ToArray(),
|
Embeds = embeds.Select(x => x.ToModel()).ToArray(),
|
||||||
TTS = isTTS,
|
TTS = isTTS,
|
||||||
Components = component?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ?? Optional<API.ActionRowComponent[]>.Unspecified,
|
Components = component?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ?? Optional<API.ActionRowComponent[]>.Unspecified,
|
||||||
Flags = ephemeral ? MessageFlags.Ephemeral : Optional<MessageFlags>.Unspecified
|
Flags = ephemeral ? MessageFlags.Ephemeral : Optional<MessageFlags>.Unspecified,
|
||||||
|
Poll = poll?.ToModel() ?? Optional<API.Rest.CreatePollParams>.Unspecified
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -377,7 +389,8 @@ namespace Discord.Rest
|
|||||||
AllowedMentions allowedMentions = null,
|
AllowedMentions allowedMentions = null,
|
||||||
MessageComponent components = null,
|
MessageComponent components = null,
|
||||||
Embed embed = null,
|
Embed embed = null,
|
||||||
RequestOptions options = null)
|
RequestOptions options = null,
|
||||||
|
PollProperties poll = null)
|
||||||
{
|
{
|
||||||
if (!IsValidToken)
|
if (!IsValidToken)
|
||||||
throw new InvalidOperationException("Interaction token is no longer valid");
|
throw new InvalidOperationException("Interaction token is no longer valid");
|
||||||
@@ -389,6 +402,7 @@ namespace Discord.Rest
|
|||||||
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, 10, nameof(embeds), "A max of 10 embeds are allowed.");
|
Preconditions.AtMost(embeds.Length, 10, nameof(embeds), "A max of 10 embeds are allowed.");
|
||||||
|
Preconditions.ValidatePoll(poll);
|
||||||
|
|
||||||
foreach (var attachment in attachments)
|
foreach (var attachment in attachments)
|
||||||
{
|
{
|
||||||
@@ -416,7 +430,16 @@ namespace Discord.Rest
|
|||||||
if (ephemeral)
|
if (ephemeral)
|
||||||
flags |= MessageFlags.Ephemeral;
|
flags |= MessageFlags.Ephemeral;
|
||||||
|
|
||||||
var args = new API.Rest.UploadWebhookFileParams(attachments.ToArray()) { Flags = flags, Content = text, IsTTS = isTTS, Embeds = embeds.Any() ? embeds.Select(x => x.ToModel()).ToArray() : Optional<API.Embed[]>.Unspecified, AllowedMentions = allowedMentions?.ToModel() ?? Optional<API.AllowedMentions>.Unspecified, MessageComponents = components?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ?? Optional<API.ActionRowComponent[]>.Unspecified };
|
var args = new API.Rest.UploadWebhookFileParams(attachments.ToArray())
|
||||||
|
{
|
||||||
|
Flags = flags,
|
||||||
|
Content = text,
|
||||||
|
IsTTS = isTTS,
|
||||||
|
Embeds = embeds.Any() ? embeds.Select(x => x.ToModel()).ToArray() : Optional<API.Embed[]>.Unspecified,
|
||||||
|
AllowedMentions = allowedMentions?.ToModel() ?? Optional<API.AllowedMentions>.Unspecified,
|
||||||
|
MessageComponents = components?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ?? Optional<API.ActionRowComponent[]>.Unspecified,
|
||||||
|
Poll = poll?.ToModel() ?? Optional<API.Rest.CreatePollParams>.Unspecified
|
||||||
|
};
|
||||||
return InteractionHelper.SendFollowupAsync(Discord, args, Token, Channel, options);
|
return InteractionHelper.SendFollowupAsync(Discord, args, Token, Channel, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -430,9 +453,10 @@ namespace Discord.Rest
|
|||||||
AllowedMentions allowedMentions = null,
|
AllowedMentions allowedMentions = null,
|
||||||
MessageComponent components = null,
|
MessageComponent components = null,
|
||||||
Embed embed = null,
|
Embed embed = null,
|
||||||
RequestOptions options = null)
|
RequestOptions options = null,
|
||||||
|
PollProperties poll = null)
|
||||||
{
|
{
|
||||||
return FollowupWithFilesAsync(new FileAttachment[] { attachment }, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options);
|
return FollowupWithFilesAsync(new FileAttachment[] { attachment }, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options, poll);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
|
|||||||
@@ -336,7 +336,8 @@ namespace Discord.Rest
|
|||||||
public abstract string RespondWithModal(Modal modal, RequestOptions options = null);
|
public abstract string RespondWithModal(Modal modal, RequestOptions options = null);
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public abstract string Respond(string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null);
|
public abstract string Respond(string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
||||||
|
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sends a followup message for this interaction.
|
/// Sends a followup message for this interaction.
|
||||||
@@ -349,12 +350,13 @@ namespace Discord.Rest
|
|||||||
/// <param name="components">A <see cref="MessageComponent"/> to be sent with this response.</param>
|
/// <param name="components">A <see cref="MessageComponent"/> to be sent with this response.</param>
|
||||||
/// <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
|
/// <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
|
||||||
/// <param name="options">The request options for this response.</param>
|
/// <param name="options">The request options for this response.</param>
|
||||||
|
/// <param name="poll">A poll to send with the message.</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>
|
||||||
public abstract Task<RestFollowupMessage> FollowupAsync(string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
public abstract Task<RestFollowupMessage> FollowupAsync(string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
||||||
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null);
|
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sends a followup message for this interaction.
|
/// Sends a followup message for this interaction.
|
||||||
@@ -369,12 +371,13 @@ namespace Discord.Rest
|
|||||||
/// <param name="components">A <see cref="MessageComponent"/> to be sent with this response.</param>
|
/// <param name="components">A <see cref="MessageComponent"/> to be sent with this response.</param>
|
||||||
/// <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
|
/// <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
|
||||||
/// <param name="options">The request options for this response.</param>
|
/// <param name="options">The request options for this response.</param>
|
||||||
|
/// <param name="poll">A poll to send with the message.</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>
|
||||||
public abstract Task<RestFollowupMessage> FollowupWithFileAsync(Stream fileStream, string fileName, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
public abstract Task<RestFollowupMessage> FollowupWithFileAsync(Stream fileStream, string fileName, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
||||||
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null);
|
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sends a followup message for this interaction.
|
/// Sends a followup message for this interaction.
|
||||||
@@ -389,12 +392,13 @@ namespace Discord.Rest
|
|||||||
/// <param name="components">A <see cref="MessageComponent"/> to be sent with this response.</param>
|
/// <param name="components">A <see cref="MessageComponent"/> to be sent with this response.</param>
|
||||||
/// <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
|
/// <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
|
||||||
/// <param name="options">The request options for this response.</param>
|
/// <param name="options">The request options for this response.</param>
|
||||||
|
/// <param name="poll">A poll to send with the message.</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>
|
||||||
public abstract Task<RestFollowupMessage> FollowupWithFileAsync(string filePath, string fileName = null, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
public abstract Task<RestFollowupMessage> FollowupWithFileAsync(string filePath, string fileName = null, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
||||||
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null);
|
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sends a followup message for this interaction.
|
/// Sends a followup message for this interaction.
|
||||||
@@ -408,12 +412,13 @@ namespace Discord.Rest
|
|||||||
/// <param name="options">The request options for this response.</param>
|
/// <param name="options">The request options for this response.</param>
|
||||||
/// <param name="components">A <see cref="MessageComponent"/> to be sent with this response.</param>
|
/// <param name="components">A <see cref="MessageComponent"/> to be sent with this response.</param>
|
||||||
/// <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
|
/// <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
|
||||||
|
/// <param name="poll">A poll to send with the message.</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>
|
||||||
public abstract Task<RestFollowupMessage> FollowupWithFileAsync(FileAttachment attachment, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
public abstract Task<RestFollowupMessage> FollowupWithFileAsync(FileAttachment attachment, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
||||||
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null);
|
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sends a followup message for this interaction.
|
/// Sends a followup message for this interaction.
|
||||||
@@ -427,12 +432,13 @@ namespace Discord.Rest
|
|||||||
/// <param name="options">The request options for this response.</param>
|
/// <param name="options">The request options for this response.</param>
|
||||||
/// <param name="components">A <see cref="MessageComponent"/> to be sent with this response.</param>
|
/// <param name="components">A <see cref="MessageComponent"/> to be sent with this response.</param>
|
||||||
/// <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
|
/// <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
|
||||||
|
/// <param name="poll">A poll to send with the message.</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>
|
||||||
public abstract Task<RestFollowupMessage> FollowupWithFilesAsync(IEnumerable<FileAttachment> attachments, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
public abstract Task<RestFollowupMessage> FollowupWithFilesAsync(IEnumerable<FileAttachment> attachments, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
||||||
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null);
|
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null);
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public Task DeleteOriginalResponseAsync(RequestOptions options = null)
|
public Task DeleteOriginalResponseAsync(RequestOptions options = null)
|
||||||
@@ -450,8 +456,9 @@ namespace Discord.Rest
|
|||||||
IUser IDiscordInteraction.User => User;
|
IUser IDiscordInteraction.User => User;
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
Task IDiscordInteraction.RespondAsync(string text, Embed[] embeds, bool isTTS, bool ephemeral, AllowedMentions allowedMentions, MessageComponent components, Embed embed, RequestOptions options)
|
Task IDiscordInteraction.RespondAsync(string text, Embed[] embeds, bool isTTS, bool ephemeral, AllowedMentions allowedMentions,
|
||||||
=> Task.FromResult(Respond(text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options));
|
MessageComponent components, Embed embed, RequestOptions options, PollProperties poll)
|
||||||
|
=> Task.FromResult(Respond(text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options, poll));
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
Task IDiscordInteraction.DeferAsync(bool ephemeral, RequestOptions options)
|
Task IDiscordInteraction.DeferAsync(bool ephemeral, RequestOptions options)
|
||||||
=> Task.FromResult(Defer(ephemeral, options));
|
=> Task.FromResult(Defer(ephemeral, options));
|
||||||
@@ -460,8 +467,8 @@ namespace Discord.Rest
|
|||||||
=> Task.FromResult(RespondWithModal(modal, options));
|
=> Task.FromResult(RespondWithModal(modal, options));
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
async Task<IUserMessage> IDiscordInteraction.FollowupAsync(string text, Embed[] embeds, bool isTTS, bool ephemeral, AllowedMentions allowedMentions,
|
async Task<IUserMessage> IDiscordInteraction.FollowupAsync(string text, Embed[] embeds, bool isTTS, bool ephemeral, AllowedMentions allowedMentions,
|
||||||
MessageComponent components, Embed embed, RequestOptions options)
|
MessageComponent components, Embed embed, RequestOptions options, PollProperties poll)
|
||||||
=> await FollowupAsync(text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options).ConfigureAwait(false);
|
=> await FollowupAsync(text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options, poll).ConfigureAwait(false);
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
async Task<IUserMessage> IDiscordInteraction.GetOriginalResponseAsync(RequestOptions options)
|
async Task<IUserMessage> IDiscordInteraction.GetOriginalResponseAsync(RequestOptions options)
|
||||||
=> await GetOriginalResponseAsync(options).ConfigureAwait(false);
|
=> await GetOriginalResponseAsync(options).ConfigureAwait(false);
|
||||||
@@ -470,27 +477,33 @@ namespace Discord.Rest
|
|||||||
=> await ModifyOriginalResponseAsync(func, options).ConfigureAwait(false);
|
=> await ModifyOriginalResponseAsync(func, options).ConfigureAwait(false);
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
async Task<IUserMessage> IDiscordInteraction.FollowupWithFileAsync(Stream fileStream, string fileName, string text, Embed[] embeds, bool isTTS, bool ephemeral,
|
async Task<IUserMessage> IDiscordInteraction.FollowupWithFileAsync(Stream fileStream, string fileName, string text, Embed[] embeds, bool isTTS, bool ephemeral,
|
||||||
AllowedMentions allowedMentions, MessageComponent components, Embed embed, RequestOptions options)
|
AllowedMentions allowedMentions, MessageComponent components, Embed embed, RequestOptions options, PollProperties poll)
|
||||||
=> await FollowupWithFileAsync(fileStream, fileName, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options).ConfigureAwait(false);
|
=> await FollowupWithFileAsync(fileStream, fileName, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options, poll).ConfigureAwait(false);
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
async Task<IUserMessage> IDiscordInteraction.FollowupWithFileAsync(string filePath, string fileName, string text, Embed[] embeds, bool isTTS, bool ephemeral,
|
async Task<IUserMessage> IDiscordInteraction.FollowupWithFileAsync(string filePath, string fileName, string text, Embed[] embeds, bool isTTS, bool ephemeral,
|
||||||
AllowedMentions allowedMentions, MessageComponent components, Embed embed, RequestOptions options)
|
AllowedMentions allowedMentions, MessageComponent components, Embed embed, RequestOptions options, PollProperties poll)
|
||||||
=> await FollowupWithFileAsync(filePath, text, fileName, embeds, isTTS, ephemeral, allowedMentions, components, embed, options).ConfigureAwait(false);
|
=> await FollowupWithFileAsync(filePath, text, fileName, embeds, isTTS, ephemeral, allowedMentions, components, embed, options, poll).ConfigureAwait(false);
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
async Task<IUserMessage> IDiscordInteraction.FollowupWithFileAsync(FileAttachment attachment, string text, Embed[] embeds, bool isTTS, bool ephemeral, AllowedMentions allowedMentions, MessageComponent components, Embed embed, RequestOptions options)
|
async Task<IUserMessage> IDiscordInteraction.FollowupWithFileAsync(FileAttachment attachment, string text, Embed[] embeds, bool isTTS,
|
||||||
=> await FollowupWithFileAsync(attachment, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options).ConfigureAwait(false);
|
bool ephemeral, AllowedMentions allowedMentions, MessageComponent components, Embed embed, RequestOptions options, PollProperties poll)
|
||||||
|
=> await FollowupWithFileAsync(attachment, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options, poll).ConfigureAwait(false);
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
async Task<IUserMessage> IDiscordInteraction.FollowupWithFilesAsync(IEnumerable<FileAttachment> attachments, string text, Embed[] embeds, bool isTTS, bool ephemeral, AllowedMentions allowedMentions, MessageComponent components, Embed embed, RequestOptions options)
|
async Task<IUserMessage> IDiscordInteraction.FollowupWithFilesAsync(IEnumerable<FileAttachment> attachments, string text, Embed[] embeds, bool isTTS,
|
||||||
=> await FollowupWithFilesAsync(attachments, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options).ConfigureAwait(false);
|
bool ephemeral, AllowedMentions allowedMentions, MessageComponent components, Embed embed, RequestOptions options, PollProperties poll)
|
||||||
|
=> await FollowupWithFilesAsync(attachments, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options, poll).ConfigureAwait(false);
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
Task IDiscordInteraction.RespondWithFilesAsync(IEnumerable<FileAttachment> attachments, string text, Embed[] embeds, bool isTTS, bool ephemeral, AllowedMentions allowedMentions, MessageComponent components, Embed embed, RequestOptions options) => throw new NotSupportedException("REST-Based interactions don't support files.");
|
Task IDiscordInteraction.RespondWithFilesAsync(IEnumerable<FileAttachment> attachments, string text, Embed[] embeds, bool isTTS, bool ephemeral,
|
||||||
|
AllowedMentions allowedMentions, MessageComponent components, Embed embed, RequestOptions options, PollProperties poll) => throw new NotSupportedException("REST-Based interactions don't support files.");
|
||||||
#if NETCOREAPP3_0_OR_GREATER != true
|
#if NETCOREAPP3_0_OR_GREATER != true
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
Task IDiscordInteraction.RespondWithFileAsync(Stream fileStream, string fileName, string text, Embed[] embeds, bool isTTS, bool ephemeral, AllowedMentions allowedMentions, MessageComponent components, Embed embed, RequestOptions options) => throw new NotSupportedException("REST-Based interactions don't support files.");
|
Task IDiscordInteraction.RespondWithFileAsync(Stream fileStream, string fileName, string text, Embed[] embeds, bool isTTS, bool ephemeral,
|
||||||
|
AllowedMentions allowedMentions, MessageComponent components, Embed embed, RequestOptions options, PollProperties poll) => throw new NotSupportedException("REST-Based interactions don't support files.");
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
Task IDiscordInteraction.RespondWithFileAsync(string filePath, string fileName, string text, Embed[] embeds, bool isTTS, bool ephemeral, AllowedMentions allowedMentions, MessageComponent components, Embed embed, RequestOptions options) => throw new NotSupportedException("REST-Based interactions don't support files.");
|
Task IDiscordInteraction.RespondWithFileAsync(string filePath, string fileName, string text, Embed[] embeds, bool isTTS,
|
||||||
|
bool ephemeral, AllowedMentions allowedMentions, MessageComponent components, Embed embed, RequestOptions options, PollProperties poll) => throw new NotSupportedException("REST-Based interactions don't support files.");
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
Task IDiscordInteraction.RespondWithFileAsync(FileAttachment attachment, string text, Embed[] embeds, bool isTTS, bool ephemeral, AllowedMentions allowedMentions, MessageComponent components, Embed embed, RequestOptions options) => throw new NotSupportedException("REST-Based interactions don't support files.");
|
Task IDiscordInteraction.RespondWithFileAsync(FileAttachment attachment, string text, Embed[] embeds, bool isTTS, bool ephemeral,
|
||||||
|
AllowedMentions allowedMentions, MessageComponent components, Embed embed, RequestOptions options, PollProperties poll) => throw new NotSupportedException("REST-Based interactions don't support files.");
|
||||||
#endif
|
#endif
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,11 +37,11 @@ namespace Discord.Rest
|
|||||||
|
|
||||||
public override string Defer(bool ephemeral = false, RequestOptions options = null) => throw new NotSupportedException();
|
public override string Defer(bool ephemeral = false, RequestOptions options = null) => throw new NotSupportedException();
|
||||||
public override string RespondWithModal(Modal modal, RequestOptions options = null) => throw new NotSupportedException();
|
public override string RespondWithModal(Modal modal, RequestOptions options = null) => throw new NotSupportedException();
|
||||||
public override string Respond(string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null) => throw new NotSupportedException();
|
public override string Respond(string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null) => throw new NotSupportedException();
|
||||||
public override Task<RestFollowupMessage> FollowupAsync(string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null) => throw new NotSupportedException();
|
public override Task<RestFollowupMessage> FollowupAsync(string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null) => throw new NotSupportedException();
|
||||||
public override Task<RestFollowupMessage> FollowupWithFileAsync(Stream fileStream, string fileName, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null) => throw new NotSupportedException();
|
public override Task<RestFollowupMessage> FollowupWithFileAsync(Stream fileStream, string fileName, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null) => throw new NotSupportedException();
|
||||||
public override Task<RestFollowupMessage> FollowupWithFileAsync(string filePath, string fileName = null, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null) => throw new NotSupportedException();
|
public override Task<RestFollowupMessage> FollowupWithFileAsync(string filePath, string fileName = null, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null) => throw new NotSupportedException();
|
||||||
public override Task<RestFollowupMessage> FollowupWithFileAsync(FileAttachment attachment, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null) => throw new NotSupportedException();
|
public override Task<RestFollowupMessage> FollowupWithFileAsync(FileAttachment attachment, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null) => throw new NotSupportedException();
|
||||||
public override Task<RestFollowupMessage> FollowupWithFilesAsync(IEnumerable<FileAttachment> attachments, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null) => throw new NotSupportedException();
|
public override Task<RestFollowupMessage> FollowupWithFilesAsync(IEnumerable<FileAttachment> attachments, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null) => throw new NotSupportedException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,17 +100,17 @@ namespace Discord.Rest
|
|||||||
=> Respond(result, options);
|
=> Respond(result, options);
|
||||||
public override string Defer(bool ephemeral = false, RequestOptions options = null)
|
public override string Defer(bool ephemeral = false, RequestOptions options = null)
|
||||||
=> throw new NotSupportedException("Autocomplete interactions don't support this method!");
|
=> throw new NotSupportedException("Autocomplete interactions don't support this method!");
|
||||||
public override string Respond(string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null)
|
public override string Respond(string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null)
|
||||||
=> throw new NotSupportedException("Autocomplete interactions don't support this method!");
|
=> throw new NotSupportedException("Autocomplete interactions don't support this method!");
|
||||||
public override Task<RestFollowupMessage> FollowupAsync(string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null)
|
public override Task<RestFollowupMessage> FollowupAsync(string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null)
|
||||||
=> throw new NotSupportedException("Autocomplete interactions don't support this method!");
|
=> throw new NotSupportedException("Autocomplete interactions don't support this method!");
|
||||||
public override Task<RestFollowupMessage> FollowupWithFileAsync(Stream fileStream, string fileName, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null)
|
public override Task<RestFollowupMessage> FollowupWithFileAsync(Stream fileStream, string fileName, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null)
|
||||||
=> throw new NotSupportedException("Autocomplete interactions don't support this method!");
|
=> throw new NotSupportedException("Autocomplete interactions don't support this method!");
|
||||||
public override Task<RestFollowupMessage> FollowupWithFileAsync(string filePath, string fileName = null, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null)
|
public override Task<RestFollowupMessage> FollowupWithFileAsync(string filePath, string fileName = null, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null)
|
||||||
=> throw new NotSupportedException("Autocomplete interactions don't support this method!");
|
=> throw new NotSupportedException("Autocomplete interactions don't support this method!");
|
||||||
public override Task<RestFollowupMessage> FollowupWithFileAsync(FileAttachment attachment, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null)
|
public override Task<RestFollowupMessage> FollowupWithFileAsync(FileAttachment attachment, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null)
|
||||||
=> throw new NotSupportedException("Autocomplete interactions don't support this method!");
|
=> throw new NotSupportedException("Autocomplete interactions don't support this method!");
|
||||||
public override Task<RestFollowupMessage> FollowupWithFilesAsync(IEnumerable<FileAttachment> attachments, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null)
|
public override Task<RestFollowupMessage> FollowupWithFilesAsync(IEnumerable<FileAttachment> attachments, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null)
|
||||||
=> throw new NotSupportedException("Autocomplete interactions don't support this method!");
|
=> throw new NotSupportedException("Autocomplete interactions don't support this method!");
|
||||||
public override string RespondWithModal(Modal modal, RequestOptions options = null)
|
public override string RespondWithModal(Modal modal, RequestOptions options = null)
|
||||||
=> throw new NotSupportedException("Autocomplete interactions don't support this method!");
|
=> throw new NotSupportedException("Autocomplete interactions don't support this method!");
|
||||||
|
|||||||
@@ -386,5 +386,31 @@ namespace Discord.Rest
|
|||||||
author = RestUser.Create(client, guild, model, webhookId);
|
author = RestUser.Create(client, guild, model, webhookId);
|
||||||
return author;
|
return author;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static IAsyncEnumerable<IReadOnlyCollection<IUser>> GetPollAnswerVotersAsync(ulong channelId, ulong msgId, ulong? afterId,
|
||||||
|
uint answerId, int? limit, BaseDiscordClient client, RequestOptions options)
|
||||||
|
{
|
||||||
|
return new PagedAsyncEnumerable<IUser>(
|
||||||
|
DiscordConfig.MaxPollVotersPerBatch,
|
||||||
|
async (info, ct) =>
|
||||||
|
{
|
||||||
|
var model = await client.ApiClient.GetPollAnswerVotersAsync(channelId, msgId, answerId, info.PageSize, info.Position, options).ConfigureAwait(false);
|
||||||
|
return model.Users.Select(x => RestUser.Create(client, x)).ToImmutableArray();
|
||||||
|
},
|
||||||
|
nextPage: (info, lastPage) =>
|
||||||
|
{
|
||||||
|
if (lastPage.Count != DiscordConfig.MaxPollVotersPerBatch)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
info.Position = lastPage.Max(x => x.Id);
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
count: limit,
|
||||||
|
start: afterId
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Task<Message> EndPollAsync(ulong channelId, ulong messageId, BaseDiscordClient client, RequestOptions options)
|
||||||
|
=> client.ApiClient.ExpirePollAsync(channelId, messageId, options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,6 +51,9 @@ namespace Discord.Rest
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public IMessageInteractionMetadata InteractionMetadata { get; internal set; }
|
public IMessageInteractionMetadata InteractionMetadata { get; internal set; }
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public Poll? Poll { get; internal set; }
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public MessageResolvedData ResolvedData { get; internal set; }
|
public MessageResolvedData ResolvedData { get; internal set; }
|
||||||
|
|
||||||
@@ -167,6 +170,9 @@ namespace Discord.Rest
|
|||||||
}
|
}
|
||||||
if (model.InteractionMetadata.IsSpecified)
|
if (model.InteractionMetadata.IsSpecified)
|
||||||
InteractionMetadata = model.InteractionMetadata.Value.ToInteractionMetadata();
|
InteractionMetadata = model.InteractionMetadata.Value.ToInteractionMetadata();
|
||||||
|
|
||||||
|
if (model.Poll.IsSpecified)
|
||||||
|
Poll = model.Poll.Value.ToEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
@@ -203,6 +209,15 @@ namespace Discord.Rest
|
|||||||
return MessageHelper.CrosspostAsync(this, Discord, options);
|
return MessageHelper.CrosspostAsync(this, Discord, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public Task EndPollAsync(RequestOptions options = null)
|
||||||
|
=> MessageHelper.EndPollAsync(Channel.Id, Id, Discord, options);
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public IAsyncEnumerable<IReadOnlyCollection<IUser>> GetPollAnswerVotersAsync(uint answerId, int? limit = null, ulong? afterId = null,
|
||||||
|
RequestOptions options = null)
|
||||||
|
=> MessageHelper.GetPollAnswerVotersAsync(Channel.Id, Id, afterId, answerId, limit, Discord, options);
|
||||||
|
|
||||||
private string DebuggerDisplay => $"{Author}: {Content} ({Id}{(Attachments.Count > 0 ? $", {Attachments.Count} Attachments" : "")})";
|
private string DebuggerDisplay => $"{Author}: {Content} ({Id}{(Attachments.Count > 0 ? $", {Attachments.Count} Attachments" : "")})";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
61
src/Discord.Net.Rest/Extensions/PollExtensions.cs
Normal file
61
src/Discord.Net.Rest/Extensions/PollExtensions.cs
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
using System.Collections.Immutable;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace Discord.Rest;
|
||||||
|
|
||||||
|
internal static class PollExtensions
|
||||||
|
{
|
||||||
|
public static API.Rest.CreatePollParams ToModel(this PollProperties poll)
|
||||||
|
=> new()
|
||||||
|
{
|
||||||
|
AllowMultiselect = poll.AllowMultiselect,
|
||||||
|
Duration = poll.Duration,
|
||||||
|
LayoutType = poll.LayoutType,
|
||||||
|
Answers = poll.Answers.Select(x => new API.PollAnswer
|
||||||
|
{
|
||||||
|
PollMedia = new API.PollMedia
|
||||||
|
{
|
||||||
|
Emoji = x.Emoji is not null
|
||||||
|
? new API.Emoji
|
||||||
|
{
|
||||||
|
Id = x.Emoji is Emote emote ? emote.Id : null,
|
||||||
|
Name = x.Emoji is Emoji emoji ? emoji.Name : null,
|
||||||
|
} : Optional<API.Emoji>.Unspecified,
|
||||||
|
Text = x.Text,
|
||||||
|
}
|
||||||
|
}).ToArray(),
|
||||||
|
Question = new API.PollMedia
|
||||||
|
{
|
||||||
|
Emoji = poll.Question.Emoji is not null
|
||||||
|
? new API.Emoji
|
||||||
|
{
|
||||||
|
Id = poll.Question.Emoji is Emote emote ? emote.Id : null,
|
||||||
|
Name = poll.Question.Emoji is Emoji emoji ? emoji.Name : null,
|
||||||
|
}
|
||||||
|
: Optional<API.Emoji>.Unspecified,
|
||||||
|
Text = poll.Question.Text,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
public static Poll ToEntity(this API.Poll poll)
|
||||||
|
=> new(
|
||||||
|
new PollMedia(poll.Question.Text,
|
||||||
|
poll.Question.Emoji.IsSpecified
|
||||||
|
? poll.Question.Emoji.Value.ToIEmote()
|
||||||
|
: null),
|
||||||
|
poll.Answers.Select(x =>
|
||||||
|
new PollAnswer(
|
||||||
|
x.AnswerId,
|
||||||
|
new PollMedia(x.PollMedia.Text, x.PollMedia.Emoji.IsSpecified
|
||||||
|
? x.PollMedia.Emoji.Value.ToIEmote()
|
||||||
|
: null))).ToImmutableArray(),
|
||||||
|
poll.Expiry,
|
||||||
|
poll.AllowMultiselect,
|
||||||
|
poll.LayoutType,
|
||||||
|
poll.PollResults.IsSpecified
|
||||||
|
? new PollResults(
|
||||||
|
poll.PollResults.Value.IsFinalized,
|
||||||
|
poll.PollResults.Value.AnswerCounts.Select(x => new PollAnswerCounts(x.Id, x.Count, x.MeVoted)).ToImmutableArray())
|
||||||
|
: null
|
||||||
|
);
|
||||||
|
}
|
||||||
21
src/Discord.Net.WebSocket/API/Gateway/PollVote.cs
Normal file
21
src/Discord.Net.WebSocket/API/Gateway/PollVote.cs
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace Discord.API.Gateway;
|
||||||
|
|
||||||
|
internal class PollVote
|
||||||
|
{
|
||||||
|
[JsonProperty("user_id")]
|
||||||
|
public ulong UserId { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("channel_id")]
|
||||||
|
public ulong ChannelId { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("message_id")]
|
||||||
|
public ulong MessageId { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("guild_id")]
|
||||||
|
public Optional<ulong> GuildId { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("answer_id")]
|
||||||
|
public ulong AnswerId { get; set; }
|
||||||
|
}
|
||||||
@@ -286,6 +286,31 @@ namespace Discord.WebSocket
|
|||||||
internal readonly AsyncEvent<Func<Cacheable<IUserMessage, ulong>, Cacheable<IMessageChannel, ulong>, IEmote, Task>> _reactionsRemovedForEmoteEvent = new AsyncEvent<Func<Cacheable<IUserMessage, ulong>, Cacheable<IMessageChannel, ulong>, IEmote, Task>>();
|
internal readonly AsyncEvent<Func<Cacheable<IUserMessage, ulong>, Cacheable<IMessageChannel, ulong>, IEmote, Task>> _reactionsRemovedForEmoteEvent = new AsyncEvent<Func<Cacheable<IUserMessage, ulong>, Cacheable<IMessageChannel, ulong>, IEmote, Task>>();
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Polls
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Fired when a vote is added to a poll.
|
||||||
|
/// </summary>
|
||||||
|
public event Func<Cacheable<IUser, ulong>, Cacheable<ISocketMessageChannel, IRestMessageChannel, IMessageChannel, ulong>, Cacheable<IUserMessage, ulong>, Cacheable<SocketGuild, RestGuild, IGuild, ulong>?, ulong, Task> PollVoteAdded
|
||||||
|
{
|
||||||
|
add { _pollVoteAdded.Add(value); }
|
||||||
|
remove { _pollVoteAdded.Remove(value); }
|
||||||
|
}
|
||||||
|
internal readonly AsyncEvent<Func<Cacheable<IUser, ulong>, Cacheable<ISocketMessageChannel, IRestMessageChannel, IMessageChannel, ulong>, Cacheable<IUserMessage, ulong>, Cacheable<SocketGuild, RestGuild, IGuild, ulong>?, ulong, Task>> _pollVoteAdded = new ();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Fired when a vote is removed from a poll.
|
||||||
|
/// </summary>
|
||||||
|
public event Func<Cacheable< IUser, ulong>, Cacheable<ISocketMessageChannel, IRestMessageChannel, IMessageChannel, ulong>, Cacheable<IUserMessage, ulong>, Cacheable<SocketGuild, RestGuild, IGuild, ulong>?, ulong, Task> PollVoteRemoved
|
||||||
|
{
|
||||||
|
add { _pollVoteRemoved.Add(value); }
|
||||||
|
remove { _pollVoteRemoved.Remove(value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
internal readonly AsyncEvent<Func<Cacheable<IUser, ulong>, Cacheable<ISocketMessageChannel, IRestMessageChannel, IMessageChannel, ulong>, Cacheable<IUserMessage, ulong>, Cacheable<SocketGuild, RestGuild, IGuild, ulong>?, ulong, Task>> _pollVoteRemoved = new ();
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region Roles
|
#region Roles
|
||||||
/// <summary> Fired when a role is created. </summary>
|
/// <summary> Fired when a role is created. </summary>
|
||||||
public event Func<SocketRole, Task> RoleCreated
|
public event Func<SocketRole, Task> RoleCreated
|
||||||
|
|||||||
@@ -523,6 +523,9 @@ namespace Discord.WebSocket
|
|||||||
client.EntitlementCreated += (arg1) => _entitlementCreated.InvokeAsync(arg1);
|
client.EntitlementCreated += (arg1) => _entitlementCreated.InvokeAsync(arg1);
|
||||||
client.EntitlementUpdated += (arg1, arg2) => _entitlementUpdated.InvokeAsync(arg1, arg2);
|
client.EntitlementUpdated += (arg1, arg2) => _entitlementUpdated.InvokeAsync(arg1, arg2);
|
||||||
client.EntitlementDeleted += (arg1) => _entitlementDeleted.InvokeAsync(arg1);
|
client.EntitlementDeleted += (arg1) => _entitlementDeleted.InvokeAsync(arg1);
|
||||||
|
|
||||||
|
client.PollVoteAdded += (arg1, arg2, arg3, arg4, arg5) => _pollVoteAdded.InvokeAsync(arg1, arg2, arg3, arg4, arg5);
|
||||||
|
client.PollVoteRemoved += (arg1, arg2, arg3, arg4, arg5) => _pollVoteRemoved.InvokeAsync(arg1, arg2, arg3, arg4, arg5);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<SocketApplicationCommand> CreateGlobalApplicationCommandAsync(ApplicationCommandProperties properties, RequestOptions options = null)
|
public async Task<SocketApplicationCommand> CreateGlobalApplicationCommandAsync(ApplicationCommandProperties properties, RequestOptions options = null)
|
||||||
|
|||||||
@@ -2029,6 +2029,116 @@ namespace Discord.WebSocket
|
|||||||
break;
|
break;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Polls
|
||||||
|
|
||||||
|
case "MESSAGE_POLL_VOTE_ADD":
|
||||||
|
{
|
||||||
|
await _gatewayLogger.DebugAsync("Received Dispatch (MESSAGE_POLL_VOTE_ADD)").ConfigureAwait(false);
|
||||||
|
|
||||||
|
var data = (payload as JToken).ToObject<PollVote>(_serializer);
|
||||||
|
|
||||||
|
Cacheable<SocketGuild, RestGuild, IGuild, ulong>? guildCacheable = null;
|
||||||
|
|
||||||
|
Cacheable<IUser, ulong> userCacheable;
|
||||||
|
Cacheable<ISocketMessageChannel, IRestMessageChannel, IMessageChannel, ulong> channelCacheable;
|
||||||
|
Cacheable<IUserMessage, ulong> messageCacheable;
|
||||||
|
|
||||||
|
if (data.GuildId.IsSpecified)
|
||||||
|
{
|
||||||
|
var guild = State.GetGuild(data.GuildId.Value);
|
||||||
|
guildCacheable = new (guild, data.GuildId.Value, guild is not null, () => Rest.GetGuildAsync(data.GuildId.Value));
|
||||||
|
|
||||||
|
if (guild is not null)
|
||||||
|
{
|
||||||
|
var user = guild.GetUser(data.UserId);
|
||||||
|
userCacheable = new (user, data.UserId, user is not null, async () => await Rest.GetGuildUserAsync(data.GuildId.Value, data.UserId));
|
||||||
|
|
||||||
|
var channel = guild.GetTextChannel(data.ChannelId);
|
||||||
|
channelCacheable = new(channel, data.ChannelId, channel is not null, async () => (RestTextChannel)await Rest.GetChannelAsync(data.ChannelId));
|
||||||
|
|
||||||
|
var message = channel?.GetCachedMessage(data.MessageId) as IUserMessage;
|
||||||
|
messageCacheable = new (message, data.MessageId, message is not null,
|
||||||
|
async () => (channel ?? (ITextChannel)await Rest.GetChannelAsync(data.ChannelId)).GetMessageAsync(data.MessageId) as IUserMessage);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
userCacheable = new (null, data.UserId, false, async () => await Rest.GetGuildUserAsync(data.GuildId.Value, data.UserId));
|
||||||
|
channelCacheable = new(null, data.ChannelId, false, async () => (RestTextChannel)(await Rest.GetChannelAsync(data.ChannelId)));
|
||||||
|
messageCacheable = new(null, data.MessageId, false,
|
||||||
|
async () => await ((ITextChannel)await Rest.GetChannelAsync(data.ChannelId)).GetMessageAsync(data.MessageId) as IUserMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var user = State.GetUser(data.UserId);
|
||||||
|
userCacheable = new(user, data.UserId, user is not null, async () => await GetUserAsync(data.UserId));
|
||||||
|
|
||||||
|
var channel = State.GetChannel(data.ChannelId) as ISocketMessageChannel;
|
||||||
|
channelCacheable = new(channel, data.ChannelId, channel is not null, async () => await Rest.GetDMChannelAsync(data.ChannelId) as IRestMessageChannel);
|
||||||
|
|
||||||
|
var message = channel?.GetCachedMessage(data.MessageId) as IUserMessage;
|
||||||
|
messageCacheable = new(message, data.MessageId, message is not null, async () => await (channel ?? (IMessageChannel)await Rest.GetDMChannelAsync(data.ChannelId)).GetMessageAsync(data.MessageId) as IUserMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
await TimedInvokeAsync(_pollVoteAdded, nameof(PollVoteAdded), userCacheable, channelCacheable, messageCacheable, guildCacheable, data.AnswerId);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "MESSAGE_POLL_VOTE_REMOVE":
|
||||||
|
{
|
||||||
|
await _gatewayLogger.DebugAsync("Received Dispatch (MESSAGE_POLL_VOTE_REMOVE)").ConfigureAwait(false);
|
||||||
|
|
||||||
|
var data = (payload as JToken).ToObject<PollVote>(_serializer);
|
||||||
|
|
||||||
|
Cacheable<SocketGuild, RestGuild, IGuild, ulong>? guildCacheable = null;
|
||||||
|
|
||||||
|
Cacheable<IUser, ulong> userCacheable;
|
||||||
|
Cacheable<ISocketMessageChannel, IRestMessageChannel, IMessageChannel, ulong> channelCacheable;
|
||||||
|
Cacheable<IUserMessage, ulong> messageCacheable;
|
||||||
|
|
||||||
|
if (data.GuildId.IsSpecified)
|
||||||
|
{
|
||||||
|
var guild = State.GetGuild(data.GuildId.Value);
|
||||||
|
guildCacheable = new(guild, data.GuildId.Value, guild is not null, () => Rest.GetGuildAsync(data.GuildId.Value));
|
||||||
|
|
||||||
|
if (guild is not null)
|
||||||
|
{
|
||||||
|
var user = guild.GetUser(data.UserId);
|
||||||
|
userCacheable = new(user, data.UserId, user is not null, async () => await Rest.GetGuildUserAsync(data.GuildId.Value, data.UserId));
|
||||||
|
|
||||||
|
var channel = guild.GetTextChannel(data.ChannelId);
|
||||||
|
channelCacheable = new(channel, data.ChannelId, channel is not null, async () => (RestTextChannel)await Rest.GetChannelAsync(data.ChannelId));
|
||||||
|
|
||||||
|
var message = channel?.GetCachedMessage(data.MessageId) as IUserMessage;
|
||||||
|
messageCacheable = new(message, data.MessageId, message is not null,
|
||||||
|
async () => (channel ?? (ITextChannel)await Rest.GetChannelAsync(data.ChannelId)).GetMessageAsync(data.MessageId) as IUserMessage);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
userCacheable = new(null, data.UserId, false, async () => await Rest.GetGuildUserAsync(data.GuildId.Value, data.UserId));
|
||||||
|
channelCacheable = new(null, data.ChannelId, false, async () => (RestTextChannel)(await Rest.GetChannelAsync(data.ChannelId)));
|
||||||
|
messageCacheable = new(null, data.MessageId, false,
|
||||||
|
async () => await ((ITextChannel)await Rest.GetChannelAsync(data.ChannelId)).GetMessageAsync(data.MessageId) as IUserMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var user = State.GetUser(data.UserId);
|
||||||
|
userCacheable = new(user, data.UserId, user is not null, async () => await GetUserAsync(data.UserId));
|
||||||
|
|
||||||
|
var channel = State.GetChannel(data.ChannelId) as ISocketMessageChannel;
|
||||||
|
channelCacheable = new(channel, data.ChannelId, channel is not null, async () => await Rest.GetDMChannelAsync(data.ChannelId) as IRestMessageChannel);
|
||||||
|
|
||||||
|
var message = channel?.GetCachedMessage(data.MessageId) as IUserMessage;
|
||||||
|
messageCacheable = new(message, data.MessageId, message is not null, async () => await (channel ?? (IMessageChannel)await Rest.GetDMChannelAsync(data.ChannelId)).GetMessageAsync(data.MessageId) as IUserMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
await TimedInvokeAsync(_pollVoteRemoved, nameof(PollVoteRemoved), userCacheable, channelCacheable, messageCacheable, guildCacheable, data.AnswerId);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region Statuses
|
#region Statuses
|
||||||
case "PRESENCE_UPDATE":
|
case "PRESENCE_UPDATE":
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -18,35 +18,35 @@ namespace Discord.WebSocket
|
|||||||
/// </returns>
|
/// </returns>
|
||||||
IReadOnlyCollection<SocketMessage> CachedMessages { get; }
|
IReadOnlyCollection<SocketMessage> CachedMessages { get; }
|
||||||
|
|
||||||
/// <inheritdoc cref="IMessageChannel.SendMessageAsync(string, bool, Embed, RequestOptions, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[], MessageFlags)"/>
|
/// <inheritdoc cref="IMessageChannel.SendMessageAsync(string, bool, Embed, RequestOptions, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[], MessageFlags, PollProperties)"/>
|
||||||
new Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null,
|
new Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null,
|
||||||
RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null,
|
RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null,
|
||||||
MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null, MessageFlags flags = MessageFlags.None);
|
MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null, MessageFlags flags = MessageFlags.None, PollProperties poll = null);
|
||||||
|
|
||||||
/// <inheritdoc cref="IMessageChannel.SendFileAsync(string, string, bool, Embed, RequestOptions, bool, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[], MessageFlags)"/>
|
/// <inheritdoc cref="IMessageChannel.SendFileAsync(string, string, bool, Embed, RequestOptions, bool, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[], MessageFlags, PollProperties)"/>
|
||||||
new Task<RestUserMessage> SendFileAsync(string filePath, string text = null, bool isTTS = false, Embed embed = null,
|
new Task<RestUserMessage> SendFileAsync(string filePath, string text = null, bool isTTS = false, Embed embed = null,
|
||||||
RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null,
|
RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null,
|
||||||
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
||||||
Embed[] embeds = null, MessageFlags flags = MessageFlags.None);
|
Embed[] embeds = null, MessageFlags flags = MessageFlags.None, PollProperties poll = null);
|
||||||
|
|
||||||
/// <inheritdoc cref="IMessageChannel.SendFileAsync(Stream, string, string, bool, Embed, RequestOptions, bool, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[], MessageFlags)"/>
|
/// <inheritdoc cref="IMessageChannel.SendFileAsync(Stream, string, string, bool, Embed, RequestOptions, bool, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[], MessageFlags, PollProperties)"/>
|
||||||
new Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text = null, bool isTTS = false,
|
new Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text = null, bool isTTS = false,
|
||||||
Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null,
|
Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null,
|
||||||
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
||||||
Embed[] embeds = null, MessageFlags flags = MessageFlags.None);
|
Embed[] embeds = null, MessageFlags flags = MessageFlags.None, PollProperties poll = null);
|
||||||
|
|
||||||
/// <inheritdoc cref="IMessageChannel.SendFileAsync(FileAttachment, string, bool, Embed, RequestOptions, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[], MessageFlags)"/>
|
/// <inheritdoc cref="IMessageChannel.SendFileAsync(FileAttachment, string, bool, Embed, RequestOptions, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[], MessageFlags, PollProperties)"/>
|
||||||
new Task<RestUserMessage> SendFileAsync(FileAttachment attachment, string text = null, bool isTTS = false,
|
new Task<RestUserMessage> SendFileAsync(FileAttachment attachment, string text = null, bool isTTS = false,
|
||||||
Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null,
|
Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null,
|
||||||
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
||||||
Embed[] embeds = null, MessageFlags flags = MessageFlags.None);
|
Embed[] embeds = null, MessageFlags flags = MessageFlags.None, PollProperties poll = null);
|
||||||
|
|
||||||
/// <inheritdoc cref="IMessageChannel.SendFilesAsync(IEnumerable{FileAttachment}, string, bool, Embed, RequestOptions, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[], MessageFlags)"/>
|
/// <inheritdoc cref="IMessageChannel.SendFilesAsync(IEnumerable{FileAttachment}, string, bool, Embed, RequestOptions, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[], MessageFlags, PollProperties)"/>
|
||||||
new Task<RestUserMessage> SendFilesAsync(IEnumerable<FileAttachment> attachments, string text = null,
|
new Task<RestUserMessage> SendFilesAsync(IEnumerable<FileAttachment> attachments, string text = null,
|
||||||
bool isTTS = false, Embed embed = null, RequestOptions options = null,
|
bool isTTS = false, Embed embed = null, RequestOptions options = null,
|
||||||
AllowedMentions allowedMentions = null, MessageReference messageReference = null,
|
AllowedMentions allowedMentions = null, MessageReference messageReference = null,
|
||||||
MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null,
|
MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null,
|
||||||
MessageFlags flags = MessageFlags.None);
|
MessageFlags flags = MessageFlags.None, PollProperties poll = null);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a cached message from this channel.
|
/// Gets a cached message from this channel.
|
||||||
|
|||||||
@@ -142,45 +142,45 @@ namespace Discord.WebSocket
|
|||||||
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||||
public Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null,
|
public Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null,
|
||||||
RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null,
|
RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null,
|
||||||
MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
|
MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null, MessageFlags flags = MessageFlags.None, PollProperties poll = null)
|
||||||
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, allowedMentions, messageReference,
|
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, allowedMentions, messageReference,
|
||||||
components, stickers, options, embeds, flags);
|
components, stickers, options, embeds, flags, poll);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||||
public Task<RestUserMessage> SendFileAsync(string filePath, string text = null, bool isTTS = false, Embed embed = null,
|
public Task<RestUserMessage> SendFileAsync(string filePath, string text = null, bool isTTS = false, Embed embed = null,
|
||||||
RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null,
|
RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null,
|
||||||
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
||||||
Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
|
Embed[] embeds = null, MessageFlags flags = MessageFlags.None, PollProperties poll = null)
|
||||||
=> ChannelHelper.SendFileAsync(this, Discord, filePath, text, isTTS, embed, allowedMentions, messageReference,
|
=> ChannelHelper.SendFileAsync(this, Discord, filePath, text, isTTS, embed, allowedMentions, messageReference,
|
||||||
components, stickers, options, isSpoiler, embeds, flags);
|
components, stickers, options, isSpoiler, embeds, flags, poll);
|
||||||
/// <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>
|
||||||
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||||
public Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text = null, bool isTTS = false,
|
public Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text = null, bool isTTS = false,
|
||||||
Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null,
|
Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null,
|
||||||
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
||||||
Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
|
Embed[] embeds = null, MessageFlags flags = MessageFlags.None, PollProperties poll = null)
|
||||||
=> ChannelHelper.SendFileAsync(this, Discord, stream, filename, text, isTTS, embed, allowedMentions,
|
=> ChannelHelper.SendFileAsync(this, Discord, stream, filename, text, isTTS, embed, allowedMentions,
|
||||||
messageReference, components, stickers, options, isSpoiler, embeds, flags);
|
messageReference, components, stickers, options, isSpoiler, embeds, flags, poll);
|
||||||
/// <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>
|
||||||
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||||
public Task<RestUserMessage> SendFileAsync(FileAttachment attachment, string text = null, bool isTTS = false,
|
public Task<RestUserMessage> SendFileAsync(FileAttachment attachment, string text = null, bool isTTS = false,
|
||||||
Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null,
|
Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null,
|
||||||
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
||||||
Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
|
Embed[] embeds = null, MessageFlags flags = MessageFlags.None, PollProperties poll = null)
|
||||||
=> ChannelHelper.SendFileAsync(this, Discord, attachment, text, isTTS, embed, allowedMentions,
|
=> ChannelHelper.SendFileAsync(this, Discord, attachment, text, isTTS, embed, allowedMentions,
|
||||||
messageReference, components, stickers, options, embeds, flags);
|
messageReference, components, stickers, options, embeds, flags, poll);
|
||||||
/// <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>
|
||||||
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||||
public Task<RestUserMessage> SendFilesAsync(IEnumerable<FileAttachment> attachments, string text = null, bool isTTS = false,
|
public Task<RestUserMessage> SendFilesAsync(IEnumerable<FileAttachment> attachments, string text = null, bool isTTS = false,
|
||||||
Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null,
|
Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null,
|
||||||
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
||||||
Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
|
Embed[] embeds = null, MessageFlags flags = MessageFlags.None, PollProperties poll = null)
|
||||||
=> ChannelHelper.SendFilesAsync(this, Discord, attachments, text, isTTS, embed, allowedMentions,
|
=> ChannelHelper.SendFilesAsync(this, Discord, attachments, text, isTTS, embed, allowedMentions,
|
||||||
messageReference, components, stickers, options, embeds, flags);
|
messageReference, components, stickers, options, embeds, flags, poll);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public Task DeleteMessageAsync(ulong messageId, RequestOptions options = null)
|
public Task DeleteMessageAsync(ulong messageId, RequestOptions options = null)
|
||||||
@@ -282,35 +282,35 @@ namespace Discord.WebSocket
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(string filePath, string text, bool isTTS, Embed embed,
|
async Task<IUserMessage> IMessageChannel.SendFileAsync(string filePath, string text, bool isTTS, Embed embed,
|
||||||
RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference,
|
RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference,
|
||||||
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags, PollProperties poll)
|
||||||
=> await SendFileAsync(filePath, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference,
|
=> await SendFileAsync(filePath, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference,
|
||||||
components, stickers, embeds, flags).ConfigureAwait(false);
|
components, stickers, embeds, flags, poll).ConfigureAwait(false);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS,
|
async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS,
|
||||||
Embed embed, RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference,
|
Embed embed, RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference,
|
||||||
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags, PollProperties poll)
|
||||||
=> await SendFileAsync(stream, filename, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference,
|
=> await SendFileAsync(stream, filename, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference,
|
||||||
components, stickers, embeds, flags).ConfigureAwait(false);
|
components, stickers, embeds, flags, poll).ConfigureAwait(false);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(FileAttachment attachment, string text, bool isTTS,
|
async Task<IUserMessage> IMessageChannel.SendFileAsync(FileAttachment attachment, string text, bool isTTS,
|
||||||
Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference,
|
Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference,
|
||||||
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags, PollProperties poll)
|
||||||
=> await SendFileAsync(attachment, text, isTTS, embed, options, allowedMentions, messageReference, components,
|
=> await SendFileAsync(attachment, text, isTTS, embed, options, allowedMentions, messageReference, components,
|
||||||
stickers, embeds, flags).ConfigureAwait(false);
|
stickers, embeds, flags, poll).ConfigureAwait(false);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
async Task<IUserMessage> IMessageChannel.SendFilesAsync(IEnumerable<FileAttachment> attachments, string text,
|
async Task<IUserMessage> IMessageChannel.SendFilesAsync(IEnumerable<FileAttachment> attachments, string text,
|
||||||
bool isTTS, Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference,
|
bool isTTS, Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference,
|
||||||
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags, PollProperties poll)
|
||||||
=> await SendFilesAsync(attachments, text, isTTS, embed, options, allowedMentions, messageReference, components, stickers, embeds, flags).ConfigureAwait(false);
|
=> await SendFilesAsync(attachments, text, isTTS, embed, options, allowedMentions, messageReference, components, stickers, embeds, flags, poll).ConfigureAwait(false);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options,
|
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options,
|
||||||
AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent components,
|
AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent components,
|
||||||
ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
ISticker[] stickers, Embed[] embeds, MessageFlags flags, PollProperties poll)
|
||||||
=> await SendMessageAsync(text, isTTS, embed, options, allowedMentions, messageReference, components, stickers, embeds, flags).ConfigureAwait(false);
|
=> await SendMessageAsync(text, isTTS, embed, options, allowedMentions, messageReference, components, stickers, embeds, flags, poll).ConfigureAwait(false);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region IChannel
|
#region IChannel
|
||||||
|
|||||||
@@ -181,45 +181,45 @@ namespace Discord.WebSocket
|
|||||||
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||||
public Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null,
|
public Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null,
|
||||||
RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null,
|
RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null,
|
||||||
MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
|
MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null, MessageFlags flags = MessageFlags.None, PollProperties poll = null)
|
||||||
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, allowedMentions, messageReference,
|
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, allowedMentions, messageReference,
|
||||||
components, stickers, options, embeds, flags);
|
components, stickers, options, embeds, flags, poll);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||||
public Task<RestUserMessage> SendFileAsync(string filePath, string text = null, bool isTTS = false, Embed embed = null,
|
public Task<RestUserMessage> SendFileAsync(string filePath, string text = null, bool isTTS = false, Embed embed = null,
|
||||||
RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null,
|
RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null,
|
||||||
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
||||||
Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
|
Embed[] embeds = null, MessageFlags flags = MessageFlags.None, PollProperties poll = null)
|
||||||
=> ChannelHelper.SendFileAsync(this, Discord, filePath, text, isTTS, embed, allowedMentions, messageReference,
|
=> ChannelHelper.SendFileAsync(this, Discord, filePath, text, isTTS, embed, allowedMentions, messageReference,
|
||||||
components, stickers, options, isSpoiler, embeds, flags);
|
components, stickers, options, isSpoiler, embeds, flags, poll);
|
||||||
/// <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>
|
||||||
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||||
public Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text = null, bool isTTS = false,
|
public Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text = null, bool isTTS = false,
|
||||||
Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null,
|
Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null,
|
||||||
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
||||||
Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
|
Embed[] embeds = null, MessageFlags flags = MessageFlags.None, PollProperties poll = null)
|
||||||
=> ChannelHelper.SendFileAsync(this, Discord, stream, filename, text, isTTS, embed, allowedMentions,
|
=> ChannelHelper.SendFileAsync(this, Discord, stream, filename, text, isTTS, embed, allowedMentions,
|
||||||
messageReference, components, stickers, options, isSpoiler, embeds, flags);
|
messageReference, components, stickers, options, isSpoiler, embeds, flags, poll);
|
||||||
/// <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>
|
||||||
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||||
public Task<RestUserMessage> SendFileAsync(FileAttachment attachment, string text = null, bool isTTS = false,
|
public Task<RestUserMessage> SendFileAsync(FileAttachment attachment, string text = null, bool isTTS = false,
|
||||||
Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null,
|
Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null,
|
||||||
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
||||||
Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
|
Embed[] embeds = null, MessageFlags flags = MessageFlags.None, PollProperties poll = null)
|
||||||
=> ChannelHelper.SendFileAsync(this, Discord, attachment, text, isTTS, embed, allowedMentions,
|
=> ChannelHelper.SendFileAsync(this, Discord, attachment, text, isTTS, embed, allowedMentions,
|
||||||
messageReference, components, stickers, options, embeds, flags);
|
messageReference, components, stickers, options, embeds, flags, poll);
|
||||||
/// <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>
|
||||||
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||||
public Task<RestUserMessage> SendFilesAsync(IEnumerable<FileAttachment> attachments, string text = null, bool isTTS = false,
|
public Task<RestUserMessage> SendFilesAsync(IEnumerable<FileAttachment> attachments, string text = null, bool isTTS = false,
|
||||||
Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null,
|
Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null,
|
||||||
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
||||||
Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
|
Embed[] embeds = null, MessageFlags flags = MessageFlags.None, PollProperties poll = null)
|
||||||
=> ChannelHelper.SendFilesAsync(this, Discord, attachments, text, isTTS, embed, allowedMentions,
|
=> ChannelHelper.SendFilesAsync(this, Discord, attachments, text, isTTS, embed, allowedMentions,
|
||||||
messageReference, components, stickers, options, embeds, flags);
|
messageReference, components, stickers, options, embeds, flags, poll);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public Task DeleteMessageAsync(ulong messageId, RequestOptions options = null)
|
public Task DeleteMessageAsync(ulong messageId, RequestOptions options = null)
|
||||||
@@ -353,35 +353,35 @@ namespace Discord.WebSocket
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(string filePath, string text, bool isTTS, Embed embed,
|
async Task<IUserMessage> IMessageChannel.SendFileAsync(string filePath, string text, bool isTTS, Embed embed,
|
||||||
RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference,
|
RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference,
|
||||||
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags, PollProperties poll)
|
||||||
=> await SendFileAsync(filePath, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference,
|
=> await SendFileAsync(filePath, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference,
|
||||||
components, stickers, embeds, flags).ConfigureAwait(false);
|
components, stickers, embeds, flags, poll).ConfigureAwait(false);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS,
|
async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS,
|
||||||
Embed embed, RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference,
|
Embed embed, RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference,
|
||||||
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags, PollProperties poll)
|
||||||
=> await SendFileAsync(stream, filename, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference,
|
=> await SendFileAsync(stream, filename, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference,
|
||||||
components, stickers, embeds, flags).ConfigureAwait(false);
|
components, stickers, embeds, flags, poll).ConfigureAwait(false);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(FileAttachment attachment, string text, bool isTTS,
|
async Task<IUserMessage> IMessageChannel.SendFileAsync(FileAttachment attachment, string text, bool isTTS,
|
||||||
Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference,
|
Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference,
|
||||||
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags, PollProperties poll)
|
||||||
=> await SendFileAsync(attachment, text, isTTS, embed, options, allowedMentions, messageReference, components,
|
=> await SendFileAsync(attachment, text, isTTS, embed, options, allowedMentions, messageReference, components,
|
||||||
stickers, embeds, flags).ConfigureAwait(false);
|
stickers, embeds, flags, poll).ConfigureAwait(false);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
async Task<IUserMessage> IMessageChannel.SendFilesAsync(IEnumerable<FileAttachment> attachments, string text,
|
async Task<IUserMessage> IMessageChannel.SendFilesAsync(IEnumerable<FileAttachment> attachments, string text,
|
||||||
bool isTTS, Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference,
|
bool isTTS, Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference,
|
||||||
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags, PollProperties poll)
|
||||||
=> await SendFilesAsync(attachments, text, isTTS, embed, options, allowedMentions, messageReference, components, stickers, embeds, flags).ConfigureAwait(false);
|
=> await SendFilesAsync(attachments, text, isTTS, embed, options, allowedMentions, messageReference, components, stickers, embeds, flags, poll).ConfigureAwait(false);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options,
|
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options,
|
||||||
AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent components,
|
AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent components,
|
||||||
ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
ISticker[] stickers, Embed[] embeds, MessageFlags flags, PollProperties poll)
|
||||||
=> await SendMessageAsync(text, isTTS, embed, options, allowedMentions, messageReference, components, stickers, embeds, flags).ConfigureAwait(false);
|
=> await SendMessageAsync(text, isTTS, embed, options, allowedMentions, messageReference, components, stickers, embeds, flags, poll).ConfigureAwait(false);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region IAudioChannel
|
#region IAudioChannel
|
||||||
|
|||||||
@@ -225,45 +225,45 @@ namespace Discord.WebSocket
|
|||||||
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/>, <see cref="MessageFlags.SuppressNotification"/> and <see cref="MessageFlags.None"/>.</exception>
|
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/>, <see cref="MessageFlags.SuppressNotification"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||||
public virtual Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null,
|
public virtual Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null,
|
||||||
RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null,
|
RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null,
|
||||||
MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
|
MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null, MessageFlags flags = MessageFlags.None, PollProperties poll = null)
|
||||||
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, allowedMentions, messageReference,
|
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, allowedMentions, messageReference,
|
||||||
components, stickers, options, embeds, flags);
|
components, stickers, options, embeds, flags, poll);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/>, <see cref="MessageFlags.SuppressNotification"/> and <see cref="MessageFlags.None"/>.</exception>
|
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/>, <see cref="MessageFlags.SuppressNotification"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||||
public virtual Task<RestUserMessage> SendFileAsync(string filePath, string text = null, bool isTTS = false, Embed embed = null,
|
public virtual Task<RestUserMessage> SendFileAsync(string filePath, string text = null, bool isTTS = false, Embed embed = null,
|
||||||
RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null,
|
RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null,
|
||||||
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
||||||
Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
|
Embed[] embeds = null, MessageFlags flags = MessageFlags.None, PollProperties poll = null)
|
||||||
=> ChannelHelper.SendFileAsync(this, Discord, filePath, text, isTTS, embed, allowedMentions, messageReference,
|
=> ChannelHelper.SendFileAsync(this, Discord, filePath, text, isTTS, embed, allowedMentions, messageReference,
|
||||||
components, stickers, options, isSpoiler, embeds, flags);
|
components, stickers, options, isSpoiler, embeds, flags, poll);
|
||||||
/// <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>
|
||||||
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/>, <see cref="MessageFlags.SuppressNotification"/> and <see cref="MessageFlags.None"/>.</exception>
|
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/>, <see cref="MessageFlags.SuppressNotification"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||||
public virtual Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text = null, bool isTTS = false,
|
public virtual Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text = null, bool isTTS = false,
|
||||||
Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null,
|
Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null,
|
||||||
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
||||||
Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
|
Embed[] embeds = null, MessageFlags flags = MessageFlags.None, PollProperties poll = null)
|
||||||
=> ChannelHelper.SendFileAsync(this, Discord, stream, filename, text, isTTS, embed, allowedMentions,
|
=> ChannelHelper.SendFileAsync(this, Discord, stream, filename, text, isTTS, embed, allowedMentions,
|
||||||
messageReference, components, stickers, options, isSpoiler, embeds, flags);
|
messageReference, components, stickers, options, isSpoiler, embeds, flags, poll);
|
||||||
/// <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>
|
||||||
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/>, <see cref="MessageFlags.SuppressNotification"/> and <see cref="MessageFlags.None"/>.</exception>
|
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/>, <see cref="MessageFlags.SuppressNotification"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||||
public virtual Task<RestUserMessage> SendFileAsync(FileAttachment attachment, string text = null, bool isTTS = false,
|
public virtual Task<RestUserMessage> SendFileAsync(FileAttachment attachment, string text = null, bool isTTS = false,
|
||||||
Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null,
|
Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null,
|
||||||
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
||||||
Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
|
Embed[] embeds = null, MessageFlags flags = MessageFlags.None, PollProperties poll = null)
|
||||||
=> ChannelHelper.SendFileAsync(this, Discord, attachment, text, isTTS, embed, allowedMentions,
|
=> ChannelHelper.SendFileAsync(this, Discord, attachment, text, isTTS, embed, allowedMentions,
|
||||||
messageReference, components, stickers, options, embeds, flags);
|
messageReference, components, stickers, options, embeds, flags, poll);
|
||||||
/// <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>
|
||||||
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/>, <see cref="MessageFlags.SuppressNotification"/> and <see cref="MessageFlags.None"/>.</exception>
|
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/>, <see cref="MessageFlags.SuppressNotification"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||||
public virtual Task<RestUserMessage> SendFilesAsync(IEnumerable<FileAttachment> attachments, string text = null, bool isTTS = false,
|
public virtual Task<RestUserMessage> SendFilesAsync(IEnumerable<FileAttachment> attachments, string text = null, bool isTTS = false,
|
||||||
Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null,
|
Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null,
|
||||||
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
||||||
Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
|
Embed[] embeds = null, MessageFlags flags = MessageFlags.None, PollProperties poll = null)
|
||||||
=> ChannelHelper.SendFilesAsync(this, Discord, attachments, text, isTTS, embed, allowedMentions,
|
=> ChannelHelper.SendFilesAsync(this, Discord, attachments, text, isTTS, embed, allowedMentions,
|
||||||
messageReference, components, stickers, options, embeds, flags);
|
messageReference, components, stickers, options, embeds, flags, poll);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public virtual Task DeleteMessagesAsync(IEnumerable<IMessage> messages, RequestOptions options = null)
|
public virtual Task DeleteMessagesAsync(IEnumerable<IMessage> messages, RequestOptions options = null)
|
||||||
@@ -436,35 +436,35 @@ namespace Discord.WebSocket
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(string filePath, string text, bool isTTS, Embed embed,
|
async Task<IUserMessage> IMessageChannel.SendFileAsync(string filePath, string text, bool isTTS, Embed embed,
|
||||||
RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference,
|
RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference,
|
||||||
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags, PollProperties poll)
|
||||||
=> await SendFileAsync(filePath, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference,
|
=> await SendFileAsync(filePath, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference,
|
||||||
components, stickers, embeds, flags).ConfigureAwait(false);
|
components, stickers, embeds, flags, poll).ConfigureAwait(false);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS,
|
async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS,
|
||||||
Embed embed, RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference,
|
Embed embed, RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference,
|
||||||
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags, PollProperties poll)
|
||||||
=> await SendFileAsync(stream, filename, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference,
|
=> await SendFileAsync(stream, filename, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference,
|
||||||
components, stickers, embeds, flags).ConfigureAwait(false);
|
components, stickers, embeds, flags, poll).ConfigureAwait(false);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(FileAttachment attachment, string text, bool isTTS,
|
async Task<IUserMessage> IMessageChannel.SendFileAsync(FileAttachment attachment, string text, bool isTTS,
|
||||||
Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference,
|
Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference,
|
||||||
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags, PollProperties poll)
|
||||||
=> await SendFileAsync(attachment, text, isTTS, embed, options, allowedMentions, messageReference, components,
|
=> await SendFileAsync(attachment, text, isTTS, embed, options, allowedMentions, messageReference, components,
|
||||||
stickers, embeds, flags).ConfigureAwait(false);
|
stickers, embeds, flags, poll).ConfigureAwait(false);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
async Task<IUserMessage> IMessageChannel.SendFilesAsync(IEnumerable<FileAttachment> attachments, string text,
|
async Task<IUserMessage> IMessageChannel.SendFilesAsync(IEnumerable<FileAttachment> attachments, string text,
|
||||||
bool isTTS, Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference,
|
bool isTTS, Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference,
|
||||||
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags, PollProperties poll)
|
||||||
=> await SendFilesAsync(attachments, text, isTTS, embed, options, allowedMentions, messageReference, components, stickers, embeds, flags).ConfigureAwait(false);
|
=> await SendFilesAsync(attachments, text, isTTS, embed, options, allowedMentions, messageReference, components, stickers, embeds, flags, poll).ConfigureAwait(false);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options,
|
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options,
|
||||||
AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent components,
|
AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent components,
|
||||||
ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
ISticker[] stickers, Embed[] embeds, MessageFlags flags, PollProperties poll)
|
||||||
=> await SendMessageAsync(text, isTTS, embed, options, allowedMentions, messageReference, components, stickers, embeds, flags).ConfigureAwait(false);
|
=> await SendMessageAsync(text, isTTS, embed, options, allowedMentions, messageReference, components, stickers, embeds, flags, poll).ConfigureAwait(false);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using Discord.API.Rest;
|
||||||
using Discord.Net.Rest;
|
using Discord.Net.Rest;
|
||||||
using Discord.Rest;
|
using Discord.Rest;
|
||||||
using System;
|
using System;
|
||||||
@@ -80,7 +81,8 @@ namespace Discord.WebSocket
|
|||||||
AllowedMentions allowedMentions = null,
|
AllowedMentions allowedMentions = null,
|
||||||
MessageComponent components = null,
|
MessageComponent components = null,
|
||||||
Embed embed = null,
|
Embed embed = null,
|
||||||
RequestOptions options = null)
|
RequestOptions options = null,
|
||||||
|
PollProperties poll = null)
|
||||||
{
|
{
|
||||||
if (!IsValidToken)
|
if (!IsValidToken)
|
||||||
throw new InvalidOperationException("Interaction token is no longer valid");
|
throw new InvalidOperationException("Interaction token is no longer valid");
|
||||||
@@ -95,6 +97,7 @@ namespace Discord.WebSocket
|
|||||||
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, 10, nameof(embeds), "A max of 10 embeds are allowed.");
|
Preconditions.AtMost(embeds.Length, 10, nameof(embeds), "A max of 10 embeds are allowed.");
|
||||||
|
Preconditions.ValidatePoll(poll);
|
||||||
|
|
||||||
// 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)
|
||||||
@@ -120,7 +123,8 @@ namespace Discord.WebSocket
|
|||||||
Embeds = embeds.Any() ? embeds.Select(x => x.ToModel()).ToArray() : Optional<API.Embed[]>.Unspecified,
|
Embeds = embeds.Any() ? embeds.Select(x => x.ToModel()).ToArray() : Optional<API.Embed[]>.Unspecified,
|
||||||
IsTTS = isTTS,
|
IsTTS = isTTS,
|
||||||
MessageComponents = components?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ?? Optional<API.ActionRowComponent[]>.Unspecified,
|
MessageComponents = components?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ?? Optional<API.ActionRowComponent[]>.Unspecified,
|
||||||
Flags = ephemeral ? MessageFlags.Ephemeral : Optional<MessageFlags>.Unspecified
|
Flags = ephemeral ? MessageFlags.Ephemeral : Optional<MessageFlags>.Unspecified,
|
||||||
|
Poll = poll?.ToModel() ?? Optional<CreatePollParams>.Unspecified
|
||||||
};
|
};
|
||||||
|
|
||||||
lock (_lock)
|
lock (_lock)
|
||||||
@@ -144,7 +148,8 @@ namespace Discord.WebSocket
|
|||||||
AllowedMentions allowedMentions = null,
|
AllowedMentions allowedMentions = null,
|
||||||
MessageComponent components = null,
|
MessageComponent components = null,
|
||||||
Embed embed = null,
|
Embed embed = null,
|
||||||
RequestOptions options = null)
|
RequestOptions options = null,
|
||||||
|
PollProperties poll = null)
|
||||||
{
|
{
|
||||||
if (!IsValidToken)
|
if (!IsValidToken)
|
||||||
throw new InvalidOperationException("Interaction token is no longer valid");
|
throw new InvalidOperationException("Interaction token is no longer valid");
|
||||||
@@ -159,6 +164,7 @@ namespace Discord.WebSocket
|
|||||||
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, 10, nameof(embeds), "A max of 10 embeds are allowed.");
|
Preconditions.AtMost(embeds.Length, 10, nameof(embeds), "A max of 10 embeds are allowed.");
|
||||||
|
Preconditions.ValidatePoll(poll);
|
||||||
|
|
||||||
// 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)
|
||||||
@@ -186,7 +192,8 @@ namespace Discord.WebSocket
|
|||||||
Embeds = embeds.Select(x => x.ToModel()).ToArray(),
|
Embeds = embeds.Select(x => x.ToModel()).ToArray(),
|
||||||
TTS = isTTS,
|
TTS = isTTS,
|
||||||
Flags = ephemeral ? MessageFlags.Ephemeral : Optional<MessageFlags>.Unspecified,
|
Flags = ephemeral ? MessageFlags.Ephemeral : Optional<MessageFlags>.Unspecified,
|
||||||
Components = components?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ?? Optional<API.ActionRowComponent[]>.Unspecified
|
Components = components?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ?? Optional<API.ActionRowComponent[]>.Unspecified,
|
||||||
|
Poll = poll?.ToModel() ?? Optional<CreatePollParams>.Unspecified
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -313,7 +320,8 @@ namespace Discord.WebSocket
|
|||||||
AllowedMentions allowedMentions = null,
|
AllowedMentions allowedMentions = null,
|
||||||
MessageComponent components = null,
|
MessageComponent components = null,
|
||||||
Embed embed = null,
|
Embed embed = null,
|
||||||
RequestOptions options = null)
|
RequestOptions options = null,
|
||||||
|
PollProperties poll = null)
|
||||||
{
|
{
|
||||||
if (!IsValidToken)
|
if (!IsValidToken)
|
||||||
throw new InvalidOperationException("Interaction token is no longer valid");
|
throw new InvalidOperationException("Interaction token is no longer valid");
|
||||||
@@ -325,6 +333,7 @@ namespace Discord.WebSocket
|
|||||||
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, 10, nameof(embeds), "A max of 10 embeds are allowed.");
|
Preconditions.AtMost(embeds.Length, 10, nameof(embeds), "A max of 10 embeds are allowed.");
|
||||||
|
Preconditions.ValidatePoll(poll);
|
||||||
|
|
||||||
var args = new API.Rest.CreateWebhookMessageParams
|
var args = new API.Rest.CreateWebhookMessageParams
|
||||||
{
|
{
|
||||||
@@ -332,7 +341,8 @@ namespace Discord.WebSocket
|
|||||||
AllowedMentions = allowedMentions?.ToModel() ?? Optional<API.AllowedMentions>.Unspecified,
|
AllowedMentions = allowedMentions?.ToModel() ?? Optional<API.AllowedMentions>.Unspecified,
|
||||||
IsTTS = isTTS,
|
IsTTS = isTTS,
|
||||||
Embeds = embeds.Select(x => x.ToModel()).ToArray(),
|
Embeds = embeds.Select(x => x.ToModel()).ToArray(),
|
||||||
Components = components?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ?? Optional<API.ActionRowComponent[]>.Unspecified
|
Components = components?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ?? Optional<API.ActionRowComponent[]>.Unspecified,
|
||||||
|
Poll = poll?.ToModel() ?? Optional<CreatePollParams>.Unspecified
|
||||||
};
|
};
|
||||||
|
|
||||||
if (ephemeral)
|
if (ephemeral)
|
||||||
@@ -351,7 +361,8 @@ namespace Discord.WebSocket
|
|||||||
AllowedMentions allowedMentions = null,
|
AllowedMentions allowedMentions = null,
|
||||||
MessageComponent components = null,
|
MessageComponent components = null,
|
||||||
Embed embed = null,
|
Embed embed = null,
|
||||||
RequestOptions options = null)
|
RequestOptions options = null,
|
||||||
|
PollProperties poll = null)
|
||||||
{
|
{
|
||||||
if (!IsValidToken)
|
if (!IsValidToken)
|
||||||
throw new InvalidOperationException("Interaction token is no longer valid");
|
throw new InvalidOperationException("Interaction token is no longer valid");
|
||||||
@@ -363,6 +374,7 @@ namespace Discord.WebSocket
|
|||||||
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, 10, nameof(embeds), "A max of 10 embeds are allowed.");
|
Preconditions.AtMost(embeds.Length, 10, nameof(embeds), "A max of 10 embeds are allowed.");
|
||||||
|
Preconditions.ValidatePoll(poll);
|
||||||
|
|
||||||
foreach (var attachment in attachments)
|
foreach (var attachment in attachments)
|
||||||
{
|
{
|
||||||
@@ -390,7 +402,16 @@ namespace Discord.WebSocket
|
|||||||
if (ephemeral)
|
if (ephemeral)
|
||||||
flags |= MessageFlags.Ephemeral;
|
flags |= MessageFlags.Ephemeral;
|
||||||
|
|
||||||
var args = new API.Rest.UploadWebhookFileParams(attachments.ToArray()) { Flags = flags, Content = text, IsTTS = isTTS, Embeds = embeds.Any() ? embeds.Select(x => x.ToModel()).ToArray() : Optional<API.Embed[]>.Unspecified, AllowedMentions = allowedMentions?.ToModel() ?? Optional<API.AllowedMentions>.Unspecified, MessageComponents = components?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ?? Optional<API.ActionRowComponent[]>.Unspecified };
|
var args = new API.Rest.UploadWebhookFileParams(attachments.ToArray())
|
||||||
|
{
|
||||||
|
Flags = flags,
|
||||||
|
Content = text,
|
||||||
|
IsTTS = isTTS,
|
||||||
|
Embeds = embeds.Any() ? embeds.Select(x => x.ToModel()).ToArray() : Optional<API.Embed[]>.Unspecified,
|
||||||
|
AllowedMentions = allowedMentions?.ToModel() ?? Optional<API.AllowedMentions>.Unspecified,
|
||||||
|
MessageComponents = components?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ?? Optional<API.ActionRowComponent[]>.Unspecified,
|
||||||
|
Poll = poll?.ToModel() ?? Optional<CreatePollParams>.Unspecified
|
||||||
|
};
|
||||||
return InteractionHelper.SendFollowupAsync(Discord, args, Token, Channel, options);
|
return InteractionHelper.SendFollowupAsync(Discord, args, Token, Channel, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using Discord.API.Rest;
|
||||||
using Discord.Net.Rest;
|
using Discord.Net.Rest;
|
||||||
using Discord.Rest;
|
using Discord.Rest;
|
||||||
|
|
||||||
@@ -77,7 +78,8 @@ namespace Discord.WebSocket
|
|||||||
AllowedMentions allowedMentions = null,
|
AllowedMentions allowedMentions = null,
|
||||||
MessageComponent components = null,
|
MessageComponent components = null,
|
||||||
Embed embed = null,
|
Embed embed = null,
|
||||||
RequestOptions options = null)
|
RequestOptions options = null,
|
||||||
|
PollProperties poll = null)
|
||||||
{
|
{
|
||||||
if (!IsValidToken)
|
if (!IsValidToken)
|
||||||
throw new InvalidOperationException("Interaction token is no longer valid");
|
throw new InvalidOperationException("Interaction token is no longer valid");
|
||||||
@@ -92,6 +94,7 @@ namespace Discord.WebSocket
|
|||||||
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, 10, nameof(embeds), "A max of 10 embeds are allowed.");
|
Preconditions.AtMost(embeds.Length, 10, nameof(embeds), "A max of 10 embeds are allowed.");
|
||||||
|
Preconditions.ValidatePoll(poll);
|
||||||
|
|
||||||
// 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)
|
||||||
@@ -117,7 +120,8 @@ namespace Discord.WebSocket
|
|||||||
Embeds = embeds.Any() ? embeds.Select(x => x.ToModel()).ToArray() : Optional<API.Embed[]>.Unspecified,
|
Embeds = embeds.Any() ? embeds.Select(x => x.ToModel()).ToArray() : Optional<API.Embed[]>.Unspecified,
|
||||||
IsTTS = isTTS,
|
IsTTS = isTTS,
|
||||||
MessageComponents = components?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ?? Optional<API.ActionRowComponent[]>.Unspecified,
|
MessageComponents = components?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ?? Optional<API.ActionRowComponent[]>.Unspecified,
|
||||||
Flags = ephemeral ? MessageFlags.Ephemeral : Optional<MessageFlags>.Unspecified
|
Flags = ephemeral ? MessageFlags.Ephemeral : Optional<MessageFlags>.Unspecified,
|
||||||
|
Poll = poll?.ToModel() ?? Optional<CreatePollParams>.Unspecified
|
||||||
};
|
};
|
||||||
|
|
||||||
lock (_lock)
|
lock (_lock)
|
||||||
@@ -141,7 +145,8 @@ namespace Discord.WebSocket
|
|||||||
AllowedMentions allowedMentions = null,
|
AllowedMentions allowedMentions = null,
|
||||||
MessageComponent components = null,
|
MessageComponent components = null,
|
||||||
Embed embed = null,
|
Embed embed = null,
|
||||||
RequestOptions options = null)
|
RequestOptions options = null,
|
||||||
|
PollProperties poll = null)
|
||||||
{
|
{
|
||||||
if (!IsValidToken)
|
if (!IsValidToken)
|
||||||
throw new InvalidOperationException("Interaction token is no longer valid");
|
throw new InvalidOperationException("Interaction token is no longer valid");
|
||||||
@@ -156,6 +161,7 @@ namespace Discord.WebSocket
|
|||||||
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, 10, nameof(embeds), "A max of 10 embeds are allowed.");
|
Preconditions.AtMost(embeds.Length, 10, nameof(embeds), "A max of 10 embeds are allowed.");
|
||||||
|
Preconditions.ValidatePoll(poll);
|
||||||
|
|
||||||
// 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)
|
||||||
@@ -183,7 +189,8 @@ namespace Discord.WebSocket
|
|||||||
Embeds = embeds.Select(x => x.ToModel()).ToArray(),
|
Embeds = embeds.Select(x => x.ToModel()).ToArray(),
|
||||||
TTS = isTTS,
|
TTS = isTTS,
|
||||||
Flags = ephemeral ? MessageFlags.Ephemeral : Optional<MessageFlags>.Unspecified,
|
Flags = ephemeral ? MessageFlags.Ephemeral : Optional<MessageFlags>.Unspecified,
|
||||||
Components = components?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ?? Optional<API.ActionRowComponent[]>.Unspecified
|
Components = components?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ?? Optional<API.ActionRowComponent[]>.Unspecified,
|
||||||
|
Poll = poll?.ToModel() ?? Optional<CreatePollParams>.Unspecified
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -310,7 +317,8 @@ namespace Discord.WebSocket
|
|||||||
AllowedMentions allowedMentions = null,
|
AllowedMentions allowedMentions = null,
|
||||||
MessageComponent components = null,
|
MessageComponent components = null,
|
||||||
Embed embed = null,
|
Embed embed = null,
|
||||||
RequestOptions options = null)
|
RequestOptions options = null,
|
||||||
|
PollProperties poll = null)
|
||||||
{
|
{
|
||||||
if (!IsValidToken)
|
if (!IsValidToken)
|
||||||
throw new InvalidOperationException("Interaction token is no longer valid");
|
throw new InvalidOperationException("Interaction token is no longer valid");
|
||||||
@@ -322,6 +330,7 @@ namespace Discord.WebSocket
|
|||||||
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, 10, nameof(embeds), "A max of 10 embeds are allowed.");
|
Preconditions.AtMost(embeds.Length, 10, nameof(embeds), "A max of 10 embeds are allowed.");
|
||||||
|
Preconditions.ValidatePoll(poll);
|
||||||
|
|
||||||
var args = new API.Rest.CreateWebhookMessageParams
|
var args = new API.Rest.CreateWebhookMessageParams
|
||||||
{
|
{
|
||||||
@@ -329,7 +338,9 @@ namespace Discord.WebSocket
|
|||||||
AllowedMentions = allowedMentions?.ToModel() ?? Optional<API.AllowedMentions>.Unspecified,
|
AllowedMentions = allowedMentions?.ToModel() ?? Optional<API.AllowedMentions>.Unspecified,
|
||||||
IsTTS = isTTS,
|
IsTTS = isTTS,
|
||||||
Embeds = embeds.Select(x => x.ToModel()).ToArray(),
|
Embeds = embeds.Select(x => x.ToModel()).ToArray(),
|
||||||
Components = components?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ?? Optional<API.ActionRowComponent[]>.Unspecified
|
Components = components?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ?? Optional<API.ActionRowComponent[]>.Unspecified,
|
||||||
|
Flags = ephemeral ? MessageFlags.Ephemeral : Optional<MessageFlags>.Unspecified,
|
||||||
|
Poll = poll?.ToModel() ?? Optional<CreatePollParams>.Unspecified
|
||||||
};
|
};
|
||||||
|
|
||||||
if (ephemeral)
|
if (ephemeral)
|
||||||
@@ -348,7 +359,8 @@ namespace Discord.WebSocket
|
|||||||
AllowedMentions allowedMentions = null,
|
AllowedMentions allowedMentions = null,
|
||||||
MessageComponent components = null,
|
MessageComponent components = null,
|
||||||
Embed embed = null,
|
Embed embed = null,
|
||||||
RequestOptions options = null)
|
RequestOptions options = null,
|
||||||
|
PollProperties poll = null)
|
||||||
{
|
{
|
||||||
if (!IsValidToken)
|
if (!IsValidToken)
|
||||||
throw new InvalidOperationException("Interaction token is no longer valid");
|
throw new InvalidOperationException("Interaction token is no longer valid");
|
||||||
@@ -360,6 +372,7 @@ namespace Discord.WebSocket
|
|||||||
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, 10, nameof(embeds), "A max of 10 embeds are allowed.");
|
Preconditions.AtMost(embeds.Length, 10, nameof(embeds), "A max of 10 embeds are allowed.");
|
||||||
|
Preconditions.ValidatePoll(poll);
|
||||||
|
|
||||||
foreach (var attachment in attachments)
|
foreach (var attachment in attachments)
|
||||||
{
|
{
|
||||||
@@ -387,7 +400,16 @@ namespace Discord.WebSocket
|
|||||||
if (ephemeral)
|
if (ephemeral)
|
||||||
flags |= MessageFlags.Ephemeral;
|
flags |= MessageFlags.Ephemeral;
|
||||||
|
|
||||||
var args = new API.Rest.UploadWebhookFileParams(attachments.ToArray()) { Flags = flags, Content = text, IsTTS = isTTS, Embeds = embeds.Any() ? embeds.Select(x => x.ToModel()).ToArray() : Optional<API.Embed[]>.Unspecified, AllowedMentions = allowedMentions?.ToModel() ?? Optional<API.AllowedMentions>.Unspecified, MessageComponents = components?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ?? Optional<API.ActionRowComponent[]>.Unspecified };
|
var args = new API.Rest.UploadWebhookFileParams(attachments.ToArray())
|
||||||
|
{
|
||||||
|
Flags = flags,
|
||||||
|
Content = text,
|
||||||
|
IsTTS = isTTS,
|
||||||
|
Embeds = embeds.Any() ? embeds.Select(x => x.ToModel()).ToArray() : Optional<API.Embed[]>.Unspecified,
|
||||||
|
AllowedMentions = allowedMentions?.ToModel() ?? Optional<API.AllowedMentions>.Unspecified,
|
||||||
|
MessageComponents = components?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ?? Optional<API.ActionRowComponent[]>.Unspecified,
|
||||||
|
Poll = poll?.ToModel() ?? Optional<CreatePollParams>.Unspecified
|
||||||
|
};
|
||||||
return InteractionHelper.SendFollowupAsync(Discord, args, Token, Channel, options);
|
return InteractionHelper.SendFollowupAsync(Discord, args, Token, Channel, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -91,15 +91,15 @@ namespace Discord.WebSocket
|
|||||||
/// </returns>
|
/// </returns>
|
||||||
public Task RespondAsync(RequestOptions options = null, params AutocompleteResult[] result)
|
public Task RespondAsync(RequestOptions options = null, params AutocompleteResult[] result)
|
||||||
=> RespondAsync(result, options);
|
=> RespondAsync(result, options);
|
||||||
public override Task RespondAsync(string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null)
|
public override Task RespondAsync(string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null)
|
||||||
=> throw new NotSupportedException("Autocomplete interactions don't support this method!");
|
=> throw new NotSupportedException("Autocomplete interactions don't support this method!");
|
||||||
public override Task<RestFollowupMessage> FollowupAsync(string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null)
|
public override Task<RestFollowupMessage> FollowupAsync(string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null)
|
||||||
=> throw new NotSupportedException("Autocomplete interactions don't support this method!");
|
=> throw new NotSupportedException("Autocomplete interactions don't support this method!");
|
||||||
public override Task<RestFollowupMessage> FollowupWithFilesAsync(IEnumerable<FileAttachment> attachments, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null)
|
public override Task<RestFollowupMessage> FollowupWithFilesAsync(IEnumerable<FileAttachment> attachments, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null)
|
||||||
=> throw new NotSupportedException("Autocomplete interactions don't support this method!");
|
=> throw new NotSupportedException("Autocomplete interactions don't support this method!");
|
||||||
public override Task DeferAsync(bool ephemeral = false, RequestOptions options = null)
|
public override Task DeferAsync(bool ephemeral = false, RequestOptions options = null)
|
||||||
=> throw new NotSupportedException("Autocomplete interactions don't support this method!");
|
=> throw new NotSupportedException("Autocomplete interactions don't support this method!");
|
||||||
public override Task RespondWithFilesAsync(IEnumerable<FileAttachment> attachments, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null)
|
public override Task RespondWithFilesAsync(IEnumerable<FileAttachment> attachments, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null)
|
||||||
=> throw new NotSupportedException("Autocomplete interactions don't support this method!");
|
=> throw new NotSupportedException("Autocomplete interactions don't support this method!");
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using Discord.API.Rest;
|
||||||
using Discord.Rest;
|
using Discord.Rest;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -75,7 +76,8 @@ namespace Discord.WebSocket
|
|||||||
AllowedMentions allowedMentions = null,
|
AllowedMentions allowedMentions = null,
|
||||||
MessageComponent components = null,
|
MessageComponent components = null,
|
||||||
Embed embed = null,
|
Embed embed = null,
|
||||||
RequestOptions options = null)
|
RequestOptions options = null,
|
||||||
|
PollProperties poll = null)
|
||||||
{
|
{
|
||||||
if (!IsValidToken)
|
if (!IsValidToken)
|
||||||
throw new InvalidOperationException("Interaction token is no longer valid");
|
throw new InvalidOperationException("Interaction token is no longer valid");
|
||||||
@@ -90,6 +92,7 @@ namespace Discord.WebSocket
|
|||||||
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, 10, nameof(embeds), "A max of 10 embeds are allowed.");
|
Preconditions.AtMost(embeds.Length, 10, nameof(embeds), "A max of 10 embeds are allowed.");
|
||||||
|
Preconditions.ValidatePoll(poll);
|
||||||
|
|
||||||
// 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)
|
||||||
@@ -117,7 +120,8 @@ namespace Discord.WebSocket
|
|||||||
Embeds = embeds.Select(x => x.ToModel()).ToArray(),
|
Embeds = embeds.Select(x => x.ToModel()).ToArray(),
|
||||||
TTS = isTTS,
|
TTS = isTTS,
|
||||||
Components = components?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ?? Optional<API.ActionRowComponent[]>.Unspecified,
|
Components = components?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ?? Optional<API.ActionRowComponent[]>.Unspecified,
|
||||||
Flags = ephemeral ? MessageFlags.Ephemeral : Optional<MessageFlags>.Unspecified
|
Flags = ephemeral ? MessageFlags.Ephemeral : Optional<MessageFlags>.Unspecified,
|
||||||
|
Poll = poll?.ToModel() ?? Optional<CreatePollParams>.Unspecified
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -178,7 +182,8 @@ namespace Discord.WebSocket
|
|||||||
AllowedMentions allowedMentions = null,
|
AllowedMentions allowedMentions = null,
|
||||||
MessageComponent components = null,
|
MessageComponent components = null,
|
||||||
Embed embed = null,
|
Embed embed = null,
|
||||||
RequestOptions options = null)
|
RequestOptions options = null,
|
||||||
|
PollProperties poll = null)
|
||||||
{
|
{
|
||||||
if (!IsValidToken)
|
if (!IsValidToken)
|
||||||
throw new InvalidOperationException("Interaction token is no longer valid");
|
throw new InvalidOperationException("Interaction token is no longer valid");
|
||||||
@@ -193,6 +198,7 @@ namespace Discord.WebSocket
|
|||||||
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, 10, nameof(embeds), "A max of 10 embeds are allowed.");
|
Preconditions.AtMost(embeds.Length, 10, nameof(embeds), "A max of 10 embeds are allowed.");
|
||||||
|
Preconditions.ValidatePoll(poll);
|
||||||
|
|
||||||
// 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)
|
||||||
@@ -218,7 +224,8 @@ namespace Discord.WebSocket
|
|||||||
Embeds = embeds.Any() ? embeds.Select(x => x.ToModel()).ToArray() : Optional<API.Embed[]>.Unspecified,
|
Embeds = embeds.Any() ? embeds.Select(x => x.ToModel()).ToArray() : Optional<API.Embed[]>.Unspecified,
|
||||||
IsTTS = isTTS,
|
IsTTS = isTTS,
|
||||||
Flags = ephemeral ? MessageFlags.Ephemeral : Optional<MessageFlags>.Unspecified,
|
Flags = ephemeral ? MessageFlags.Ephemeral : Optional<MessageFlags>.Unspecified,
|
||||||
MessageComponents = components?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ?? Optional<API.ActionRowComponent[]>.Unspecified
|
MessageComponents = components?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ?? Optional<API.ActionRowComponent[]>.Unspecified,
|
||||||
|
Poll = poll?.ToModel() ?? Optional<CreatePollParams>.Unspecified
|
||||||
};
|
};
|
||||||
|
|
||||||
lock (_lock)
|
lock (_lock)
|
||||||
@@ -242,7 +249,8 @@ namespace Discord.WebSocket
|
|||||||
AllowedMentions allowedMentions = null,
|
AllowedMentions allowedMentions = null,
|
||||||
MessageComponent components = null,
|
MessageComponent components = null,
|
||||||
Embed embed = null,
|
Embed embed = null,
|
||||||
RequestOptions options = null)
|
RequestOptions options = null,
|
||||||
|
PollProperties poll = null)
|
||||||
{
|
{
|
||||||
if (!IsValidToken)
|
if (!IsValidToken)
|
||||||
throw new InvalidOperationException("Interaction token is no longer valid");
|
throw new InvalidOperationException("Interaction token is no longer valid");
|
||||||
@@ -254,6 +262,7 @@ namespace Discord.WebSocket
|
|||||||
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, 10, nameof(embeds), "A max of 10 embeds are allowed.");
|
Preconditions.AtMost(embeds.Length, 10, nameof(embeds), "A max of 10 embeds are allowed.");
|
||||||
|
Preconditions.ValidatePoll(poll);
|
||||||
|
|
||||||
var args = new API.Rest.CreateWebhookMessageParams
|
var args = new API.Rest.CreateWebhookMessageParams
|
||||||
{
|
{
|
||||||
@@ -261,7 +270,8 @@ namespace Discord.WebSocket
|
|||||||
AllowedMentions = allowedMentions?.ToModel() ?? Optional<API.AllowedMentions>.Unspecified,
|
AllowedMentions = allowedMentions?.ToModel() ?? Optional<API.AllowedMentions>.Unspecified,
|
||||||
IsTTS = isTTS,
|
IsTTS = isTTS,
|
||||||
Embeds = embeds.Select(x => x.ToModel()).ToArray(),
|
Embeds = embeds.Select(x => x.ToModel()).ToArray(),
|
||||||
Components = components?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ?? Optional<API.ActionRowComponent[]>.Unspecified
|
Components = components?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ?? Optional<API.ActionRowComponent[]>.Unspecified,
|
||||||
|
Poll = poll?.ToModel() ?? Optional<CreatePollParams>.Unspecified
|
||||||
};
|
};
|
||||||
|
|
||||||
if (ephemeral)
|
if (ephemeral)
|
||||||
@@ -280,7 +290,8 @@ namespace Discord.WebSocket
|
|||||||
AllowedMentions allowedMentions = null,
|
AllowedMentions allowedMentions = null,
|
||||||
MessageComponent components = null,
|
MessageComponent components = null,
|
||||||
Embed embed = null,
|
Embed embed = null,
|
||||||
RequestOptions options = null)
|
RequestOptions options = null,
|
||||||
|
PollProperties poll = null)
|
||||||
{
|
{
|
||||||
if (!IsValidToken)
|
if (!IsValidToken)
|
||||||
throw new InvalidOperationException("Interaction token is no longer valid");
|
throw new InvalidOperationException("Interaction token is no longer valid");
|
||||||
@@ -292,6 +303,7 @@ namespace Discord.WebSocket
|
|||||||
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, 10, nameof(embeds), "A max of 10 embeds are allowed.");
|
Preconditions.AtMost(embeds.Length, 10, nameof(embeds), "A max of 10 embeds are allowed.");
|
||||||
|
Preconditions.ValidatePoll(poll);
|
||||||
|
|
||||||
foreach (var attachment in attachments)
|
foreach (var attachment in attachments)
|
||||||
{
|
{
|
||||||
@@ -319,7 +331,16 @@ namespace Discord.WebSocket
|
|||||||
if (ephemeral)
|
if (ephemeral)
|
||||||
flags |= MessageFlags.Ephemeral;
|
flags |= MessageFlags.Ephemeral;
|
||||||
|
|
||||||
var args = new API.Rest.UploadWebhookFileParams(attachments.ToArray()) { Flags = flags, Content = text, IsTTS = isTTS, Embeds = embeds.Any() ? embeds.Select(x => x.ToModel()).ToArray() : Optional<API.Embed[]>.Unspecified, AllowedMentions = allowedMentions?.ToModel() ?? Optional<API.AllowedMentions>.Unspecified, MessageComponents = components?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ?? Optional<API.ActionRowComponent[]>.Unspecified };
|
var args = new API.Rest.UploadWebhookFileParams(attachments.ToArray())
|
||||||
|
{
|
||||||
|
Flags = flags,
|
||||||
|
Content = text,
|
||||||
|
IsTTS = isTTS,
|
||||||
|
Embeds = embeds.Any() ? embeds.Select(x => x.ToModel()).ToArray() : Optional<API.Embed[]>.Unspecified,
|
||||||
|
AllowedMentions = allowedMentions?.ToModel() ?? Optional<API.AllowedMentions>.Unspecified,
|
||||||
|
MessageComponents = components?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ?? Optional<API.ActionRowComponent[]>.Unspecified,
|
||||||
|
Poll = poll?.ToModel() ?? Optional<CreatePollParams>.Unspecified
|
||||||
|
};
|
||||||
return InteractionHelper.SendFollowupAsync(Discord, args, Token, Channel, options);
|
return InteractionHelper.SendFollowupAsync(Discord, args, Token, Channel, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -207,10 +207,11 @@ namespace Discord.WebSocket
|
|||||||
/// <param name="components">A <see cref="MessageComponent"/> to be sent with this response.</param>
|
/// <param name="components">A <see cref="MessageComponent"/> to be sent with this response.</param>
|
||||||
/// <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
|
/// <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
|
||||||
/// <param name="options">The request options for this response.</param>
|
/// <param name="options">The request options for this response.</param>
|
||||||
|
/// <param name="poll">A poll to send with the message.</param>
|
||||||
/// <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>
|
||||||
/// <exception cref="InvalidOperationException">The parameters provided were invalid or the token was invalid.</exception>
|
/// <exception cref="InvalidOperationException">The parameters provided were invalid or the token was invalid.</exception>
|
||||||
public abstract Task RespondAsync(string text = null, Embed[] embeds = null, bool isTTS = false,
|
public abstract Task RespondAsync(string text = null, Embed[] embeds = null, bool isTTS = false,
|
||||||
bool ephemeral = false, AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null);
|
bool ephemeral = false, AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Responds to this interaction with a file attachment.
|
/// Responds to this interaction with a file attachment.
|
||||||
@@ -225,16 +226,17 @@ namespace Discord.WebSocket
|
|||||||
/// <param name="components">A <see cref="MessageComponent"/> to be sent with this response.</param>
|
/// <param name="components">A <see cref="MessageComponent"/> to be sent with this response.</param>
|
||||||
/// <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
|
/// <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
|
||||||
/// <param name="options">The request options for this response.</param>
|
/// <param name="options">The request options for this response.</param>
|
||||||
|
/// <param name="poll">A poll to send with the message.</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>
|
||||||
public async Task RespondWithFileAsync(Stream fileStream, string fileName, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
public async Task RespondWithFileAsync(Stream fileStream, string fileName, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
||||||
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null)
|
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null)
|
||||||
{
|
{
|
||||||
using (var file = new FileAttachment(fileStream, fileName))
|
using (var file = new FileAttachment(fileStream, fileName))
|
||||||
{
|
{
|
||||||
await RespondWithFileAsync(file, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options).ConfigureAwait(false);
|
await RespondWithFileAsync(file, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options, poll).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -249,6 +251,7 @@ namespace Discord.WebSocket
|
|||||||
/// <param name="ephemeral"><see langword="true"/> if the response should be hidden to everyone besides the invoker of the command, otherwise <see langword="false"/>.</param>
|
/// <param name="ephemeral"><see langword="true"/> if the response should be hidden to everyone besides the invoker of the command, otherwise <see langword="false"/>.</param>
|
||||||
/// <param name="allowedMentions">The allowed mentions for this response.</param>
|
/// <param name="allowedMentions">The allowed mentions for this response.</param>
|
||||||
/// <param name="options">The request options for this response.</param>
|
/// <param name="options">The request options for this response.</param>
|
||||||
|
/// <param name="poll">A poll to send with the message.</param>
|
||||||
/// <param name="components">A <see cref="MessageComponent"/> to be sent with this response.</param>
|
/// <param name="components">A <see cref="MessageComponent"/> to be sent with this response.</param>
|
||||||
/// <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
|
/// <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
|
||||||
/// <returns>
|
/// <returns>
|
||||||
@@ -256,11 +259,11 @@ namespace Discord.WebSocket
|
|||||||
/// contains the sent message.
|
/// contains the sent message.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
public async Task RespondWithFileAsync(string filePath, string fileName = null, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
public async Task RespondWithFileAsync(string filePath, string fileName = null, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
||||||
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null)
|
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null)
|
||||||
{
|
{
|
||||||
using (var file = new FileAttachment(filePath, fileName))
|
using (var file = new FileAttachment(filePath, fileName))
|
||||||
{
|
{
|
||||||
await RespondWithFileAsync(file, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options).ConfigureAwait(false);
|
await RespondWithFileAsync(file, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options, poll).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -274,6 +277,7 @@ namespace Discord.WebSocket
|
|||||||
/// <param name="ephemeral"><see langword="true"/> if the response should be hidden to everyone besides the invoker of the command, otherwise <see langword="false"/>.</param>
|
/// <param name="ephemeral"><see langword="true"/> if the response should be hidden to everyone besides the invoker of the command, otherwise <see langword="false"/>.</param>
|
||||||
/// <param name="allowedMentions">The allowed mentions for this response.</param>
|
/// <param name="allowedMentions">The allowed mentions for this response.</param>
|
||||||
/// <param name="options">The request options for this response.</param>
|
/// <param name="options">The request options for this response.</param>
|
||||||
|
/// <param name="poll">A poll to send with the message.</param>
|
||||||
/// <param name="components">A <see cref="MessageComponent"/> to be sent with this response.</param>
|
/// <param name="components">A <see cref="MessageComponent"/> to be sent with this response.</param>
|
||||||
/// <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
|
/// <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
|
||||||
/// <returns>
|
/// <returns>
|
||||||
@@ -281,8 +285,8 @@ namespace Discord.WebSocket
|
|||||||
/// contains the sent message.
|
/// contains the sent message.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
public Task RespondWithFileAsync(FileAttachment attachment, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
public Task RespondWithFileAsync(FileAttachment attachment, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
||||||
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null)
|
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null)
|
||||||
=> RespondWithFilesAsync(new FileAttachment[] { attachment }, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options);
|
=> RespondWithFilesAsync(new FileAttachment[] { attachment }, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options, poll);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Responds to this interaction with a collection of file attachments.
|
/// Responds to this interaction with a collection of file attachments.
|
||||||
@@ -294,6 +298,7 @@ namespace Discord.WebSocket
|
|||||||
/// <param name="ephemeral"><see langword="true"/> if the response should be hidden to everyone besides the invoker of the command, otherwise <see langword="false"/>.</param>
|
/// <param name="ephemeral"><see langword="true"/> if the response should be hidden to everyone besides the invoker of the command, otherwise <see langword="false"/>.</param>
|
||||||
/// <param name="allowedMentions">The allowed mentions for this response.</param>
|
/// <param name="allowedMentions">The allowed mentions for this response.</param>
|
||||||
/// <param name="options">The request options for this response.</param>
|
/// <param name="options">The request options for this response.</param>
|
||||||
|
/// <param name="poll">A poll to send with the message.</param>
|
||||||
/// <param name="components">A <see cref="MessageComponent"/> to be sent with this response.</param>
|
/// <param name="components">A <see cref="MessageComponent"/> to be sent with this response.</param>
|
||||||
/// <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
|
/// <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
|
||||||
/// <returns>
|
/// <returns>
|
||||||
@@ -301,7 +306,7 @@ namespace Discord.WebSocket
|
|||||||
/// contains the sent message.
|
/// contains the sent message.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
public abstract Task RespondWithFilesAsync(IEnumerable<FileAttachment> attachments, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
public abstract Task RespondWithFilesAsync(IEnumerable<FileAttachment> attachments, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
||||||
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null);
|
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sends a followup message for this interaction.
|
/// Sends a followup message for this interaction.
|
||||||
@@ -314,11 +319,12 @@ namespace Discord.WebSocket
|
|||||||
/// <param name="components">A <see cref="MessageComponent"/> to be sent with this response.</param>
|
/// <param name="components">A <see cref="MessageComponent"/> to be sent with this response.</param>
|
||||||
/// <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
|
/// <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
|
||||||
/// <param name="options">The request options for this response.</param>
|
/// <param name="options">The request options for this response.</param>
|
||||||
|
/// <param name="poll">A poll to send with the message.</param>
|
||||||
/// <returns>
|
/// <returns>
|
||||||
/// The sent message.
|
/// The sent message.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
public abstract Task<RestFollowupMessage> FollowupAsync(string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
public abstract Task<RestFollowupMessage> FollowupAsync(string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
||||||
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null);
|
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sends a followup message for this interaction.
|
/// Sends a followup message for this interaction.
|
||||||
@@ -333,15 +339,16 @@ namespace Discord.WebSocket
|
|||||||
/// <param name="components">A <see cref="MessageComponent"/> to be sent with this response.</param>
|
/// <param name="components">A <see cref="MessageComponent"/> to be sent with this response.</param>
|
||||||
/// <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
|
/// <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
|
||||||
/// <param name="options">The request options for this response.</param>
|
/// <param name="options">The request options for this response.</param>
|
||||||
|
/// <param name="poll">A poll to send with the message.</param>
|
||||||
/// <returns>
|
/// <returns>
|
||||||
/// The sent message.
|
/// The sent message.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
public async Task<RestFollowupMessage> FollowupWithFileAsync(Stream fileStream, string fileName, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
public async Task<RestFollowupMessage> FollowupWithFileAsync(Stream fileStream, string fileName, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
||||||
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null)
|
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null)
|
||||||
{
|
{
|
||||||
using (var file = new FileAttachment(fileStream, fileName))
|
using (var file = new FileAttachment(fileStream, fileName))
|
||||||
{
|
{
|
||||||
return await FollowupWithFileAsync(file, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options).ConfigureAwait(false);
|
return await FollowupWithFileAsync(file, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options, poll).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -358,15 +365,16 @@ namespace Discord.WebSocket
|
|||||||
/// <param name="components">A <see cref="MessageComponent"/> to be sent with this response.</param>
|
/// <param name="components">A <see cref="MessageComponent"/> to be sent with this response.</param>
|
||||||
/// <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
|
/// <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
|
||||||
/// <param name="options">The request options for this response.</param>
|
/// <param name="options">The request options for this response.</param>
|
||||||
|
/// <param name="poll">A poll to send with the message.</param>
|
||||||
/// <returns>
|
/// <returns>
|
||||||
/// The sent message.
|
/// The sent message.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
public async Task<RestFollowupMessage> FollowupWithFileAsync(string filePath, string fileName = null, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
public async Task<RestFollowupMessage> FollowupWithFileAsync(string filePath, string fileName = null, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
||||||
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null)
|
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null)
|
||||||
{
|
{
|
||||||
using (var file = new FileAttachment(filePath, fileName))
|
using (var file = new FileAttachment(filePath, fileName))
|
||||||
{
|
{
|
||||||
return await FollowupWithFileAsync(file, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options).ConfigureAwait(false);
|
return await FollowupWithFileAsync(file, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options, poll).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -382,13 +390,14 @@ namespace Discord.WebSocket
|
|||||||
/// <param name="options">The request options for this response.</param>
|
/// <param name="options">The request options for this response.</param>
|
||||||
/// <param name="components">A <see cref="MessageComponent"/> to be sent with this response.</param>
|
/// <param name="components">A <see cref="MessageComponent"/> to be sent with this response.</param>
|
||||||
/// <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
|
/// <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
|
||||||
|
/// <param name="poll">A poll to send with the message.</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>
|
||||||
public Task<RestFollowupMessage> FollowupWithFileAsync(FileAttachment attachment, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
public Task<RestFollowupMessage> FollowupWithFileAsync(FileAttachment attachment, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
||||||
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null)
|
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null)
|
||||||
=> FollowupWithFilesAsync(new FileAttachment[] { attachment }, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options);
|
=> FollowupWithFilesAsync(new FileAttachment[] { attachment }, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options, poll);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sends a followup message for this interaction.
|
/// Sends a followup message for this interaction.
|
||||||
@@ -402,12 +411,13 @@ namespace Discord.WebSocket
|
|||||||
/// <param name="options">The request options for this response.</param>
|
/// <param name="options">The request options for this response.</param>
|
||||||
/// <param name="components">A <see cref="MessageComponent"/> to be sent with this response.</param>
|
/// <param name="components">A <see cref="MessageComponent"/> to be sent with this response.</param>
|
||||||
/// <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
|
/// <param name="embed">A single embed to send with this response. If this is passed alongside an array of embeds, the single embed will be ignored.</param>
|
||||||
|
/// <param name="poll">A poll to send with the message.</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>
|
||||||
public abstract Task<RestFollowupMessage> FollowupWithFilesAsync(IEnumerable<FileAttachment> attachments, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
public abstract Task<RestFollowupMessage> FollowupWithFilesAsync(IEnumerable<FileAttachment> attachments, string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false,
|
||||||
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null);
|
AllowedMentions allowedMentions = null, MessageComponent components = null, Embed embed = null, RequestOptions options = null, PollProperties poll = null);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the original response for this interaction.
|
/// Gets the original response for this interaction.
|
||||||
@@ -493,24 +503,27 @@ namespace Discord.WebSocket
|
|||||||
async Task<IUserMessage> IDiscordInteraction.ModifyOriginalResponseAsync(Action<MessageProperties> func, RequestOptions options)
|
async Task<IUserMessage> IDiscordInteraction.ModifyOriginalResponseAsync(Action<MessageProperties> func, RequestOptions options)
|
||||||
=> await ModifyOriginalResponseAsync(func, options).ConfigureAwait(false);
|
=> await ModifyOriginalResponseAsync(func, options).ConfigureAwait(false);
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
async Task IDiscordInteraction.RespondAsync(string text, Embed[] embeds, bool isTTS, bool ephemeral, AllowedMentions allowedMentions, MessageComponent components, Embed embed, RequestOptions options)
|
async Task IDiscordInteraction.RespondAsync(string text, Embed[] embeds, bool isTTS, bool ephemeral, AllowedMentions allowedMentions, MessageComponent components,
|
||||||
=> await RespondAsync(text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options).ConfigureAwait(false);
|
Embed embed, RequestOptions options, PollProperties poll)
|
||||||
|
=> await RespondAsync(text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options, poll).ConfigureAwait(false);
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
async Task<IUserMessage> IDiscordInteraction.FollowupAsync(string text, Embed[] embeds, bool isTTS, bool ephemeral, AllowedMentions allowedMentions, MessageComponent components, Embed embed, RequestOptions options)
|
async Task<IUserMessage> IDiscordInteraction.FollowupAsync(string text, Embed[] embeds, bool isTTS, bool ephemeral, AllowedMentions allowedMentions,
|
||||||
=> await FollowupAsync(text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options).ConfigureAwait(false);
|
MessageComponent components, Embed embed, RequestOptions options, PollProperties poll)
|
||||||
|
=> await FollowupAsync(text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options, poll).ConfigureAwait(false);
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
async Task<IUserMessage> IDiscordInteraction.FollowupWithFilesAsync(IEnumerable<FileAttachment> attachments, string text, Embed[] embeds, bool isTTS, bool ephemeral, AllowedMentions allowedMentions, MessageComponent components, Embed embed, RequestOptions options)
|
async Task<IUserMessage> IDiscordInteraction.FollowupWithFilesAsync(IEnumerable<FileAttachment> attachments, string text, Embed[] embeds, bool isTTS,
|
||||||
=> await FollowupWithFilesAsync(attachments, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options).ConfigureAwait(false);
|
bool ephemeral, AllowedMentions allowedMentions, MessageComponent components, Embed embed, RequestOptions options, PollProperties poll)
|
||||||
|
=> await FollowupWithFilesAsync(attachments, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options, poll).ConfigureAwait(false);
|
||||||
#if NETCOREAPP3_0_OR_GREATER != true
|
#if NETCOREAPP3_0_OR_GREATER != true
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
async Task<IUserMessage> IDiscordInteraction.FollowupWithFileAsync(Stream fileStream, string fileName, string text, Embed[] embeds, bool isTTS, bool ephemeral, AllowedMentions allowedMentions, MessageComponent components, Embed embed, RequestOptions options)
|
async Task<IUserMessage> IDiscordInteraction.FollowupWithFileAsync(Stream fileStream, string fileName, string text, Embed[] embeds, bool isTTS, bool ephemeral, AllowedMentions allowedMentions, MessageComponent components, Embed embed, RequestOptions options, PollProperties poll)
|
||||||
=> await FollowupWithFileAsync(fileStream, fileName, text, embeds, isTTS, ephemeral, allowedMentions, components, embed).ConfigureAwait(false);
|
=> await FollowupWithFileAsync(fileStream, fileName, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options, poll).ConfigureAwait(false);
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
async Task<IUserMessage> IDiscordInteraction.FollowupWithFileAsync(string filePath, string fileName, string text, Embed[] embeds, bool isTTS, bool ephemeral, AllowedMentions allowedMentions, MessageComponent components, Embed embed, RequestOptions options)
|
async Task<IUserMessage> IDiscordInteraction.FollowupWithFileAsync(string filePath, string fileName, string text, Embed[] embeds, bool isTTS, bool ephemeral, AllowedMentions allowedMentions, MessageComponent components, Embed embed, RequestOptions options, PollProperties poll)
|
||||||
=> await FollowupWithFileAsync(filePath, fileName, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options).ConfigureAwait(false);
|
=> await FollowupWithFileAsync(filePath, fileName, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options, poll).ConfigureAwait(false);
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
async Task<IUserMessage> IDiscordInteraction.FollowupWithFileAsync(FileAttachment attachment, string text, Embed[] embeds, bool isTTS, bool ephemeral, AllowedMentions allowedMentions, MessageComponent components, Embed embed, RequestOptions options)
|
async Task<IUserMessage> IDiscordInteraction.FollowupWithFileAsync(FileAttachment attachment, string text, Embed[] embeds, bool isTTS, bool ephemeral, AllowedMentions allowedMentions, MessageComponent components, Embed embed, RequestOptions options, PollProperties poll)
|
||||||
=> await FollowupWithFileAsync(attachment, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options).ConfigureAwait(false);
|
=> await FollowupWithFileAsync(attachment, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options, poll).ConfigureAwait(false);
|
||||||
#endif
|
#endif
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,6 +52,9 @@ namespace Discord.WebSocket
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public IMessageInteractionMetadata InteractionMetadata { get; internal set; }
|
public IMessageInteractionMetadata InteractionMetadata { get; internal set; }
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public Poll? Poll { get; internal set; }
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public MessageResolvedData ResolvedData { get; internal set; }
|
public MessageResolvedData ResolvedData { get; internal set; }
|
||||||
|
|
||||||
@@ -209,6 +212,9 @@ namespace Discord.WebSocket
|
|||||||
|
|
||||||
if (model.InteractionMetadata.IsSpecified)
|
if (model.InteractionMetadata.IsSpecified)
|
||||||
InteractionMetadata = model.InteractionMetadata.Value.ToInteractionMetadata();
|
InteractionMetadata = model.InteractionMetadata.Value.ToInteractionMetadata();
|
||||||
|
|
||||||
|
if (model.Poll.IsSpecified)
|
||||||
|
Poll = model.Poll.Value.ToEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
@@ -244,6 +250,15 @@ namespace Discord.WebSocket
|
|||||||
return MessageHelper.CrosspostAsync(this, Discord, options);
|
return MessageHelper.CrosspostAsync(this, Discord, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public Task EndPollAsync(RequestOptions options = null)
|
||||||
|
=> MessageHelper.EndPollAsync(Channel.Id, Id, Discord, options);
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public IAsyncEnumerable<IReadOnlyCollection<IUser>> GetPollAnswerVotersAsync(uint answerId, int? limit = null, ulong? afterId = null,
|
||||||
|
RequestOptions options = null)
|
||||||
|
=> MessageHelper.GetPollAnswerVotersAsync(Channel.Id, Id, afterId, answerId, limit, Discord, options);
|
||||||
|
|
||||||
private string DebuggerDisplay => $"{Author}: {Content} ({Id}{(Attachments.Count > 0 ? $", {Attachments.Count} Attachments" : "")})";
|
private string DebuggerDisplay => $"{Author}: {Content} ({Id}{(Attachments.Count > 0 ? $", {Attachments.Count} Attachments" : "")})";
|
||||||
internal new SocketUserMessage Clone() => MemberwiseClone() as SocketUserMessage;
|
internal new SocketUserMessage Clone() => MemberwiseClone() as SocketUserMessage;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -115,8 +115,8 @@ public class DiscordWebhookClient : IDisposable
|
|||||||
public Task<ulong> SendMessageAsync(string text = null, bool isTTS = false, IEnumerable<Embed> embeds = null,
|
public Task<ulong> SendMessageAsync(string text = null, bool isTTS = false, IEnumerable<Embed> embeds = null,
|
||||||
string username = null, string avatarUrl = null, RequestOptions options = null, AllowedMentions allowedMentions = null,
|
string username = null, string avatarUrl = null, RequestOptions options = null, AllowedMentions allowedMentions = null,
|
||||||
MessageComponent components = null, MessageFlags flags = MessageFlags.None, ulong? threadId = null, string threadName = null,
|
MessageComponent components = null, MessageFlags flags = MessageFlags.None, ulong? threadId = null, string threadName = null,
|
||||||
ulong[] appliedTags = null)
|
ulong[] appliedTags = null, PollProperties poll = null)
|
||||||
=> WebhookClientHelper.SendMessageAsync(this, text, isTTS, embeds, username, avatarUrl, allowedMentions, options, components, flags, threadId, threadName, appliedTags);
|
=> WebhookClientHelper.SendMessageAsync(this, text, isTTS, embeds, username, avatarUrl, allowedMentions, options, components, flags, threadId, threadName, appliedTags, poll);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Modifies a message posted using this webhook.
|
/// Modifies a message posted using this webhook.
|
||||||
@@ -157,9 +157,9 @@ public class DiscordWebhookClient : IDisposable
|
|||||||
IEnumerable<Embed> embeds = null, string username = null, string avatarUrl = null,
|
IEnumerable<Embed> embeds = null, string username = null, string avatarUrl = null,
|
||||||
RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null,
|
RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null,
|
||||||
MessageComponent components = null, MessageFlags flags = MessageFlags.None, ulong? threadId = null,
|
MessageComponent components = null, MessageFlags flags = MessageFlags.None, ulong? threadId = null,
|
||||||
string threadName = null, ulong[] appliedTags = null)
|
string threadName = null, ulong[] appliedTags = null, PollProperties poll = null)
|
||||||
=> WebhookClientHelper.SendFileAsync(this, filePath, text, isTTS, embeds, username, avatarUrl,
|
=> WebhookClientHelper.SendFileAsync(this, filePath, text, isTTS, embeds, username, avatarUrl,
|
||||||
allowedMentions, options, isSpoiler, components, flags, threadId, threadName, appliedTags);
|
allowedMentions, options, isSpoiler, components, flags, threadId, threadName, appliedTags, poll);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sends a message to the channel for this webhook with an attachment.
|
/// Sends a message to the channel for this webhook with an attachment.
|
||||||
@@ -171,18 +171,18 @@ public class DiscordWebhookClient : IDisposable
|
|||||||
IEnumerable<Embed> embeds = null, string username = null, string avatarUrl = null,
|
IEnumerable<Embed> embeds = null, string username = null, string avatarUrl = null,
|
||||||
RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null,
|
RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null,
|
||||||
MessageComponent components = null, MessageFlags flags = MessageFlags.None, ulong? threadId = null,
|
MessageComponent components = null, MessageFlags flags = MessageFlags.None, ulong? threadId = null,
|
||||||
string threadName = null, ulong[] appliedTags = null)
|
string threadName = null, ulong[] appliedTags = null, PollProperties poll = null)
|
||||||
=> WebhookClientHelper.SendFileAsync(this, stream, filename, text, isTTS, embeds, username,
|
=> WebhookClientHelper.SendFileAsync(this, stream, filename, text, isTTS, embeds, username,
|
||||||
avatarUrl, allowedMentions, options, isSpoiler, components, flags, threadId, threadName, appliedTags);
|
avatarUrl, allowedMentions, options, isSpoiler, components, flags, threadId, threadName, appliedTags, poll);
|
||||||
|
|
||||||
/// <summary> Sends a message to the channel for this webhook with an attachment. </summary>
|
/// <summary> Sends a message to the channel for this webhook with an attachment. </summary>
|
||||||
/// <returns> Returns the ID of the created message. </returns>
|
/// <returns> Returns the ID of the created message. </returns>
|
||||||
public Task<ulong> SendFileAsync(FileAttachment attachment, string text, bool isTTS = false,
|
public Task<ulong> SendFileAsync(FileAttachment attachment, string text, bool isTTS = false,
|
||||||
IEnumerable<Embed> embeds = null, string username = null, string avatarUrl = null,
|
IEnumerable<Embed> embeds = null, string username = null, string avatarUrl = null,
|
||||||
RequestOptions options = null, AllowedMentions allowedMentions = null, MessageComponent components = null,
|
RequestOptions options = null, AllowedMentions allowedMentions = null, MessageComponent components = null,
|
||||||
MessageFlags flags = MessageFlags.None, ulong? threadId = null, string threadName = null, ulong[] appliedTags = null)
|
MessageFlags flags = MessageFlags.None, ulong? threadId = null, string threadName = null, ulong[] appliedTags = null, PollProperties poll = null)
|
||||||
=> WebhookClientHelper.SendFileAsync(this, attachment, text, isTTS, embeds, username,
|
=> WebhookClientHelper.SendFileAsync(this, attachment, text, isTTS, embeds, username,
|
||||||
avatarUrl, allowedMentions, components, options, flags, threadId, threadName, appliedTags);
|
avatarUrl, allowedMentions, components, options, flags, threadId, threadName, appliedTags, poll);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sends a message to the channel for this webhook with an attachment.
|
/// Sends a message to the channel for this webhook with an attachment.
|
||||||
@@ -193,9 +193,9 @@ public class DiscordWebhookClient : IDisposable
|
|||||||
public Task<ulong> SendFilesAsync(IEnumerable<FileAttachment> attachments, string text, bool isTTS = false,
|
public Task<ulong> SendFilesAsync(IEnumerable<FileAttachment> attachments, string text, bool isTTS = false,
|
||||||
IEnumerable<Embed> embeds = null, string username = null, string avatarUrl = null,
|
IEnumerable<Embed> embeds = null, string username = null, string avatarUrl = null,
|
||||||
RequestOptions options = null, AllowedMentions allowedMentions = null, MessageComponent components = null,
|
RequestOptions options = null, AllowedMentions allowedMentions = null, MessageComponent components = null,
|
||||||
MessageFlags flags = MessageFlags.None, ulong? threadId = null, string threadName = null, ulong[] appliedTags = null)
|
MessageFlags flags = MessageFlags.None, ulong? threadId = null, string threadName = null, ulong[] appliedTags = null, PollProperties poll = null)
|
||||||
=> WebhookClientHelper.SendFilesAsync(this, attachments, text, isTTS, embeds, username, avatarUrl,
|
=> WebhookClientHelper.SendFilesAsync(this, attachments, text, isTTS, embeds, username, avatarUrl,
|
||||||
allowedMentions, components, options, flags, threadId, threadName, appliedTags);
|
allowedMentions, components, options, flags, threadId, threadName, appliedTags, poll);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Modifies the properties of this webhook.
|
/// Modifies the properties of this webhook.
|
||||||
|
|||||||
@@ -26,7 +26,8 @@ namespace Discord.Webhook
|
|||||||
public static async Task<ulong> SendMessageAsync(DiscordWebhookClient client,
|
public static async Task<ulong> SendMessageAsync(DiscordWebhookClient client,
|
||||||
string text, bool isTTS, IEnumerable<Embed> embeds, string username, string avatarUrl,
|
string text, bool isTTS, IEnumerable<Embed> embeds, string username, string avatarUrl,
|
||||||
AllowedMentions allowedMentions, RequestOptions options, MessageComponent components,
|
AllowedMentions allowedMentions, RequestOptions options, MessageComponent components,
|
||||||
MessageFlags flags, ulong? threadId = null, string threadName = null, ulong[] appliedTags = null)
|
MessageFlags flags, ulong? threadId = null, string threadName = null, ulong[] appliedTags = null,
|
||||||
|
PollProperties poll = null)
|
||||||
{
|
{
|
||||||
var args = new CreateWebhookMessageParams
|
var args = new CreateWebhookMessageParams
|
||||||
{
|
{
|
||||||
@@ -35,7 +36,8 @@ namespace Discord.Webhook
|
|||||||
Flags = flags
|
Flags = flags
|
||||||
};
|
};
|
||||||
|
|
||||||
Preconditions.WebhookMessageAtLeastOneOf(text, components, embeds?.ToArray());
|
Preconditions.WebhookMessageAtLeastOneOf(text, components, embeds?.ToArray(), poll: poll);
|
||||||
|
Preconditions.ValidatePoll(poll);
|
||||||
|
|
||||||
if (embeds != null)
|
if (embeds != null)
|
||||||
args.Embeds = embeds.Select(x => x.ToModel()).ToArray();
|
args.Embeds = embeds.Select(x => x.ToModel()).ToArray();
|
||||||
@@ -51,6 +53,8 @@ namespace Discord.Webhook
|
|||||||
args.ThreadName = threadName;
|
args.ThreadName = threadName;
|
||||||
if (appliedTags != null)
|
if (appliedTags != null)
|
||||||
args.AppliedTags = appliedTags;
|
args.AppliedTags = appliedTags;
|
||||||
|
if (poll != null)
|
||||||
|
args.Poll = poll.ToModel();
|
||||||
|
|
||||||
if (flags is not MessageFlags.None and not MessageFlags.SuppressEmbeds)
|
if (flags is not MessageFlags.None and not MessageFlags.SuppressEmbeds)
|
||||||
throw new ArgumentException("The only valid MessageFlags are SuppressEmbeds and none.", nameof(flags));
|
throw new ArgumentException("The only valid MessageFlags are SuppressEmbeds and none.", nameof(flags));
|
||||||
@@ -136,36 +140,37 @@ namespace Discord.Webhook
|
|||||||
public static async Task<ulong> SendFileAsync(DiscordWebhookClient client, string filePath, string text, bool isTTS,
|
public static async Task<ulong> SendFileAsync(DiscordWebhookClient client, string filePath, string text, bool isTTS,
|
||||||
IEnumerable<Embed> embeds, string username, string avatarUrl, AllowedMentions allowedMentions, RequestOptions options,
|
IEnumerable<Embed> embeds, string username, string avatarUrl, AllowedMentions allowedMentions, RequestOptions options,
|
||||||
bool isSpoiler, MessageComponent components, MessageFlags flags = MessageFlags.None, ulong? threadId = null, string threadName = null,
|
bool isSpoiler, MessageComponent components, MessageFlags flags = MessageFlags.None, ulong? threadId = null, string threadName = null,
|
||||||
ulong[] appliedTags = null)
|
ulong[] appliedTags = null, PollProperties poll = null)
|
||||||
{
|
{
|
||||||
string filename = Path.GetFileName(filePath);
|
string filename = Path.GetFileName(filePath);
|
||||||
using (var file = File.OpenRead(filePath))
|
using (var file = File.OpenRead(filePath))
|
||||||
return await SendFileAsync(client, file, filename, text, isTTS, embeds, username, avatarUrl, allowedMentions, options, isSpoiler, components, flags, threadId, threadName, appliedTags).ConfigureAwait(false);
|
return await SendFileAsync(client, file, filename, text, isTTS, embeds, username, avatarUrl, allowedMentions, options, isSpoiler, components, flags, threadId, threadName, appliedTags, poll).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Task<ulong> SendFileAsync(DiscordWebhookClient client, Stream stream, string filename, string text, bool isTTS,
|
public static Task<ulong> SendFileAsync(DiscordWebhookClient client, Stream stream, string filename, string text, bool isTTS,
|
||||||
IEnumerable<Embed> embeds, string username, string avatarUrl, AllowedMentions allowedMentions, RequestOptions options, bool isSpoiler,
|
IEnumerable<Embed> embeds, string username, string avatarUrl, AllowedMentions allowedMentions, RequestOptions options, bool isSpoiler,
|
||||||
MessageComponent components, MessageFlags flags, ulong? threadId, string threadName = null, ulong[] appliedTags = null)
|
MessageComponent components, MessageFlags flags, ulong? threadId, string threadName = null, ulong[] appliedTags = null, PollProperties poll = null)
|
||||||
=> SendFileAsync(client, new FileAttachment(stream, filename, isSpoiler: isSpoiler), text, isTTS, embeds, username, avatarUrl, allowedMentions, components, options, flags, threadId, threadName, appliedTags);
|
=> SendFileAsync(client, new FileAttachment(stream, filename, isSpoiler: isSpoiler), text, isTTS, embeds, username, avatarUrl, allowedMentions, components, options, flags, threadId, threadName, appliedTags, poll);
|
||||||
|
|
||||||
public static Task<ulong> SendFileAsync(DiscordWebhookClient client, FileAttachment attachment, string text, bool isTTS,
|
public static Task<ulong> SendFileAsync(DiscordWebhookClient client, FileAttachment attachment, string text, bool isTTS,
|
||||||
IEnumerable<Embed> embeds, string username, string avatarUrl, AllowedMentions allowedMentions,
|
IEnumerable<Embed> embeds, string username, string avatarUrl, AllowedMentions allowedMentions,
|
||||||
MessageComponent components, RequestOptions options, MessageFlags flags, ulong? threadId, string threadName = null,
|
MessageComponent components, RequestOptions options, MessageFlags flags, ulong? threadId, string threadName = null,
|
||||||
ulong[] appliedTags = null)
|
ulong[] appliedTags = null, PollProperties poll = null)
|
||||||
=> SendFilesAsync(client, new FileAttachment[] { attachment }, text, isTTS, embeds, username, avatarUrl, allowedMentions, components, options, flags, threadId, threadName, appliedTags);
|
=> SendFilesAsync(client, new FileAttachment[] { attachment }, text, isTTS, embeds, username, avatarUrl, allowedMentions, components, options, flags, threadId, threadName, appliedTags, poll);
|
||||||
|
|
||||||
public static async Task<ulong> SendFilesAsync(DiscordWebhookClient client,
|
public static async Task<ulong> SendFilesAsync(DiscordWebhookClient client,
|
||||||
IEnumerable<FileAttachment> attachments, string text, bool isTTS, IEnumerable<Embed> embeds, string username,
|
IEnumerable<FileAttachment> attachments, string text, bool isTTS, IEnumerable<Embed> embeds, string username,
|
||||||
string avatarUrl, AllowedMentions allowedMentions, MessageComponent components, RequestOptions options,
|
string avatarUrl, AllowedMentions allowedMentions, MessageComponent components, RequestOptions options,
|
||||||
MessageFlags flags, ulong? threadId, string threadName = null, ulong[] appliedTags = null)
|
MessageFlags flags, ulong? threadId, string threadName = null, ulong[] appliedTags = null, PollProperties poll = null)
|
||||||
{
|
{
|
||||||
embeds ??= Array.Empty<Embed>();
|
embeds ??= Array.Empty<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.Count(), DiscordConfig.MaxEmbedsPerMessage, nameof(embeds), $"A max of {DiscordConfig.MaxEmbedsPerMessage} Embeds are allowed.");
|
Preconditions.AtMost(embeds.Count(), DiscordConfig.MaxEmbedsPerMessage, nameof(embeds), $"A max of {DiscordConfig.MaxEmbedsPerMessage} Embeds are allowed.");
|
||||||
|
Preconditions.ValidatePoll(poll);
|
||||||
|
|
||||||
Preconditions.WebhookMessageAtLeastOneOf(text, components, embeds.ToArray(), attachments);
|
Preconditions.WebhookMessageAtLeastOneOf(text, components, embeds.ToArray(), attachments, poll: poll);
|
||||||
|
|
||||||
foreach (var attachment in attachments)
|
foreach (var attachment in attachments)
|
||||||
{
|
{
|
||||||
@@ -202,7 +207,8 @@ namespace Discord.Webhook
|
|||||||
MessageComponents = components?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ?? Optional<API.ActionRowComponent[]>.Unspecified,
|
MessageComponents = components?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ?? Optional<API.ActionRowComponent[]>.Unspecified,
|
||||||
Flags = flags,
|
Flags = flags,
|
||||||
ThreadName = threadName,
|
ThreadName = threadName,
|
||||||
AppliedTags = appliedTags
|
AppliedTags = appliedTags,
|
||||||
|
Poll = poll?.ToModel() ?? Optional<CreatePollParams>.Unspecified
|
||||||
};
|
};
|
||||||
var msg = await client.ApiClient.UploadWebhookFileAsync(client.Webhook.Id, args, options, threadId).ConfigureAwait(false);
|
var msg = await client.ApiClient.UploadWebhookFileAsync(client.Webhook.Id, args, options, threadId).ConfigureAwait(false);
|
||||||
return msg.Id;
|
return msg.Id;
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ namespace Discord
|
|||||||
AssertFlag(() => new ChannelPermissions(sendVoiceMessages: true), ChannelPermission.SendVoiceMessages);
|
AssertFlag(() => new ChannelPermissions(sendVoiceMessages: true), ChannelPermission.SendVoiceMessages);
|
||||||
AssertFlag(() => new ChannelPermissions(useClydeAI: true), ChannelPermission.UseClydeAI);
|
AssertFlag(() => new ChannelPermissions(useClydeAI: true), ChannelPermission.UseClydeAI);
|
||||||
AssertFlag(() => new ChannelPermissions(setVoiceChannelStatus: true), ChannelPermission.SetVoiceChannelStatus);
|
AssertFlag(() => new ChannelPermissions(setVoiceChannelStatus: true), ChannelPermission.SetVoiceChannelStatus);
|
||||||
|
AssertFlag(() => new ChannelPermissions(sendPolls: true), ChannelPermission.SendPolls);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -162,6 +163,7 @@ namespace Discord
|
|||||||
AssertUtil(ChannelPermission.SendVoiceMessages, x => x.SendVoiceMessages, (p, enable) => p.Modify(sendVoiceMessages: enable));
|
AssertUtil(ChannelPermission.SendVoiceMessages, x => x.SendVoiceMessages, (p, enable) => p.Modify(sendVoiceMessages: enable));
|
||||||
AssertUtil(ChannelPermission.UseClydeAI, x => x.UseClydeAI, (p, enable) => p.Modify(useClydeAI: enable));
|
AssertUtil(ChannelPermission.UseClydeAI, x => x.UseClydeAI, (p, enable) => p.Modify(useClydeAI: enable));
|
||||||
AssertUtil(ChannelPermission.SetVoiceChannelStatus, x => x.SetVoiceChannelStatus, (p, enable) => p.Modify(setVoiceChannelStatus: enable));
|
AssertUtil(ChannelPermission.SetVoiceChannelStatus, x => x.SetVoiceChannelStatus, (p, enable) => p.Modify(setVoiceChannelStatus: enable));
|
||||||
|
AssertUtil(ChannelPermission.SendPolls, x => x.SendPolls, (p, enable) => p.Modify(sendPolls: enable));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -106,6 +106,7 @@ namespace Discord
|
|||||||
AssertFlag(() => new GuildPermissions(useClydeAI: true), GuildPermission.UseClydeAI);
|
AssertFlag(() => new GuildPermissions(useClydeAI: true), GuildPermission.UseClydeAI);
|
||||||
AssertFlag(() => new GuildPermissions(createGuildExpressions: true), GuildPermission.CreateGuildExpressions);
|
AssertFlag(() => new GuildPermissions(createGuildExpressions: true), GuildPermission.CreateGuildExpressions);
|
||||||
AssertFlag(() => new GuildPermissions(setVoiceChannelStatus: true), GuildPermission.SetVoiceChannelStatus);
|
AssertFlag(() => new GuildPermissions(setVoiceChannelStatus: true), GuildPermission.SetVoiceChannelStatus);
|
||||||
|
AssertFlag(() => new GuildPermissions(sendPolls: true), GuildPermission.SendPolls);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -190,6 +191,7 @@ namespace Discord
|
|||||||
AssertUtil(GuildPermission.UseClydeAI, x => x.UseClydeAI, (p, enable) => p.Modify(useClydeAI: enable));
|
AssertUtil(GuildPermission.UseClydeAI, x => x.UseClydeAI, (p, enable) => p.Modify(useClydeAI: enable));
|
||||||
AssertUtil(GuildPermission.CreateGuildExpressions, x => x.CreateGuildExpressions, (p, enable) => p.Modify(createGuildExpressions: enable));
|
AssertUtil(GuildPermission.CreateGuildExpressions, x => x.CreateGuildExpressions, (p, enable) => p.Modify(createGuildExpressions: enable));
|
||||||
AssertUtil(GuildPermission.SetVoiceChannelStatus, x => x.SetVoiceChannelStatus, (p, enable) => p.Modify(setVoiceChannelStatus: enable));
|
AssertUtil(GuildPermission.SetVoiceChannelStatus, x => x.SetVoiceChannelStatus, (p, enable) => p.Modify(setVoiceChannelStatus: enable));
|
||||||
|
AssertUtil(GuildPermission.SendPolls, x => x.SendPolls, (p, enable) => p.Modify(sendPolls: enable));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,10 +83,10 @@ 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, Embed[] embeds = null, MessageFlags flags = MessageFlags.None) => 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, MessageFlags flags = MessageFlags.None, PollProperties poll = 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, Embed[] embeds = null, MessageFlags flags = MessageFlags.None) => 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, Embed[] embeds = null, MessageFlags flags = MessageFlags.None, PollProperties poll = 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, Embed[] embeds = null, MessageFlags flags = MessageFlags.None) => 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, Embed[] embeds = null, MessageFlags flags = MessageFlags.None, PollProperties poll = null) => throw new NotImplementedException();
|
||||||
public Task<IUserMessage> SendFileAsync(FileAttachment attachment, 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, MessageFlags flags = MessageFlags.None) => throw new NotImplementedException();
|
public Task<IUserMessage> SendFileAsync(FileAttachment attachment, 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, MessageFlags flags = MessageFlags.None, PollProperties poll = null) => throw new NotImplementedException();
|
||||||
public Task<IUserMessage> SendFilesAsync(IEnumerable<FileAttachment> attachments, 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, MessageFlags flags = MessageFlags.None) => throw new NotImplementedException();
|
public Task<IUserMessage> SendFilesAsync(IEnumerable<FileAttachment> attachments, 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, MessageFlags flags = MessageFlags.None, PollProperties poll = null) => throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,17 +93,17 @@ namespace Discord
|
|||||||
throw new NotImplementedException();
|
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, Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
|
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, Embed[] embeds = null, MessageFlags flags = MessageFlags.None, PollProperties poll = null)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
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, Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
|
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, Embed[] embeds = null, MessageFlags flags = MessageFlags.None, PollProperties poll = null)
|
||||||
{
|
{
|
||||||
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, Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
|
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, MessageFlags flags = MessageFlags.None, PollProperties poll = null)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
@@ -113,7 +113,7 @@ namespace Discord
|
|||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<IUserMessage> SendFileAsync(FileAttachment attachment, 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, MessageFlags flags = MessageFlags.None) => throw new NotImplementedException();
|
public Task<IUserMessage> SendFileAsync(FileAttachment attachment, 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, MessageFlags flags = MessageFlags.None, PollProperties poll = null) => throw new NotImplementedException();
|
||||||
public Task<IUserMessage> SendFilesAsync(IEnumerable<FileAttachment> attachments, 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, MessageFlags flags = MessageFlags.None) => throw new NotImplementedException();
|
public Task<IUserMessage> SendFilesAsync(IEnumerable<FileAttachment> attachments, 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, MessageFlags flags = MessageFlags.None, PollProperties poll = null) => throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -182,17 +182,17 @@ namespace Discord
|
|||||||
throw new NotImplementedException();
|
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, Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
|
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, Embed[] embeds = null, MessageFlags flags = MessageFlags.None, PollProperties poll = null)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
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, Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
|
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, Embed[] embeds = null, MessageFlags flags = MessageFlags.None, PollProperties poll = null)
|
||||||
{
|
{
|
||||||
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, Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
|
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, MessageFlags flags = MessageFlags.None, PollProperties poll = null)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
@@ -217,8 +217,8 @@ namespace Discord
|
|||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<IUserMessage> SendFileAsync(FileAttachment attachment, 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, MessageFlags flags = MessageFlags.None) => throw new NotImplementedException();
|
public Task<IUserMessage> SendFileAsync(FileAttachment attachment, 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, MessageFlags flags = MessageFlags.None, PollProperties poll = null) => throw new NotImplementedException();
|
||||||
public Task<IUserMessage> SendFilesAsync(IEnumerable<FileAttachment> attachments, 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, MessageFlags flags = MessageFlags.None) => throw new NotImplementedException();
|
public Task<IUserMessage> SendFilesAsync(IEnumerable<FileAttachment> attachments, 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, MessageFlags flags = MessageFlags.None, PollProperties poll = null) => throw new NotImplementedException();
|
||||||
public Task<IThreadChannel> CreateThreadAsync(string name, ThreadType type = ThreadType.PublicThread, ThreadArchiveDuration autoArchiveDuration = ThreadArchiveDuration.OneDay, IMessage message = null, bool? invitable = null, int? slowmode = null, RequestOptions options = null, MessageFlags flags = MessageFlags.None) => throw new NotImplementedException();
|
public Task<IThreadChannel> CreateThreadAsync(string name, ThreadType type = ThreadType.PublicThread, ThreadArchiveDuration autoArchiveDuration = ThreadArchiveDuration.OneDay, IMessage message = null, bool? invitable = null, int? slowmode = null, RequestOptions options = null, MessageFlags flags = MessageFlags.None) => throw new NotImplementedException();
|
||||||
public Task<IInviteMetadata> CreateInviteToApplicationAsync(DefaultApplications application, int? maxAge = 86400, int? maxUses = null, bool isTemporary = false, bool isUnique = false, RequestOptions options = null) => throw new NotImplementedException();
|
public Task<IInviteMetadata> CreateInviteToApplicationAsync(DefaultApplications application, int? maxAge = 86400, int? maxUses = null, bool isTemporary = false, bool isUnique = false, RequestOptions options = null) => throw new NotImplementedException();
|
||||||
public Task<IThreadChannel> CreateThreadAsync(string name, ThreadType type = ThreadType.PublicThread, ThreadArchiveDuration autoArchiveDuration = ThreadArchiveDuration.OneDay, IMessage message = null, bool? invitable = null, int? slowmode = null, RequestOptions options = null) => throw new NotImplementedException();
|
public Task<IThreadChannel> CreateThreadAsync(string name, ThreadType type = ThreadType.PublicThread, ThreadArchiveDuration autoArchiveDuration = ThreadArchiveDuration.OneDay, IMessage message = null, bool? invitable = null, int? slowmode = null, RequestOptions options = null) => throw new NotImplementedException();
|
||||||
|
|||||||
@@ -82,11 +82,11 @@ namespace Discord
|
|||||||
public Task<IUserMessage> ModifyMessageAsync(ulong messageId, Action<MessageProperties> func, RequestOptions options = null) => throw new NotImplementedException();
|
public Task<IUserMessage> ModifyMessageAsync(ulong messageId, Action<MessageProperties> func, RequestOptions options = null) => throw new NotImplementedException();
|
||||||
public Task RemovePermissionOverwriteAsync(IRole role, RequestOptions options = null) => throw new NotImplementedException();
|
public Task RemovePermissionOverwriteAsync(IRole role, RequestOptions options = null) => throw new NotImplementedException();
|
||||||
public Task RemovePermissionOverwriteAsync(IUser user, RequestOptions options = null) => throw new NotImplementedException();
|
public Task RemovePermissionOverwriteAsync(IUser user, RequestOptions options = 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 components = null, ISticker[] stickers = null, Embed[] embeds = null, MessageFlags flags = MessageFlags.None) => 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 components = null, ISticker[] stickers = null, Embed[] embeds = null, MessageFlags flags = MessageFlags.None, PollProperties poll = 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 components = null, ISticker[] stickers = null, Embed[] embeds = null, MessageFlags flags = MessageFlags.None) => 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 components = null, ISticker[] stickers = null, Embed[] embeds = null, MessageFlags flags = MessageFlags.None, PollProperties poll = null) => throw new NotImplementedException();
|
||||||
public Task<IUserMessage> SendFileAsync(FileAttachment attachment, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null, MessageFlags flags = MessageFlags.None) => throw new NotImplementedException();
|
public Task<IUserMessage> SendFileAsync(FileAttachment attachment, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null, MessageFlags flags = MessageFlags.None, PollProperties poll = null) => throw new NotImplementedException();
|
||||||
public Task<IUserMessage> SendFilesAsync(IEnumerable<FileAttachment> attachments, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null, MessageFlags flags = MessageFlags.None) => throw new NotImplementedException();
|
public Task<IUserMessage> SendFilesAsync(IEnumerable<FileAttachment> attachments, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null, MessageFlags flags = MessageFlags.None, PollProperties poll = 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 components = null, ISticker[] stickers = null, Embed[] embeds = null, MessageFlags flags = MessageFlags.None) => 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 components = null, ISticker[] stickers = null, Embed[] embeds = null, MessageFlags flags = MessageFlags.None, PollProperties poll = null) => throw new NotImplementedException();
|
||||||
public Task SyncPermissionsAsync(RequestOptions options = null) => throw new NotImplementedException();
|
public Task SyncPermissionsAsync(RequestOptions options = null) => throw new NotImplementedException();
|
||||||
public Task TriggerTypingAsync(RequestOptions options = null) => throw new NotImplementedException();
|
public Task TriggerTypingAsync(RequestOptions options = null) => throw new NotImplementedException();
|
||||||
Task<IUser> IChannel.GetUserAsync(ulong id, CacheMode mode, RequestOptions options) => throw new NotImplementedException();
|
Task<IUser> IChannel.GetUserAsync(ulong id, CacheMode mode, RequestOptions options) => throw new NotImplementedException();
|
||||||
|
|||||||
Reference in New Issue
Block a user