[Feature] Refactor SendMessageAsync & SendFile(s)Async methods & modify webhook message attachments (#2609)
* initial commit * resolve merge conficts * code review suggestions
This commit is contained in:
@@ -148,7 +148,7 @@ namespace Discord.WebSocket
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||
public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS = false, Embed embed = null,
|
||||
public Task<RestUserMessage> SendFileAsync(string filePath, string text = null, bool isTTS = false, Embed embed = null,
|
||||
RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null,
|
||||
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
||||
Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
|
||||
@@ -157,7 +157,7 @@ namespace Discord.WebSocket
|
||||
/// <inheritdoc />
|
||||
/// <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 Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text, bool isTTS = false,
|
||||
public Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text = null, bool isTTS = false,
|
||||
Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null,
|
||||
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
||||
Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
|
||||
@@ -166,7 +166,7 @@ namespace Discord.WebSocket
|
||||
/// <inheritdoc />
|
||||
/// <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 Task<RestUserMessage> SendFileAsync(FileAttachment attachment, string text, bool isTTS = false,
|
||||
public Task<RestUserMessage> SendFileAsync(FileAttachment attachment, string text = null, bool isTTS = false,
|
||||
Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null,
|
||||
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
||||
Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
|
||||
@@ -175,7 +175,7 @@ namespace Discord.WebSocket
|
||||
/// <inheritdoc />
|
||||
/// <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 Task<RestUserMessage> SendFilesAsync(IEnumerable<FileAttachment> attachments, string text, bool isTTS = false,
|
||||
public Task<RestUserMessage> SendFilesAsync(IEnumerable<FileAttachment> attachments, string text = null, bool isTTS = false,
|
||||
Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null,
|
||||
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
||||
Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
|
||||
|
||||
@@ -187,7 +187,7 @@ namespace Discord.WebSocket
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||
public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS = false, Embed embed = null,
|
||||
public Task<RestUserMessage> SendFileAsync(string filePath, string text = null, bool isTTS = false, Embed embed = null,
|
||||
RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null,
|
||||
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
||||
Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
|
||||
@@ -196,7 +196,7 @@ namespace Discord.WebSocket
|
||||
/// <inheritdoc />
|
||||
/// <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 Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text, bool isTTS = false,
|
||||
public Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text = null, bool isTTS = false,
|
||||
Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null,
|
||||
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
||||
Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
|
||||
@@ -205,7 +205,7 @@ namespace Discord.WebSocket
|
||||
/// <inheritdoc />
|
||||
/// <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 Task<RestUserMessage> SendFileAsync(FileAttachment attachment, string text, bool isTTS = false,
|
||||
public Task<RestUserMessage> SendFileAsync(FileAttachment attachment, string text = null, bool isTTS = false,
|
||||
Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null,
|
||||
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
||||
Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
|
||||
@@ -214,7 +214,7 @@ namespace Discord.WebSocket
|
||||
/// <inheritdoc />
|
||||
/// <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 Task<RestUserMessage> SendFilesAsync(IEnumerable<FileAttachment> attachments, string text, bool isTTS = false,
|
||||
public Task<RestUserMessage> SendFilesAsync(IEnumerable<FileAttachment> attachments, string text = null, bool isTTS = false,
|
||||
Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null,
|
||||
MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null,
|
||||
Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
|
||||
|
||||
@@ -222,7 +222,7 @@ namespace Discord.WebSocket
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception>
|
||||
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/>, <see cref="MessageFlags.SuppressNotification"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||
public virtual 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)
|
||||
@@ -230,8 +230,8 @@ namespace Discord.WebSocket
|
||||
components, stickers, options, embeds, flags);
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||
public virtual Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS = false, Embed embed = null,
|
||||
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/>, <see cref="MessageFlags.SuppressNotification"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||
public virtual Task<RestUserMessage> SendFileAsync(string filePath, string text = null, bool isTTS = false, Embed embed = null,
|
||||
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)
|
||||
@@ -239,8 +239,8 @@ namespace Discord.WebSocket
|
||||
components, stickers, options, isSpoiler, embeds, flags);
|
||||
/// <inheritdoc />
|
||||
/// <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 virtual Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text, bool isTTS = false,
|
||||
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/>, <see cref="MessageFlags.SuppressNotification"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||
public virtual Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text = null, bool isTTS = false,
|
||||
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)
|
||||
@@ -248,8 +248,8 @@ namespace Discord.WebSocket
|
||||
messageReference, components, stickers, options, isSpoiler, embeds, flags);
|
||||
/// <inheritdoc />
|
||||
/// <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 virtual Task<RestUserMessage> SendFileAsync(FileAttachment attachment, string text, bool isTTS = false,
|
||||
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/>, <see cref="MessageFlags.SuppressNotification"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||
public virtual Task<RestUserMessage> SendFileAsync(FileAttachment attachment, string text = null, bool isTTS = false,
|
||||
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)
|
||||
@@ -257,8 +257,8 @@ namespace Discord.WebSocket
|
||||
messageReference, components, stickers, options, embeds, flags);
|
||||
/// <inheritdoc />
|
||||
/// <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 virtual Task<RestUserMessage> SendFilesAsync(IEnumerable<FileAttachment> attachments, string text, bool isTTS = false,
|
||||
/// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/>, <see cref="MessageFlags.SuppressNotification"/> and <see cref="MessageFlags.None"/>.</exception>
|
||||
public virtual Task<RestUserMessage> SendFilesAsync(IEnumerable<FileAttachment> attachments, string text = null, bool isTTS = false,
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user