Support Sending Message Flags (#2131)
* Add message flags * Add webhook message flags
This commit is contained in:
committed by
GitHub
parent
b3370c33e2
commit
1fb62de14b
@@ -31,11 +31,12 @@ namespace Discord
|
|||||||
/// <param name="components">The message components to be included with this message. Used for interactions.</param>
|
/// <param name="components">The message components to be included with this message. Used for interactions.</param>
|
||||||
/// <param name="stickers">A collection of stickers to send with the message.</param>
|
/// <param name="stickers">A collection of stickers to send with the message.</param>
|
||||||
/// <param name="embeds">A array of <see cref="Embed"/>s to send with this response. Max 10.</param>
|
/// <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"/> is permitted.</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);
|
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);
|
||||||
/// <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>
|
||||||
@@ -71,11 +72,12 @@ namespace Discord
|
|||||||
/// <param name="components">The message components to be included with this message. Used for interactions.</param>
|
/// <param name="components">The message components to be included with this message. Used for interactions.</param>
|
||||||
/// <param name="stickers">A collection of stickers to send with the file.</param>
|
/// <param name="stickers">A collection of stickers to send with the file.</param>
|
||||||
/// <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"/> is permitted.</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);
|
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);
|
||||||
/// <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>
|
||||||
@@ -108,11 +110,12 @@ namespace Discord
|
|||||||
/// <param name="components">The message components to be included with this message. Used for interactions.</param>
|
/// <param name="components">The message components to be included with this message. Used for interactions.</param>
|
||||||
/// <param name="stickers">A collection of stickers to send with the file.</param>
|
/// <param name="stickers">A collection of stickers to send with the file.</param>
|
||||||
/// <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"/> is permitted.</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);
|
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);
|
||||||
/// <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>
|
||||||
@@ -137,11 +140,12 @@ namespace Discord
|
|||||||
/// <param name="components">The message components to be included with this message. Used for interactions.</param>
|
/// <param name="components">The message components to be included with this message. Used for interactions.</param>
|
||||||
/// <param name="stickers">A collection of stickers to send with the file.</param>
|
/// <param name="stickers">A collection of stickers to send with the file.</param>
|
||||||
/// <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"/> is permitted.</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);
|
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);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sends a collection of files to this message channel.
|
/// Sends a collection of files to this message channel.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -166,11 +170,12 @@ namespace Discord
|
|||||||
/// <param name="components">The message components to be included with this message. Used for interactions.</param>
|
/// <param name="components">The message components to be included with this message. Used for interactions.</param>
|
||||||
/// <param name="stickers">A collection of stickers to send with the file.</param>
|
/// <param name="stickers">A collection of stickers to send with the file.</param>
|
||||||
/// <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"/> is permitted.</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);
|
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);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a message from this message channel.
|
/// Gets a message from this message channel.
|
||||||
|
|||||||
@@ -28,6 +28,9 @@ namespace Discord.API.Rest
|
|||||||
|
|
||||||
[JsonProperty("sticker_ids")]
|
[JsonProperty("sticker_ids")]
|
||||||
public Optional<ulong[]> Stickers { get; set; }
|
public Optional<ulong[]> Stickers { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("flags")]
|
||||||
|
public Optional<MessageFlags> Flags { get; set; }
|
||||||
|
|
||||||
public CreateMessageParams(string content)
|
public CreateMessageParams(string content)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -266,8 +266,10 @@ namespace Discord.Rest
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception>
|
/// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception>
|
||||||
|
/// <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, MessageComponent components, ISticker[] stickers, RequestOptions options, Embed[] embeds)
|
string text, bool isTTS, Embed embed, AllowedMentions allowedMentions, MessageReference messageReference,
|
||||||
|
MessageComponent components, ISticker[] stickers, RequestOptions options, Embed[] embeds, MessageFlags flags)
|
||||||
{
|
{
|
||||||
embeds ??= Array.Empty<Embed>();
|
embeds ??= Array.Empty<Embed>();
|
||||||
if (embed != null)
|
if (embed != null)
|
||||||
@@ -298,6 +300,10 @@ namespace Discord.Rest
|
|||||||
Preconditions.AtMost(stickers.Length, 3, nameof(stickers), "A max of 3 stickers are allowed.");
|
Preconditions.AtMost(stickers.Length, 3, nameof(stickers), "A max of 3 stickers are allowed.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (flags is not MessageFlags.None and not MessageFlags.SuppressEmbeds)
|
||||||
|
throw new ArgumentException("The only valid MessageFlags are SuppressEmbeds and none.", nameof(flags));
|
||||||
|
|
||||||
var args = new CreateMessageParams(text)
|
var args = new CreateMessageParams(text)
|
||||||
{
|
{
|
||||||
IsTTS = isTTS,
|
IsTTS = isTTS,
|
||||||
@@ -305,7 +311,8 @@ namespace Discord.Rest
|
|||||||
AllowedMentions = allowedMentions?.ToModel(),
|
AllowedMentions = allowedMentions?.ToModel(),
|
||||||
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
|
||||||
};
|
};
|
||||||
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);
|
||||||
@@ -335,29 +342,44 @@ namespace Discord.Rest
|
|||||||
/// <exception cref="NotSupportedException"><paramref name="filePath" /> is in an invalid format.</exception>
|
/// <exception cref="NotSupportedException"><paramref name="filePath" /> is in an invalid format.</exception>
|
||||||
/// <exception cref="IOException">An I/O error occurred while opening the file.</exception>
|
/// <exception cref="IOException">An I/O error occurred while opening the file.</exception>
|
||||||
/// <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>
|
||||||
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, MessageReference messageReference, MessageComponent components, ISticker[] stickers, RequestOptions options, bool isSpoiler, Embed[] embeds)
|
string filePath, string text, bool isTTS, Embed embed, AllowedMentions allowedMentions,
|
||||||
|
MessageReference messageReference, MessageComponent components, ISticker[] stickers, RequestOptions options,
|
||||||
|
bool isSpoiler, Embed[] embeds, MessageFlags flags = MessageFlags.None)
|
||||||
{
|
{
|
||||||
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, messageReference, components, stickers, options, isSpoiler, embeds).ConfigureAwait(false);
|
return await SendFileAsync(channel, client, file, filename, text, isTTS, embed, allowedMentions,
|
||||||
|
messageReference, components, stickers, options, isSpoiler, embeds, flags).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>
|
||||||
|
/// <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> 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, MessageReference messageReference, MessageComponent components, ISticker[] stickers, RequestOptions options, bool isSpoiler, Embed[] embeds)
|
Stream stream, string filename, string text, bool isTTS, Embed embed, AllowedMentions allowedMentions,
|
||||||
|
MessageReference messageReference, MessageComponent components, ISticker[] stickers, RequestOptions options,
|
||||||
|
bool isSpoiler, Embed[] embeds, MessageFlags flags = MessageFlags.None)
|
||||||
{
|
{
|
||||||
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, components, stickers, options, embeds).ConfigureAwait(false);
|
return await SendFileAsync(channel, client, file, text, isTTS, embed, allowedMentions, messageReference,
|
||||||
|
components, stickers, options, embeds, flags).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>
|
||||||
|
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||||
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, MessageReference messageReference, MessageComponent components, ISticker[] stickers, RequestOptions options, Embed[] embeds)
|
FileAttachment attachment, string text, bool isTTS, Embed embed, AllowedMentions allowedMentions,
|
||||||
=> SendFilesAsync(channel, client, new[] { attachment }, text, isTTS, embed, allowedMentions, messageReference, components, stickers, options, embeds);
|
MessageReference messageReference, MessageComponent components, ISticker[] stickers, RequestOptions options,
|
||||||
|
Embed[] embeds, MessageFlags flags = MessageFlags.None)
|
||||||
|
=> SendFilesAsync(channel, client, new[] { attachment }, text, isTTS, embed, allowedMentions, messageReference,
|
||||||
|
components, stickers, options, embeds, flags);
|
||||||
|
|
||||||
|
/// <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> 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, MessageReference messageReference, MessageComponent components, ISticker[] stickers, RequestOptions options, Embed[] embeds)
|
IEnumerable<FileAttachment> attachments, string text, bool isTTS, Embed embed, AllowedMentions allowedMentions,
|
||||||
|
MessageReference messageReference, MessageComponent components, ISticker[] stickers, RequestOptions options,
|
||||||
|
Embed[] embeds, MessageFlags flags)
|
||||||
{
|
{
|
||||||
embeds ??= Array.Empty<Embed>();
|
embeds ??= Array.Empty<Embed>();
|
||||||
if (embed != null)
|
if (embed != null)
|
||||||
@@ -366,7 +388,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.");
|
||||||
|
|
||||||
foreach(var attachment in attachments)
|
foreach(var attachment in attachments)
|
||||||
{
|
{
|
||||||
Preconditions.NotNullOrEmpty(attachment.FileName, nameof(attachment.FileName), "File Name must not be empty or null");
|
Preconditions.NotNullOrEmpty(attachment.FileName, nameof(attachment.FileName), "File Name must not be empty or null");
|
||||||
@@ -398,12 +420,26 @@ namespace Discord.Rest
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (flags is not MessageFlags.None and not MessageFlags.SuppressEmbeds)
|
||||||
|
throw new ArgumentException("The only valid MessageFlags are SuppressEmbeds and none.", nameof(flags));
|
||||||
|
|
||||||
if (stickers != null)
|
if (stickers != null)
|
||||||
{
|
{
|
||||||
Preconditions.AtMost(stickers.Length, 3, nameof(stickers), "A max of 3 stickers are allowed.");
|
Preconditions.AtMost(stickers.Length, 3, nameof(stickers), "A max of 3 stickers are allowed.");
|
||||||
}
|
}
|
||||||
|
|
||||||
var args = new UploadFileParams(attachments.ToArray()) { Content = text, IsTTS = isTTS, Embeds = embeds.Any() ? embeds.Select(x => x.ToModel()).ToArray() : Optional<API.Embed[]>.Unspecified, AllowedMentions = allowedMentions?.ToModel() ?? Optional<API.AllowedMentions>.Unspecified, MessageReference = messageReference?.ToModel() ?? Optional<API.MessageReference>.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 };
|
var args = new UploadFileParams(attachments.ToArray())
|
||||||
|
{
|
||||||
|
Content = text,
|
||||||
|
IsTTS = isTTS,
|
||||||
|
Embeds = embeds.Any() ? embeds.Select(x => x.ToModel()).ToArray() : Optional<API.Embed[]>.Unspecified,
|
||||||
|
AllowedMentions = allowedMentions?.ToModel() ?? Optional<API.AllowedMentions>.Unspecified,
|
||||||
|
MessageReference = messageReference?.ToModel() ?? Optional<API.MessageReference>.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,
|
||||||
|
Flags = flags
|
||||||
|
};
|
||||||
|
|
||||||
var model = await client.ApiClient.UploadFileAsync(channel.Id, args, options).ConfigureAwait(false);
|
var model = await client.ApiClient.UploadFileAsync(channel.Id, args, options).ConfigureAwait(false);
|
||||||
return RestUserMessage.Create(client, channel, client.CurrentUser, model);
|
return RestUserMessage.Create(client, channel, client.CurrentUser, model);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,84 +9,14 @@ namespace Discord.Rest
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IRestMessageChannel : IMessageChannel
|
public interface IRestMessageChannel : IMessageChannel
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <inheritdoc cref="IMessageChannel.SendMessageAsync(string, bool, Embed, RequestOptions, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[], MessageFlags)"/>
|
||||||
/// Sends a message to this message channel.
|
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);
|
||||||
/// </summary>
|
|
||||||
/// <remarks>
|
/// <inheritdoc cref="IMessageChannel.SendFileAsync(string, string, bool, Embed, RequestOptions, bool, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[], MessageFlags)"/>
|
||||||
/// This method follows the same behavior as described in <see cref="IMessageChannel.SendMessageAsync"/>.
|
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);
|
||||||
/// Please visit its documentation for more details on this method.
|
|
||||||
/// </remarks>
|
/// <inheritdoc cref="IMessageChannel.SendFileAsync(Stream, string, string, bool, Embed, RequestOptions, bool, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[], MessageFlags)"/>
|
||||||
/// <param name="text">The message to be sent.</param>
|
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);
|
||||||
/// <param name="isTTS">Determines whether the message should be read aloud by Discord or not.</param>
|
|
||||||
/// <param name="embed">The <see cref="Discord.EmbedType.Rich"/> <see cref="Embed"/> to be sent.</param>
|
|
||||||
/// <param name="options">The options to be used when sending the request.</param>
|
|
||||||
/// <param name="allowedMentions">
|
|
||||||
/// Specifies if notifications are sent for mentioned users and roles in the message <paramref name="text"/>.
|
|
||||||
/// If <c>null</c>, all mentioned roles and users will be notified.
|
|
||||||
/// </param>
|
|
||||||
/// <param name="messageReference">The message references to be included. Used to reply to specific messages.</param>
|
|
||||||
/// <param name="components">The message components to be included with this message. Used for interactions.</param>
|
|
||||||
/// <param name="stickers">A collection of stickers to send with the message.</param>
|
|
||||||
/// <param name="embeds">A array of <see cref="Embed"/>s to send with this response. Max 10.</param>
|
|
||||||
/// <returns>
|
|
||||||
/// A task that represents an asynchronous send operation for delivering the message. The task result
|
|
||||||
/// contains the sent message.
|
|
||||||
/// </returns>
|
|
||||||
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);
|
|
||||||
/// <summary>
|
|
||||||
/// Sends a file to this message channel with an optional caption.
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>
|
|
||||||
/// This method follows the same behavior as described in
|
|
||||||
/// <see cref="IMessageChannel.SendFileAsync(string, string, bool, Embed, RequestOptions, bool, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[])"/>. Please visit
|
|
||||||
/// its documentation for more details on this method.
|
|
||||||
/// </remarks>
|
|
||||||
/// <param name="filePath">The file path of the file.</param>
|
|
||||||
/// <param name="text">The message to be sent.</param>
|
|
||||||
/// <param name="isTTS">Whether the message should be read aloud by Discord or not.</param>
|
|
||||||
/// <param name="embed">The <see cref="Discord.EmbedType.Rich" /> <see cref="Embed" /> to be sent.</param>
|
|
||||||
/// <param name="options">The options to be used when sending the request.</param>
|
|
||||||
/// <param name="isSpoiler">Whether the message attachment should be hidden as a spoiler.</param>
|
|
||||||
/// <param name="allowedMentions">
|
|
||||||
/// Specifies if notifications are sent for mentioned users and roles in the message <paramref name="text"/>.
|
|
||||||
/// If <c>null</c>, all mentioned roles and users will be notified.
|
|
||||||
/// </param>
|
|
||||||
/// <param name="messageReference">The message references to be included. Used to reply to specific messages.</param>
|
|
||||||
/// <param name="components">The message components to be included with this message. Used for interactions.</param>
|
|
||||||
/// <param name="stickers">A collection of stickers to send with the message.</param>
|
|
||||||
/// <param name="embeds">A array of <see cref="Embed"/>s to send with this response. Max 10.</param>
|
|
||||||
/// <returns>
|
|
||||||
/// A task that represents an asynchronous send operation for delivering the message. The task result
|
|
||||||
/// contains the sent message.
|
|
||||||
/// </returns>
|
|
||||||
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);
|
|
||||||
/// <summary>
|
|
||||||
/// Sends a file to this message channel with an optional caption.
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>
|
|
||||||
/// This method follows the same behavior as described in <see cref="IMessageChannel.SendFileAsync(Stream, string, string, bool, Embed, RequestOptions, bool, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[])"/>.
|
|
||||||
/// Please visit its documentation for more details on this method.
|
|
||||||
/// </remarks>
|
|
||||||
/// <param name="stream">The <see cref="Stream" /> of the file to be sent.</param>
|
|
||||||
/// <param name="filename">The name of the attachment.</param>
|
|
||||||
/// <param name="text">The message to be sent.</param>
|
|
||||||
/// <param name="isTTS">Whether the message should be read aloud by Discord or not.</param>
|
|
||||||
/// <param name="embed">The <see cref="Discord.EmbedType.Rich"/> <see cref="Embed"/> to be sent.</param>
|
|
||||||
/// <param name="options">The options to be used when sending the request.</param>
|
|
||||||
/// <param name="isSpoiler">Whether the message attachment should be hidden as a spoiler.</param>
|
|
||||||
/// <param name="allowedMentions">
|
|
||||||
/// Specifies if notifications are sent for mentioned users and roles in the message <paramref name="text"/>.
|
|
||||||
/// If <c>null</c>, all mentioned roles and users will be notified.
|
|
||||||
/// </param>
|
|
||||||
/// <param name="messageReference">The message references to be included. Used to reply to specific messages.</param>
|
|
||||||
/// <param name="components">The message components to be included with this message. Used for interactions.</param>
|
|
||||||
/// <param name="stickers">A collection of stickers to send with the message.</param>
|
|
||||||
/// <param name="embeds">A array of <see cref="Embed"/>s to send with this response. Max 10.</param>
|
|
||||||
/// <returns>
|
|
||||||
/// A task that represents an asynchronous send operation for delivering the message. The task result
|
|
||||||
/// contains the sent message.
|
|
||||||
/// </returns>
|
|
||||||
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);
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a message from this message channel.
|
/// Gets a message from this message channel.
|
||||||
|
|||||||
@@ -94,8 +94,12 @@ namespace Discord.Rest
|
|||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
/// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception>
|
/// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception>
|
||||||
public Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null)
|
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||||
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, allowedMentions, messageReference, components, stickers, options, embeds);
|
public 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)
|
||||||
|
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, allowedMentions, messageReference,
|
||||||
|
components, stickers, options, embeds, flags);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
/// <exception cref="ArgumentException">
|
/// <exception cref="ArgumentException">
|
||||||
@@ -122,22 +126,39 @@ namespace Discord.Rest
|
|||||||
/// <exception cref="NotSupportedException"><paramref name="filePath" /> is in an invalid format.</exception>
|
/// <exception cref="NotSupportedException"><paramref name="filePath" /> is in an invalid format.</exception>
|
||||||
/// <exception cref="IOException">An I/O error occurred while opening the file.</exception>
|
/// <exception cref="IOException">An I/O error occurred while opening the file.</exception>
|
||||||
/// <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(string filePath, string text, 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)
|
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||||
=> ChannelHelper.SendFileAsync(this, Discord, filePath, text, isTTS, embed, allowedMentions, messageReference, components, stickers, options, isSpoiler, embeds);
|
public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS = false, Embed embed = null,
|
||||||
|
RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null,
|
||||||
|
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
||||||
|
Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
|
||||||
|
=> ChannelHelper.SendFileAsync(this, Discord, filePath, text, isTTS, embed, allowedMentions, messageReference,
|
||||||
|
components, stickers, options, isSpoiler, embeds, flags);
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
/// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception>
|
/// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception>
|
||||||
public Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text, bool isTTS = false, Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null)
|
public Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text, bool isTTS = false,
|
||||||
=> ChannelHelper.SendFileAsync(this, Discord, stream, filename, text, isTTS, embed, allowedMentions, messageReference, components, stickers, options, isSpoiler, embeds);
|
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)
|
||||||
|
=> ChannelHelper.SendFileAsync(this, Discord, stream, filename, text, isTTS, embed, allowedMentions,
|
||||||
|
messageReference, components, stickers, options, isSpoiler, embeds, flags);
|
||||||
|
|
||||||
/// <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, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null)
|
public Task<RestUserMessage> SendFileAsync(FileAttachment attachment, string text, bool isTTS = false,
|
||||||
=> ChannelHelper.SendFileAsync(this, Discord, attachment, text, isTTS, embed, allowedMentions, messageReference, components, stickers, options, embeds);
|
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)
|
||||||
|
=> ChannelHelper.SendFileAsync(this, Discord, attachment, text, isTTS, embed, allowedMentions, messageReference,
|
||||||
|
components, stickers, options, embeds, flags);
|
||||||
|
|
||||||
/// <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, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null)
|
public Task<RestUserMessage> SendFilesAsync(IEnumerable<FileAttachment> attachments, string text, bool isTTS = false,
|
||||||
=> ChannelHelper.SendFilesAsync(this, Discord, attachments, text, isTTS, embed, allowedMentions, messageReference, components, stickers, options, embeds);
|
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)
|
||||||
|
=> ChannelHelper.SendFilesAsync(this, Discord, attachments, text, isTTS, embed, allowedMentions, messageReference,
|
||||||
|
components, stickers, options, embeds, flags);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public Task DeleteMessageAsync(ulong messageId, RequestOptions options = null)
|
public Task DeleteMessageAsync(ulong messageId, RequestOptions options = null)
|
||||||
@@ -219,20 +240,38 @@ namespace Discord.Rest
|
|||||||
async Task<IReadOnlyCollection<IMessage>> IMessageChannel.GetPinnedMessagesAsync(RequestOptions options)
|
async Task<IReadOnlyCollection<IMessage>> IMessageChannel.GetPinnedMessagesAsync(RequestOptions options)
|
||||||
=> await GetPinnedMessagesAsync(options).ConfigureAwait(false);
|
=> await GetPinnedMessagesAsync(options).ConfigureAwait(false);
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(string filePath, string text, bool isTTS, Embed embed, RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent components, ISticker[] stickers, Embed[] embeds)
|
async Task<IUserMessage> IMessageChannel.SendFileAsync(string filePath, string text, bool isTTS, Embed embed,
|
||||||
=> await SendFileAsync(filePath, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference, components, stickers, embeds).ConfigureAwait(false);
|
RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference,
|
||||||
|
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
||||||
|
=> await SendFileAsync(filePath, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference,
|
||||||
|
components, stickers, embeds, flags).ConfigureAwait(false);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS, Embed embed, RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent components, ISticker[] stickers, Embed[] embeds)
|
async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS,
|
||||||
=> await SendFileAsync(stream, filename, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference, components, stickers, embeds).ConfigureAwait(false);
|
Embed embed, RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference,
|
||||||
|
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
||||||
|
=> await SendFileAsync(stream, filename, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference,
|
||||||
|
components, stickers, embeds, flags).ConfigureAwait(false);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(FileAttachment attachment, string text, bool isTTS, Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent components, ISticker[] stickers, Embed[] embeds)
|
async Task<IUserMessage> IMessageChannel.SendFileAsync(FileAttachment attachment, string text, bool isTTS,
|
||||||
=> await SendFileAsync(attachment, text, isTTS, embed, options, allowedMentions, messageReference, components, stickers, embeds).ConfigureAwait(false);
|
Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference,
|
||||||
|
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
||||||
|
=> await SendFileAsync(attachment, text, isTTS, embed, options, allowedMentions, messageReference, components,
|
||||||
|
stickers, embeds, flags).ConfigureAwait(false);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
async Task<IUserMessage> IMessageChannel.SendFilesAsync(IEnumerable<FileAttachment> attachments, string text, bool isTTS, Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent components, ISticker[] stickers, Embed[] embeds)
|
async Task<IUserMessage> IMessageChannel.SendFilesAsync(IEnumerable<FileAttachment> attachments, string text,
|
||||||
=> await SendFilesAsync(attachments, text, isTTS, embed, options, allowedMentions, messageReference, components, stickers, embeds).ConfigureAwait(false);
|
bool isTTS, Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference,
|
||||||
|
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
||||||
|
=> await SendFilesAsync(attachments, text, isTTS, embed, options, allowedMentions, messageReference, components, stickers, embeds, flags).ConfigureAwait(false);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent components, ISticker[] stickers, Embed[] embeds)
|
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options,
|
||||||
=> await SendMessageAsync(text, isTTS, embed, options, allowedMentions, messageReference, components, stickers, embeds).ConfigureAwait(false);
|
AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent components,
|
||||||
|
ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
||||||
|
=> await SendMessageAsync(text, isTTS, embed, options, allowedMentions, messageReference, components, stickers, embeds, flags).ConfigureAwait(false);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region IChannel
|
#region IChannel
|
||||||
|
|||||||
@@ -104,8 +104,12 @@ namespace Discord.Rest
|
|||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
/// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception>
|
/// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception>
|
||||||
public Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null)
|
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||||
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, allowedMentions, messageReference, components, stickers, options, embeds);
|
public 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)
|
||||||
|
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, allowedMentions, messageReference,
|
||||||
|
components, stickers, options, embeds, flags);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
/// <exception cref="ArgumentException">
|
/// <exception cref="ArgumentException">
|
||||||
@@ -132,20 +136,40 @@ namespace Discord.Rest
|
|||||||
/// <exception cref="NotSupportedException"><paramref name="filePath" /> is in an invalid format.</exception>
|
/// <exception cref="NotSupportedException"><paramref name="filePath" /> is in an invalid format.</exception>
|
||||||
/// <exception cref="IOException">An I/O error occurred while opening the file.</exception>
|
/// <exception cref="IOException">An I/O error occurred while opening the file.</exception>
|
||||||
/// <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(string filePath, string text, 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)
|
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||||
=> ChannelHelper.SendFileAsync(this, Discord, filePath, text, isTTS, embed, allowedMentions, messageReference, components, stickers, options, isSpoiler, embeds);
|
public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS = false, Embed embed = null,
|
||||||
|
RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null,
|
||||||
|
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
||||||
|
Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
|
||||||
|
=> ChannelHelper.SendFileAsync(this, Discord, filePath, text, isTTS, embed, allowedMentions, messageReference,
|
||||||
|
components, stickers, options, isSpoiler, embeds, flags);
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
/// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception>
|
/// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception>
|
||||||
public Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text, bool isTTS = false, Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null)
|
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||||
=> ChannelHelper.SendFileAsync(this, Discord, stream, filename, text, isTTS, embed, allowedMentions, messageReference, components, stickers, options, isSpoiler, embeds);
|
public Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text, bool isTTS = false,
|
||||||
|
Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null,
|
||||||
|
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
||||||
|
Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
|
||||||
|
=> ChannelHelper.SendFileAsync(this, Discord, stream, filename, text, isTTS, embed, allowedMentions,
|
||||||
|
messageReference, components, stickers, options, isSpoiler, embeds, flags);
|
||||||
/// <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, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null)
|
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||||
=> ChannelHelper.SendFileAsync(this, Discord, attachment, text, isTTS, embed, allowedMentions, messageReference, components, stickers, options, embeds);
|
public Task<RestUserMessage> SendFileAsync(FileAttachment attachment, string text, 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)
|
||||||
|
=> ChannelHelper.SendFileAsync(this, Discord, attachment, text, isTTS, embed, allowedMentions, messageReference,
|
||||||
|
components, stickers, options, embeds, flags);
|
||||||
/// <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, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null)
|
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||||
=> ChannelHelper.SendFilesAsync(this, Discord, attachments, text, isTTS, embed, allowedMentions, messageReference, components, stickers, options, embeds);
|
public Task<RestUserMessage> SendFilesAsync(IEnumerable<FileAttachment> attachments, string text, 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)
|
||||||
|
=> ChannelHelper.SendFilesAsync(this, Discord, attachments, text, isTTS, embed, allowedMentions,
|
||||||
|
messageReference, components, stickers, options, embeds, flags);
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public Task TriggerTypingAsync(RequestOptions options = null)
|
public Task TriggerTypingAsync(RequestOptions options = null)
|
||||||
=> ChannelHelper.TriggerTypingAsync(this, Discord, options);
|
=> ChannelHelper.TriggerTypingAsync(this, Discord, options);
|
||||||
@@ -197,17 +221,41 @@ namespace Discord.Rest
|
|||||||
async Task<IReadOnlyCollection<IMessage>> IMessageChannel.GetPinnedMessagesAsync(RequestOptions options)
|
async Task<IReadOnlyCollection<IMessage>> IMessageChannel.GetPinnedMessagesAsync(RequestOptions options)
|
||||||
=> await GetPinnedMessagesAsync(options).ConfigureAwait(false);
|
=> await GetPinnedMessagesAsync(options).ConfigureAwait(false);
|
||||||
|
|
||||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(string filePath, string text, bool isTTS, Embed embed, RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent components, ISticker[] stickers, Embed[] embeds)
|
/// <inheritdoc />
|
||||||
=> await SendFileAsync(filePath, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference, components, stickers, embeds).ConfigureAwait(false);
|
async Task<IUserMessage> IMessageChannel.SendFileAsync(string filePath, string text, bool isTTS, Embed embed,
|
||||||
|
RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference,
|
||||||
|
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
||||||
|
=> await SendFileAsync(filePath, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference,
|
||||||
|
components, stickers, embeds, flags).ConfigureAwait(false);
|
||||||
|
|
||||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS, Embed embed, RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent components, ISticker[] stickers, Embed[] embeds)
|
/// <inheritdoc />
|
||||||
=> await SendFileAsync(stream, filename, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference, components, stickers, embeds).ConfigureAwait(false);
|
async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS,
|
||||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(FileAttachment attachment, string text, bool isTTS, Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent components, ISticker[] stickers, Embed[] embeds)
|
Embed embed, RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference,
|
||||||
=> await SendFileAsync(attachment, text, isTTS, embed, options, allowedMentions, messageReference, components, stickers, embeds).ConfigureAwait(false);
|
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
||||||
async Task<IUserMessage> IMessageChannel.SendFilesAsync(IEnumerable<FileAttachment> attachments, string text, bool isTTS, Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent components, ISticker[] stickers, Embed[] embeds)
|
=> await SendFileAsync(stream, filename, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference,
|
||||||
=> await SendFilesAsync(attachments, text, isTTS, embed, options, allowedMentions, messageReference, components, stickers, embeds).ConfigureAwait(false);
|
components, stickers, embeds, flags).ConfigureAwait(false);
|
||||||
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent components, ISticker[] stickers, Embed[] embeds)
|
|
||||||
=> await SendMessageAsync(text, isTTS, embed, options, allowedMentions, messageReference, components, stickers, embeds).ConfigureAwait(false);
|
/// <inheritdoc />
|
||||||
|
async Task<IUserMessage> IMessageChannel.SendFileAsync(FileAttachment attachment, string text, bool isTTS,
|
||||||
|
Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference,
|
||||||
|
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
||||||
|
=> await SendFileAsync(attachment, text, isTTS, embed, options, allowedMentions, messageReference, components,
|
||||||
|
stickers, embeds, flags).ConfigureAwait(false);
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
async Task<IUserMessage> IMessageChannel.SendFilesAsync(IEnumerable<FileAttachment> attachments, string text,
|
||||||
|
bool isTTS, Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference,
|
||||||
|
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
||||||
|
=> await SendFilesAsync(attachments, text, isTTS, embed, options, allowedMentions, messageReference, components,
|
||||||
|
stickers, embeds, flags).ConfigureAwait(false);
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options,
|
||||||
|
AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent components,
|
||||||
|
ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
||||||
|
=> await SendMessageAsync(text, isTTS, embed, options, allowedMentions, messageReference, components,
|
||||||
|
stickers, embeds, flags).ConfigureAwait(false);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region IAudioChannel
|
#region IAudioChannel
|
||||||
|
|||||||
@@ -103,8 +103,12 @@ namespace Discord.Rest
|
|||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
/// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception>
|
/// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception>
|
||||||
public Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null)
|
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||||
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, allowedMentions, messageReference, components, stickers, options, embeds);
|
public 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)
|
||||||
|
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, allowedMentions, messageReference,
|
||||||
|
components, stickers, options, embeds, flags);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
/// <exception cref="ArgumentException">
|
/// <exception cref="ArgumentException">
|
||||||
@@ -131,23 +135,42 @@ namespace Discord.Rest
|
|||||||
/// <exception cref="NotSupportedException"><paramref name="filePath" /> is in an invalid format.</exception>
|
/// <exception cref="NotSupportedException"><paramref name="filePath" /> is in an invalid format.</exception>
|
||||||
/// <exception cref="IOException">An I/O error occurred while opening the file.</exception>
|
/// <exception cref="IOException">An I/O error occurred while opening the file.</exception>
|
||||||
/// <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(string filePath, string text, 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)
|
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||||
=> ChannelHelper.SendFileAsync(this, Discord, filePath, text, isTTS, embed, allowedMentions, messageReference, components, stickers, options, isSpoiler, embeds);
|
public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS = false, Embed embed = null,
|
||||||
|
RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null,
|
||||||
|
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
||||||
|
Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
|
||||||
|
=> ChannelHelper.SendFileAsync(this, Discord, filePath, text, isTTS, embed, allowedMentions, messageReference,
|
||||||
|
components, stickers, options, isSpoiler, embeds, flags);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
/// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception>
|
/// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception>
|
||||||
public Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text, bool isTTS = false, Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null)
|
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||||
=> ChannelHelper.SendFileAsync(this, Discord, stream, filename, text, isTTS, embed, allowedMentions, messageReference, components, stickers, options, isSpoiler, embeds);
|
public Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text, bool isTTS = false,
|
||||||
|
Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null,
|
||||||
|
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
||||||
|
Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
|
||||||
|
=> ChannelHelper.SendFileAsync(this, Discord, stream, filename, text, isTTS, embed, allowedMentions, messageReference,
|
||||||
|
components, stickers, options, isSpoiler, embeds, flags);
|
||||||
|
|
||||||
/// <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, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null)
|
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||||
=> ChannelHelper.SendFileAsync(this, Discord, attachment, text, isTTS, embed, allowedMentions, messageReference, components, stickers, options, embeds);
|
public Task<RestUserMessage> SendFileAsync(FileAttachment attachment, string text, 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)
|
||||||
|
=> ChannelHelper.SendFileAsync(this, Discord, attachment, text, isTTS, embed, allowedMentions, messageReference,
|
||||||
|
components, stickers, options, embeds, flags);
|
||||||
|
|
||||||
/// <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, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null)
|
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||||
=> ChannelHelper.SendFilesAsync(this, Discord, attachments, text, isTTS, embed, allowedMentions, messageReference, components, stickers, options, embeds);
|
public Task<RestUserMessage> SendFilesAsync(IEnumerable<FileAttachment> attachments, string text, 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)
|
||||||
|
=> ChannelHelper.SendFilesAsync(this, Discord, attachments, text, isTTS, embed, allowedMentions, messageReference, components, stickers, options, embeds, flags);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public Task DeleteMessageAsync(ulong messageId, RequestOptions options = null)
|
public Task DeleteMessageAsync(ulong messageId, RequestOptions options = null)
|
||||||
@@ -332,24 +355,37 @@ namespace Discord.Rest
|
|||||||
=> await GetPinnedMessagesAsync(options).ConfigureAwait(false);
|
=> await GetPinnedMessagesAsync(options).ConfigureAwait(false);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(string filePath, string text, bool isTTS, Embed embed, RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent components, ISticker[] stickers, Embed[] embeds)
|
async Task<IUserMessage> IMessageChannel.SendFileAsync(string filePath, string text, bool isTTS, Embed embed,
|
||||||
=> await SendFileAsync(filePath, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference, components, stickers, embeds).ConfigureAwait(false);
|
RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference,
|
||||||
|
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
||||||
|
=> await SendFileAsync(filePath, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference,
|
||||||
|
components, stickers, embeds, flags).ConfigureAwait(false);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS, Embed embed, RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent components, ISticker[] stickers, Embed[] embeds)
|
async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS,
|
||||||
=> await SendFileAsync(stream, filename, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference, components, stickers, embeds).ConfigureAwait(false);
|
Embed embed, RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference,
|
||||||
|
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
||||||
|
=> await SendFileAsync(stream, filename, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference,
|
||||||
|
components, stickers, embeds, flags).ConfigureAwait(false);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(FileAttachment attachment, string text, bool isTTS, Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent components, ISticker[] stickers, Embed[] embeds)
|
async Task<IUserMessage> IMessageChannel.SendFileAsync(FileAttachment attachment, string text, bool isTTS,
|
||||||
=> await SendFileAsync(attachment, text, isTTS, embed, options, allowedMentions, messageReference, components, stickers, embeds).ConfigureAwait(false);
|
Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference,
|
||||||
|
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
||||||
|
=> await SendFileAsync(attachment, text, isTTS, embed, options, allowedMentions, messageReference, components,
|
||||||
|
stickers, embeds, flags).ConfigureAwait(false);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
async Task<IUserMessage> IMessageChannel.SendFilesAsync(IEnumerable<FileAttachment> attachments, string text, bool isTTS, Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent components, ISticker[] stickers, Embed[] embeds)
|
async Task<IUserMessage> IMessageChannel.SendFilesAsync(IEnumerable<FileAttachment> attachments, string text,
|
||||||
=> await SendFilesAsync(attachments, text, isTTS, embed, options, allowedMentions, messageReference, components, stickers, embeds).ConfigureAwait(false);
|
bool isTTS, Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference,
|
||||||
|
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
||||||
|
=> await SendFilesAsync(attachments, text, isTTS, embed, options, allowedMentions, messageReference, components, stickers, embeds, flags).ConfigureAwait(false);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent components, ISticker[] stickers, Embed[] embeds)
|
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options,
|
||||||
=> await SendMessageAsync(text, isTTS, embed, options, allowedMentions, messageReference, components, stickers, embeds).ConfigureAwait(false);
|
AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent components,
|
||||||
|
ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
||||||
|
=> await SendMessageAsync(text, isTTS, embed, options, allowedMentions, messageReference, components, stickers, embeds, flags).ConfigureAwait(false);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region IGuildChannel
|
#region IGuildChannel
|
||||||
|
|||||||
@@ -18,83 +18,22 @@ namespace Discord.WebSocket
|
|||||||
/// </returns>
|
/// </returns>
|
||||||
IReadOnlyCollection<SocketMessage> CachedMessages { get; }
|
IReadOnlyCollection<SocketMessage> CachedMessages { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <inheritdoc cref="IMessageChannel.SendMessageAsync(string, bool, Embed, RequestOptions, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[], MessageFlags)"/>
|
||||||
/// Sends a message to this message channel.
|
new Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null,
|
||||||
/// </summary>
|
RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null,
|
||||||
/// <remarks>
|
MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null, MessageFlags flags = MessageFlags.None);
|
||||||
/// This method follows the same behavior as described in <see cref="IMessageChannel.SendMessageAsync"/>.
|
|
||||||
/// Please visit its documentation for more details on this method.
|
/// <inheritdoc cref="IMessageChannel.SendFileAsync(string, string, bool, Embed, RequestOptions, bool, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[], MessageFlags)"/>
|
||||||
/// </remarks>
|
new Task<RestUserMessage> SendFileAsync(string filePath, string text = null, bool isTTS = false, Embed embed = null,
|
||||||
/// <param name="text">The message to be sent.</param>
|
RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null,
|
||||||
/// <param name="isTTS">Determines whether the message should be read aloud by Discord or not.</param>
|
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
||||||
/// <param name="embed">The <see cref="Discord.EmbedType.Rich"/> <see cref="Embed"/> to be sent.</param>
|
Embed[] embeds = null, MessageFlags flags = MessageFlags.None);
|
||||||
/// <param name="options">The options to be used when sending the request.</param>
|
|
||||||
/// <param name="allowedMentions">
|
/// <inheritdoc cref="IMessageChannel.SendFileAsync(Stream, string, string, bool, Embed, RequestOptions, bool, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[], MessageFlags)"/>
|
||||||
/// Specifies if notifications are sent for mentioned users and roles in the message <paramref name="text"/>.
|
new Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text = null, bool isTTS = false,
|
||||||
/// If <c>null</c>, all mentioned roles and users will be notified.
|
Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null,
|
||||||
/// </param>
|
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
||||||
/// <param name="messageReference">The message references to be included. Used to reply to specific messages.</param>
|
Embed[] embeds = null, MessageFlags flags = MessageFlags.None);
|
||||||
/// <param name="components">The message components to be included with this message. Used for interactions.</param>
|
|
||||||
/// <param name="stickers">A collection of stickers to send with the message.</param>
|
|
||||||
/// <param name="embeds">A array of <see cref="Embed"/>s to send with this response. Max 10.</param>
|
|
||||||
/// <returns>
|
|
||||||
/// A task that represents an asynchronous send operation for delivering the message. The task result
|
|
||||||
/// contains the sent message.
|
|
||||||
/// </returns>
|
|
||||||
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);
|
|
||||||
/// <summary>
|
|
||||||
/// Sends a file to this message channel with an optional caption.
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>
|
|
||||||
/// This method follows the same behavior as described in <see cref="IMessageChannel.SendFileAsync(string, string, bool, Embed, RequestOptions, bool, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[])"/>.
|
|
||||||
/// Please visit its documentation for more details on this method.
|
|
||||||
/// </remarks>
|
|
||||||
/// <param name="filePath">The file path of the file.</param>
|
|
||||||
/// <param name="text">The message to be sent.</param>
|
|
||||||
/// <param name="isTTS">Whether the message should be read aloud by Discord or not.</param>
|
|
||||||
/// <param name="embed">The <see cref="Discord.EmbedType.Rich" /> <see cref="Embed" /> to be sent.</param>
|
|
||||||
/// <param name="options">The options to be used when sending the request.</param>
|
|
||||||
/// <param name="isSpoiler">Whether the message attachment should be hidden as a spoiler.</param>
|
|
||||||
/// <param name="allowedMentions">
|
|
||||||
/// Specifies if notifications are sent for mentioned users and roles in the message <paramref name="text"/>.
|
|
||||||
/// If <c>null</c>, all mentioned roles and users will be notified.
|
|
||||||
/// </param>
|
|
||||||
/// <param name="messageReference">The message references to be included. Used to reply to specific messages.</param>
|
|
||||||
/// <param name="components">The message components to be included with this message. Used for interactions.</param>
|
|
||||||
/// <param name="stickers">A collection of stickers to send with the file.</param>
|
|
||||||
/// <param name="embeds">A array of <see cref="Embed"/>s to send with this response. Max 10.</param>
|
|
||||||
/// <returns>
|
|
||||||
/// A task that represents an asynchronous send operation for delivering the message. The task result
|
|
||||||
/// contains the sent message.
|
|
||||||
/// </returns>
|
|
||||||
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);
|
|
||||||
/// <summary>
|
|
||||||
/// Sends a file to this message channel with an optional caption.
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>
|
|
||||||
/// This method follows the same behavior as described in <see cref="IMessageChannel.SendFileAsync(Stream, string, string, bool, Embed, RequestOptions, bool, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[])"/>.
|
|
||||||
/// Please visit its documentation for more details on this method.
|
|
||||||
/// </remarks>
|
|
||||||
/// <param name="stream">The <see cref="Stream" /> of the file to be sent.</param>
|
|
||||||
/// <param name="filename">The name of the attachment.</param>
|
|
||||||
/// <param name="text">The message to be sent.</param>
|
|
||||||
/// <param name="isTTS">Whether the message should be read aloud by Discord or not.</param>
|
|
||||||
/// <param name="embed">The <see cref="Discord.EmbedType.Rich"/> <see cref="Embed"/> to be sent.</param>
|
|
||||||
/// <param name="options">The options to be used when sending the request.</param>
|
|
||||||
/// <param name="isSpoiler">Whether the message attachment should be hidden as a spoiler.</param>
|
|
||||||
/// <param name="allowedMentions">
|
|
||||||
/// Specifies if notifications are sent for mentioned users and roles in the message <paramref name="text"/>.
|
|
||||||
/// If <c>null</c>, all mentioned roles and users will be notified.
|
|
||||||
/// </param>
|
|
||||||
/// <param name="messageReference">The message references to be included. Used to reply to specific messages.</param>
|
|
||||||
/// <param name="components">The message components to be included with this message. Used for interactions.</param>
|
|
||||||
/// <param name="stickers">A collection of stickers to send with the file.</param>
|
|
||||||
/// <param name="embeds">A array of <see cref="Embed"/>s to send with this response. Max 10.</param>
|
|
||||||
/// <returns>
|
|
||||||
/// A task that represents an asynchronous send operation for delivering the message. The task result
|
|
||||||
/// contains the sent message.
|
|
||||||
/// </returns>
|
|
||||||
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);
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a cached message from this channel.
|
/// Gets a cached message from this channel.
|
||||||
|
|||||||
@@ -139,24 +139,48 @@ namespace Discord.WebSocket
|
|||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
/// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception>
|
/// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception>
|
||||||
public Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null)
|
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||||
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, allowedMentions, messageReference, components, stickers, options, embeds);
|
public 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)
|
||||||
|
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, allowedMentions, messageReference,
|
||||||
|
components, stickers, options, embeds, flags);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS = false, Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null)
|
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||||
=> ChannelHelper.SendFileAsync(this, Discord, filePath, text, isTTS, embed, allowedMentions, messageReference, components, stickers, options, isSpoiler, embeds);
|
public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS = false, Embed embed = null,
|
||||||
|
RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null,
|
||||||
|
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
||||||
|
Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
|
||||||
|
=> ChannelHelper.SendFileAsync(this, Discord, filePath, text, isTTS, embed, allowedMentions, messageReference,
|
||||||
|
components, stickers, options, isSpoiler, embeds, flags);
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
/// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception>
|
/// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception>
|
||||||
public Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text, bool isTTS = false, Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null)
|
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||||
=> ChannelHelper.SendFileAsync(this, Discord, stream, filename, text, isTTS, embed, allowedMentions, messageReference, components, stickers, options, isSpoiler, embeds);
|
public Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text, bool isTTS = false,
|
||||||
|
Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null,
|
||||||
|
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
||||||
|
Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
|
||||||
|
=> ChannelHelper.SendFileAsync(this, Discord, stream, filename, text, isTTS, embed, allowedMentions,
|
||||||
|
messageReference, components, stickers, options, isSpoiler, embeds, flags);
|
||||||
/// <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, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null)
|
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||||
=> ChannelHelper.SendFileAsync(this, Discord, attachment, text, isTTS, embed, allowedMentions, messageReference, components, stickers, options, embeds);
|
public Task<RestUserMessage> SendFileAsync(FileAttachment attachment, string text, 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)
|
||||||
|
=> ChannelHelper.SendFileAsync(this, Discord, attachment, text, isTTS, embed, allowedMentions,
|
||||||
|
messageReference, components, stickers, options, embeds, flags);
|
||||||
/// <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, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null)
|
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||||
=> ChannelHelper.SendFilesAsync(this, Discord, attachments, text, isTTS, embed, allowedMentions, messageReference, components, stickers, options, embeds);
|
public Task<RestUserMessage> SendFilesAsync(IEnumerable<FileAttachment> attachments, string text, 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)
|
||||||
|
=> ChannelHelper.SendFilesAsync(this, Discord, attachments, text, isTTS, embed, allowedMentions,
|
||||||
|
messageReference, components, stickers, options, embeds, flags);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public Task DeleteMessageAsync(ulong messageId, RequestOptions options = null)
|
public Task DeleteMessageAsync(ulong messageId, RequestOptions options = null)
|
||||||
@@ -255,20 +279,37 @@ namespace Discord.WebSocket
|
|||||||
async Task<IReadOnlyCollection<IMessage>> IMessageChannel.GetPinnedMessagesAsync(RequestOptions options)
|
async Task<IReadOnlyCollection<IMessage>> IMessageChannel.GetPinnedMessagesAsync(RequestOptions options)
|
||||||
=> await GetPinnedMessagesAsync(options).ConfigureAwait(false);
|
=> await GetPinnedMessagesAsync(options).ConfigureAwait(false);
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(string filePath, string text, bool isTTS, Embed embed, RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent components, ISticker[] stickers, Embed[] embeds)
|
async Task<IUserMessage> IMessageChannel.SendFileAsync(string filePath, string text, bool isTTS, Embed embed,
|
||||||
=> await SendFileAsync(filePath, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference, components, stickers, embeds).ConfigureAwait(false);
|
RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference,
|
||||||
|
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
||||||
|
=> await SendFileAsync(filePath, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference,
|
||||||
|
components, stickers, embeds, flags).ConfigureAwait(false);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS, Embed embed, RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent components, ISticker[] stickers, Embed[] embeds)
|
async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS,
|
||||||
=> await SendFileAsync(stream, filename, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference, components, stickers, embeds).ConfigureAwait(false);
|
Embed embed, RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference,
|
||||||
|
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
||||||
|
=> await SendFileAsync(stream, filename, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference,
|
||||||
|
components, stickers, embeds, flags).ConfigureAwait(false);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(FileAttachment attachment, string text, bool isTTS, Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent components, ISticker[] stickers, Embed[] embeds)
|
async Task<IUserMessage> IMessageChannel.SendFileAsync(FileAttachment attachment, string text, bool isTTS,
|
||||||
=> await SendFileAsync(attachment, text, isTTS, embed, options, allowedMentions, messageReference, components, stickers, embeds).ConfigureAwait(false);
|
Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference,
|
||||||
|
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
||||||
|
=> await SendFileAsync(attachment, text, isTTS, embed, options, allowedMentions, messageReference, components,
|
||||||
|
stickers, embeds, flags).ConfigureAwait(false);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
async Task<IUserMessage> IMessageChannel.SendFilesAsync(IEnumerable<FileAttachment> attachments, string text, bool isTTS, Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent components, ISticker[] stickers, Embed[] embeds)
|
async Task<IUserMessage> IMessageChannel.SendFilesAsync(IEnumerable<FileAttachment> attachments, string text,
|
||||||
=> await SendFilesAsync(attachments, text, isTTS, embed, options, allowedMentions, messageReference, components, stickers, embeds).ConfigureAwait(false);
|
bool isTTS, Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference,
|
||||||
|
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
||||||
|
=> await SendFilesAsync(attachments, text, isTTS, embed, options, allowedMentions, messageReference, components, stickers, embeds, flags).ConfigureAwait(false);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent components, ISticker[] stickers, Embed[] embeds)
|
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options,
|
||||||
=> await SendMessageAsync(text, isTTS, embed, options, allowedMentions, messageReference, components, stickers, embeds).ConfigureAwait(false);
|
AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent components,
|
||||||
|
ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
||||||
|
=> await SendMessageAsync(text, isTTS, embed, options, allowedMentions, messageReference, components, stickers, embeds, flags).ConfigureAwait(false);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region IChannel
|
#region IChannel
|
||||||
|
|||||||
@@ -178,24 +178,48 @@ namespace Discord.WebSocket
|
|||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
/// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception>
|
/// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception>
|
||||||
public Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null)
|
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||||
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, allowedMentions, messageReference, components, stickers, options, embeds);
|
public 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)
|
||||||
|
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, allowedMentions, messageReference,
|
||||||
|
components, stickers, options, embeds, flags);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS = false, Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null)
|
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||||
=> ChannelHelper.SendFileAsync(this, Discord, filePath, text, isTTS, embed, allowedMentions, messageReference, components, stickers, options, isSpoiler, embeds);
|
public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS = false, Embed embed = null,
|
||||||
|
RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null,
|
||||||
|
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
||||||
|
Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
|
||||||
|
=> ChannelHelper.SendFileAsync(this, Discord, filePath, text, isTTS, embed, allowedMentions, messageReference,
|
||||||
|
components, stickers, options, isSpoiler, embeds, flags);
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
/// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception>
|
/// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception>
|
||||||
public Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text, bool isTTS = false, Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null)
|
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||||
=> ChannelHelper.SendFileAsync(this, Discord, stream, filename, text, isTTS, embed, allowedMentions, messageReference, components, stickers, options, isSpoiler, embeds);
|
public Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text, bool isTTS = false,
|
||||||
|
Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null,
|
||||||
|
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
||||||
|
Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
|
||||||
|
=> ChannelHelper.SendFileAsync(this, Discord, stream, filename, text, isTTS, embed, allowedMentions,
|
||||||
|
messageReference, components, stickers, options, isSpoiler, embeds, flags);
|
||||||
/// <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, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null)
|
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||||
=> ChannelHelper.SendFileAsync(this, Discord, attachment, text, isTTS, embed, allowedMentions, messageReference, components, stickers, options, embeds);
|
public Task<RestUserMessage> SendFileAsync(FileAttachment attachment, string text, 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)
|
||||||
|
=> ChannelHelper.SendFileAsync(this, Discord, attachment, text, isTTS, embed, allowedMentions,
|
||||||
|
messageReference, components, stickers, options, embeds, flags);
|
||||||
/// <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, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null)
|
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||||
=> ChannelHelper.SendFilesAsync(this, Discord, attachments, text, isTTS, embed, allowedMentions, messageReference, components, stickers, options, embeds);
|
public Task<RestUserMessage> SendFilesAsync(IEnumerable<FileAttachment> attachments, string text, 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)
|
||||||
|
=> ChannelHelper.SendFilesAsync(this, Discord, attachments, text, isTTS, embed, allowedMentions,
|
||||||
|
messageReference, components, stickers, options, embeds, flags);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public Task DeleteMessageAsync(ulong messageId, RequestOptions options = null)
|
public Task DeleteMessageAsync(ulong messageId, RequestOptions options = null)
|
||||||
@@ -327,21 +351,37 @@ namespace Discord.WebSocket
|
|||||||
=> await GetPinnedMessagesAsync(options).ConfigureAwait(false);
|
=> await GetPinnedMessagesAsync(options).ConfigureAwait(false);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(string filePath, string text, bool isTTS, Embed embed, RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent components, ISticker[] stickers, Embed[] embeds)
|
async Task<IUserMessage> IMessageChannel.SendFileAsync(string filePath, string text, bool isTTS, Embed embed,
|
||||||
=> await SendFileAsync(filePath, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference, components, stickers, embeds).ConfigureAwait(false);
|
RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference,
|
||||||
/// <inheritdoc />
|
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
||||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS, Embed embed, RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent components, ISticker[] stickers, Embed[] embeds)
|
=> await SendFileAsync(filePath, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference,
|
||||||
=> await SendFileAsync(stream, filename, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference, components, stickers, embeds).ConfigureAwait(false);
|
components, stickers, embeds, flags).ConfigureAwait(false);
|
||||||
/// <inheritdoc />
|
|
||||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(FileAttachment attachment, string text, bool isTTS, Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent components, ISticker[] stickers, Embed[] embeds)
|
|
||||||
=> await SendFileAsync(attachment, text, isTTS, embed, options, allowedMentions, messageReference, components, stickers, embeds).ConfigureAwait(false);
|
|
||||||
/// <inheritdoc />
|
|
||||||
async Task<IUserMessage> IMessageChannel.SendFilesAsync(IEnumerable<FileAttachment> attachments, string text, bool isTTS, Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent components, ISticker[] stickers, Embed[] embeds)
|
|
||||||
=> await SendFilesAsync(attachments, text, isTTS, embed, options, allowedMentions, messageReference, components, stickers, embeds).ConfigureAwait(false);
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent components, ISticker[] stickers, Embed[] embeds)
|
async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS,
|
||||||
=> await SendMessageAsync(text, isTTS, embed, options, allowedMentions, messageReference, components, stickers, embeds).ConfigureAwait(false);
|
Embed embed, RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference,
|
||||||
|
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
||||||
|
=> await SendFileAsync(stream, filename, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference,
|
||||||
|
components, stickers, embeds, flags).ConfigureAwait(false);
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
async Task<IUserMessage> IMessageChannel.SendFileAsync(FileAttachment attachment, string text, bool isTTS,
|
||||||
|
Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference,
|
||||||
|
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
||||||
|
=> await SendFileAsync(attachment, text, isTTS, embed, options, allowedMentions, messageReference, components,
|
||||||
|
stickers, embeds, flags).ConfigureAwait(false);
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
async Task<IUserMessage> IMessageChannel.SendFilesAsync(IEnumerable<FileAttachment> attachments, string text,
|
||||||
|
bool isTTS, Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference,
|
||||||
|
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
||||||
|
=> await SendFilesAsync(attachments, text, isTTS, embed, options, allowedMentions, messageReference, components, stickers, embeds, flags).ConfigureAwait(false);
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options,
|
||||||
|
AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent components,
|
||||||
|
ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
||||||
|
=> await SendMessageAsync(text, isTTS, embed, options, allowedMentions, messageReference, components, stickers, embeds, flags).ConfigureAwait(false);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region IAudioChannel
|
#region IAudioChannel
|
||||||
|
|||||||
@@ -212,27 +212,48 @@ namespace Discord.WebSocket
|
|||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
/// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception>
|
/// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception>
|
||||||
public Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null)
|
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||||
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, allowedMentions, messageReference, components, stickers, options, embeds);
|
public 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)
|
||||||
|
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, allowedMentions, messageReference,
|
||||||
|
components, stickers, options, embeds, flags);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS = false, Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null)
|
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||||
=> ChannelHelper.SendFileAsync(this, Discord, filePath, text, isTTS, embed, allowedMentions, messageReference, components, stickers, options, isSpoiler, embeds);
|
public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS = false, Embed embed = null,
|
||||||
|
RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null,
|
||||||
|
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
||||||
|
Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
|
||||||
|
=> ChannelHelper.SendFileAsync(this, Discord, filePath, text, isTTS, embed, allowedMentions, messageReference,
|
||||||
|
components, stickers, options, isSpoiler, embeds, flags);
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
/// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception>
|
/// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception>
|
||||||
public Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text, bool isTTS = false, Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null)
|
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||||
=> ChannelHelper.SendFileAsync(this, Discord, stream, filename, text, isTTS, embed, allowedMentions, messageReference, components, stickers, options, isSpoiler, embeds);
|
public Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text, bool isTTS = false,
|
||||||
|
Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null,
|
||||||
|
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
||||||
|
Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
|
||||||
|
=> ChannelHelper.SendFileAsync(this, Discord, stream, filename, text, isTTS, embed, allowedMentions,
|
||||||
|
messageReference, components, stickers, options, isSpoiler, embeds, flags);
|
||||||
/// <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, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null)
|
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||||
=> ChannelHelper.SendFileAsync(this, Discord, attachment, text, isTTS, embed, allowedMentions, messageReference, components, stickers, options, embeds);
|
public Task<RestUserMessage> SendFileAsync(FileAttachment attachment, string text, 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)
|
||||||
|
=> ChannelHelper.SendFileAsync(this, Discord, attachment, text, isTTS, embed, allowedMentions,
|
||||||
|
messageReference, components, stickers, options, embeds, flags);
|
||||||
/// <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, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null)
|
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||||
=> ChannelHelper.SendFilesAsync(this, Discord, attachments, text, isTTS, embed, allowedMentions, messageReference, components, stickers, options, embeds);
|
public Task<RestUserMessage> SendFilesAsync(IEnumerable<FileAttachment> attachments, string text, 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)
|
||||||
|
=> ChannelHelper.SendFilesAsync(this, Discord, attachments, text, isTTS, embed, allowedMentions,
|
||||||
|
messageReference, components, stickers, options, embeds, flags);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public Task DeleteMessagesAsync(IEnumerable<IMessage> messages, RequestOptions options = null)
|
public Task DeleteMessagesAsync(IEnumerable<IMessage> messages, RequestOptions options = null)
|
||||||
@@ -396,20 +417,38 @@ namespace Discord.WebSocket
|
|||||||
=> await GetPinnedMessagesAsync(options).ConfigureAwait(false);
|
=> await GetPinnedMessagesAsync(options).ConfigureAwait(false);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(string filePath, string text, bool isTTS, Embed embed, RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent components, ISticker[] stickers, Embed[] embeds)
|
async Task<IUserMessage> IMessageChannel.SendFileAsync(string filePath, string text, bool isTTS, Embed embed,
|
||||||
=> await SendFileAsync(filePath, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference, components, stickers, embeds).ConfigureAwait(false);
|
RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference,
|
||||||
|
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
||||||
|
=> await SendFileAsync(filePath, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference,
|
||||||
|
components, stickers, embeds, flags).ConfigureAwait(false);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS, Embed embed, RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent components, ISticker[] stickers, Embed[] embeds)
|
async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS,
|
||||||
=> await SendFileAsync(stream, filename, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference, components, stickers, embeds).ConfigureAwait(false);
|
Embed embed, RequestOptions options, bool isSpoiler, AllowedMentions allowedMentions, MessageReference messageReference,
|
||||||
|
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
||||||
|
=> await SendFileAsync(stream, filename, text, isTTS, embed, options, isSpoiler, allowedMentions, messageReference,
|
||||||
|
components, stickers, embeds, flags).ConfigureAwait(false);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(FileAttachment attachment, string text, bool isTTS, Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent components, ISticker[] stickers, Embed[] embeds)
|
async Task<IUserMessage> IMessageChannel.SendFileAsync(FileAttachment attachment, string text, bool isTTS,
|
||||||
=> await SendFileAsync(attachment, text, isTTS, embed, options, allowedMentions, messageReference, components, stickers, embeds).ConfigureAwait(false);
|
Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference,
|
||||||
|
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
||||||
|
=> await SendFileAsync(attachment, text, isTTS, embed, options, allowedMentions, messageReference, components,
|
||||||
|
stickers, embeds, flags).ConfigureAwait(false);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
async Task<IUserMessage> IMessageChannel.SendFilesAsync(IEnumerable<FileAttachment> attachments, string text, bool isTTS, Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent components, ISticker[] stickers, Embed[] embeds)
|
async Task<IUserMessage> IMessageChannel.SendFilesAsync(IEnumerable<FileAttachment> attachments, string text,
|
||||||
=> await SendFilesAsync(attachments, text, isTTS, embed, options, allowedMentions, messageReference, components, stickers, embeds).ConfigureAwait(false);
|
bool isTTS, Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference,
|
||||||
|
MessageComponent components, ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
||||||
|
=> await SendFilesAsync(attachments, text, isTTS, embed, options, allowedMentions, messageReference, components, stickers, embeds, flags).ConfigureAwait(false);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options, AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent components, ISticker[] stickers, Embed[] embeds)
|
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options,
|
||||||
=> await SendMessageAsync(text, isTTS, embed, options, allowedMentions, messageReference, components, stickers, embeds).ConfigureAwait(false);
|
AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent components,
|
||||||
|
ISticker[] stickers, Embed[] embeds, MessageFlags flags)
|
||||||
|
=> await SendMessageAsync(text, isTTS, embed, options, allowedMentions, messageReference, components, stickers, embeds, flags).ConfigureAwait(false);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region INestedChannel
|
#region INestedChannel
|
||||||
|
|||||||
@@ -87,8 +87,9 @@ namespace Discord.Webhook
|
|||||||
/// <summary> Sends a message to the channel for this webhook. </summary>
|
/// <summary> Sends a message to the channel for this webhook. </summary>
|
||||||
/// <returns> Returns the ID of the created message. </returns>
|
/// <returns> Returns the ID of the created message. </returns>
|
||||||
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, MessageComponent components = null)
|
string username = null, string avatarUrl = null, RequestOptions options = null, AllowedMentions allowedMentions = null,
|
||||||
=> WebhookClientHelper.SendMessageAsync(this, text, isTTS, embeds, username, avatarUrl, allowedMentions, options, components);
|
MessageComponent components = null, MessageFlags flags = MessageFlags.None)
|
||||||
|
=> WebhookClientHelper.SendMessageAsync(this, text, isTTS, embeds, username, avatarUrl, allowedMentions, options, components, flags);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Modifies a message posted using this webhook.
|
/// Modifies a message posted using this webhook.
|
||||||
@@ -124,33 +125,35 @@ namespace Discord.Webhook
|
|||||||
public Task<ulong> SendFileAsync(string filePath, string text, bool isTTS = false,
|
public Task<ulong> SendFileAsync(string filePath, 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, bool isSpoiler = false, AllowedMentions allowedMentions = null,
|
RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null,
|
||||||
MessageComponent components = null)
|
MessageComponent components = null, MessageFlags flags = MessageFlags.None)
|
||||||
=> WebhookClientHelper.SendFileAsync(this, filePath, text, isTTS, embeds, username, avatarUrl,
|
=> WebhookClientHelper.SendFileAsync(this, filePath, text, isTTS, embeds, username, avatarUrl,
|
||||||
allowedMentions, options, isSpoiler, components);
|
allowedMentions, options, isSpoiler, components, flags);
|
||||||
/// <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(Stream stream, string filename, string text, bool isTTS = false,
|
public Task<ulong> SendFileAsync(Stream stream, string filename, 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, bool isSpoiler = false, AllowedMentions allowedMentions = null,
|
RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null,
|
||||||
MessageComponent components = null)
|
MessageComponent components = null, MessageFlags flags = MessageFlags.None)
|
||||||
=> WebhookClientHelper.SendFileAsync(this, stream, filename, text, isTTS, embeds, username,
|
=> WebhookClientHelper.SendFileAsync(this, stream, filename, text, isTTS, embeds, username,
|
||||||
avatarUrl, allowedMentions, options, isSpoiler, components);
|
avatarUrl, allowedMentions, options, isSpoiler, components, flags);
|
||||||
|
|
||||||
/// <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)
|
||||||
=> WebhookClientHelper.SendFileAsync(this, attachment, text, isTTS, embeds, username,
|
=> WebhookClientHelper.SendFileAsync(this, attachment, text, isTTS, embeds, username,
|
||||||
avatarUrl, allowedMentions, components, options);
|
avatarUrl, allowedMentions, components, options, flags);
|
||||||
|
|
||||||
/// <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> 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)
|
||||||
=> WebhookClientHelper.SendFilesAsync(this, attachments, text, isTTS, embeds, username, avatarUrl,
|
=> WebhookClientHelper.SendFilesAsync(this, attachments, text, isTTS, embeds, username, avatarUrl,
|
||||||
allowedMentions, components, options);
|
allowedMentions, components, options, flags);
|
||||||
|
|
||||||
|
|
||||||
/// <summary> Modifies the properties of this webhook. </summary>
|
/// <summary> Modifies the properties of this webhook. </summary>
|
||||||
|
|||||||
@@ -21,12 +21,14 @@ namespace Discord.Webhook
|
|||||||
return RestInternalWebhook.Create(client, model);
|
return RestInternalWebhook.Create(client, model);
|
||||||
}
|
}
|
||||||
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, AllowedMentions allowedMentions, RequestOptions options, MessageComponent components)
|
string text, bool isTTS, IEnumerable<Embed> embeds, string username, string avatarUrl,
|
||||||
|
AllowedMentions allowedMentions, RequestOptions options, MessageComponent components, MessageFlags flags)
|
||||||
{
|
{
|
||||||
var args = new CreateWebhookMessageParams
|
var args = new CreateWebhookMessageParams
|
||||||
{
|
{
|
||||||
Content = text,
|
Content = text,
|
||||||
IsTTS = isTTS
|
IsTTS = isTTS,
|
||||||
|
Flags = flags
|
||||||
};
|
};
|
||||||
|
|
||||||
if (embeds != null)
|
if (embeds != null)
|
||||||
@@ -40,6 +42,9 @@ namespace Discord.Webhook
|
|||||||
if (components != null)
|
if (components != null)
|
||||||
args.Components = components?.Components.Select(x => new API.ActionRowComponent(x)).ToArray();
|
args.Components = components?.Components.Select(x => new API.ActionRowComponent(x)).ToArray();
|
||||||
|
|
||||||
|
if (flags is not MessageFlags.None and not MessageFlags.SuppressEmbeds)
|
||||||
|
throw new ArgumentException("The only valid MessageFlags are SuppressEmbeds and none.", nameof(flags));
|
||||||
|
|
||||||
var model = await client.ApiClient.CreateWebhookMessageAsync(client.Webhook.Id, args, options: options).ConfigureAwait(false);
|
var model = await client.ApiClient.CreateWebhookMessageAsync(client.Webhook.Id, args, options: options).ConfigureAwait(false);
|
||||||
return model.Id;
|
return model.Id;
|
||||||
}
|
}
|
||||||
@@ -97,22 +102,27 @@ namespace Discord.Webhook
|
|||||||
await client.ApiClient.DeleteWebhookMessageAsync(client.Webhook.Id, messageId, options).ConfigureAwait(false);
|
await client.ApiClient.DeleteWebhookMessageAsync(client.Webhook.Id, messageId, options).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
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, bool isSpoiler, MessageComponent components)
|
IEnumerable<Embed> embeds, string username, string avatarUrl, AllowedMentions allowedMentions, RequestOptions options,
|
||||||
|
bool isSpoiler, MessageComponent components, MessageFlags flags = MessageFlags.None)
|
||||||
{
|
{
|
||||||
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).ConfigureAwait(false);
|
return await SendFileAsync(client, file, filename, text, isTTS, embeds, username, avatarUrl, allowedMentions, options, isSpoiler, components, flags).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)
|
MessageComponent components, MessageFlags flags)
|
||||||
=> SendFileAsync(client, new FileAttachment(stream, filename, isSpoiler: isSpoiler), text, isTTS, embeds, username, avatarUrl, allowedMentions, components, options);
|
=> SendFileAsync(client, new FileAttachment(stream, filename, isSpoiler: isSpoiler), text, isTTS, embeds, username, avatarUrl, allowedMentions, components, options, flags);
|
||||||
|
|
||||||
public static Task<ulong> SendFileAsync(DiscordWebhookClient client, FileAttachment attachment, string text, bool isTTS, IEnumerable<Embed> embeds, string username, string avatarUrl, AllowedMentions allowedMentions, MessageComponent components, RequestOptions options)
|
public static Task<ulong> SendFileAsync(DiscordWebhookClient client, FileAttachment attachment, string text, bool isTTS,
|
||||||
=> SendFilesAsync(client, new FileAttachment[] { attachment }, text, isTTS, embeds, username, avatarUrl, allowedMentions, components, options);
|
IEnumerable<Embed> embeds, string username, string avatarUrl, AllowedMentions allowedMentions,
|
||||||
|
MessageComponent components, RequestOptions options, MessageFlags flags)
|
||||||
|
=> SendFilesAsync(client, new FileAttachment[] { attachment }, text, isTTS, embeds, username, avatarUrl, allowedMentions, components, options, flags);
|
||||||
|
|
||||||
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, string avatarUrl, AllowedMentions allowedMentions, MessageComponent components, RequestOptions options)
|
IEnumerable<FileAttachment> attachments, string text, bool isTTS, IEnumerable<Embed> embeds, string username,
|
||||||
|
string avatarUrl, AllowedMentions allowedMentions, MessageComponent components, RequestOptions options,
|
||||||
|
MessageFlags flags)
|
||||||
{
|
{
|
||||||
embeds ??= Array.Empty<Embed>();
|
embeds ??= Array.Empty<Embed>();
|
||||||
|
|
||||||
@@ -141,7 +151,19 @@ namespace Discord.Webhook
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var args = new UploadWebhookFileParams(attachments.ToArray()) {AvatarUrl = avatarUrl, Username = username, 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 };
|
if (flags is not MessageFlags.None and not MessageFlags.SuppressEmbeds)
|
||||||
|
throw new ArgumentException("The only valid MessageFlags are SuppressEmbeds and none.", nameof(flags));
|
||||||
|
|
||||||
|
var args = new UploadWebhookFileParams(attachments.ToArray())
|
||||||
|
{
|
||||||
|
AvatarUrl = avatarUrl,
|
||||||
|
Username = username, 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,
|
||||||
|
Flags = flags
|
||||||
|
};
|
||||||
var msg = await client.ApiClient.UploadWebhookFileAsync(client.Webhook.Id, args, options).ConfigureAwait(false);
|
var msg = await client.ApiClient.UploadWebhookFileAsync(client.Webhook.Id, args, options).ConfigureAwait(false);
|
||||||
return msg.Id;
|
return msg.Id;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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) => 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> 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) => 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(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) => 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(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) => 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> 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) => 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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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)
|
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();
|
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)
|
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();
|
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)
|
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();
|
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) => 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> 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) => 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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -176,17 +176,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)
|
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();
|
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)
|
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();
|
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)
|
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();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
@@ -211,9 +211,10 @@ 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) => 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> 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) => 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<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, 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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user