Browse Source

fix interface break: reorder allowedMentions arg so that it's after options

This change modifies the order of the AllowedMentions argument of SendMessageAsync so that this addition shouldn't be interface breaking. The downside to this change is that it breaks the convention followed by other methods, where the RequestOptions argument is normally last.
pull/1455/head
Chris Johnston 5 years ago
parent
commit
dae7390307
9 changed files with 14 additions and 14 deletions
  1. +2
    -2
      src/Discord.Net.Commands/ModuleBase.cs
  2. +2
    -2
      src/Discord.Net.Core/Entities/Channels/IMessageChannel.cs
  3. +4
    -4
      src/Discord.Net.Core/Extensions/UserExtensions.cs
  4. +1
    -1
      src/Discord.Net.Rest/Entities/Channels/RestDMChannel.cs
  5. +1
    -1
      src/Discord.Net.Rest/Entities/Channels/RestGroupChannel.cs
  6. +1
    -1
      src/Discord.Net.Rest/Entities/Channels/RestTextChannel.cs
  7. +1
    -1
      src/Discord.Net.WebSocket/Entities/Channels/SocketDMChannel.cs
  8. +1
    -1
      src/Discord.Net.WebSocket/Entities/Channels/SocketGroupChannel.cs
  9. +1
    -1
      src/Discord.Net.WebSocket/Entities/Channels/SocketTextChannel.cs

+ 2
- 2
src/Discord.Net.Commands/ModuleBase.cs View File

@@ -32,9 +32,9 @@ namespace Discord.Commands
/// <param name="isTTS">Specifies if Discord should read this <paramref name="message"/> aloud using text-to-speech.</param>
/// <param name="embed">An embed to be displayed alongside the <paramref name="message"/>.</param>
/// <param name="allowedMentions">The types of mentions that will be send with this message.</param>
protected virtual async Task<IUserMessage> ReplyAsync(string message = null, bool isTTS = false, Embed embed = null, AllowedMentions allowedMentions = null, RequestOptions options = null)
protected virtual async Task<IUserMessage> ReplyAsync(string message = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null)
{
return await Context.Channel.SendMessageAsync(message, isTTS, embed, allowedMentions, options).ConfigureAwait(false);
return await Context.Channel.SendMessageAsync(message, isTTS, embed, options, allowedMentions).ConfigureAwait(false);
}
/// <summary>
/// The method to execute before executing the command.


+ 2
- 2
src/Discord.Net.Core/Entities/Channels/IMessageChannel.cs View File

@@ -22,13 +22,13 @@ namespace Discord
/// <param name="text">The message to be sent.</param>
/// <param name="isTTS">Determines whether the message should be read aloud by Discord or not.</param>
/// <param name="embed">The <see cref="Discord.EmbedType.Rich"/> <see cref="Embed"/> to be sent.</param>
/// <param name="allowedMentions">The types of mentions that will be send with this message.</param>
/// <param name="options">The options to be used when sending the request.</param>
/// <param name="allowedMentions">The types of mentions that will be send with this message.</param>
/// <returns>
/// A task that represents an asynchronous send operation for delivering the message. The task result
/// contains the sent message.
/// </returns>
Task<IUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, AllowedMentions allowedMentions = null, RequestOptions options = null);
Task<IUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null);
/// <summary>
/// Sends a file to this message channel with an optional caption.
/// </summary>


+ 4
- 4
src/Discord.Net.Core/Extensions/UserExtensions.cs View File

@@ -27,8 +27,8 @@ namespace Discord
/// <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="EmbedType.Rich"/> <see cref="Embed"/> to be sent.</param>
/// <param name="allowedMentions">The types of mentions that will be send with this message.</param>
/// <param name="options">The options to be used when sending the request.</param>
/// <param name="allowedMentions">The types of mentions that will be send with this message.</param>
/// <returns>
/// A task that represents the asynchronous send operation. The task result contains the sent message.
/// </returns>
@@ -36,10 +36,10 @@ namespace Discord
string text = null,
bool isTTS = false,
Embed embed = null,
AllowedMentions allowedMentions = null,
RequestOptions options = null)
RequestOptions options = null,
AllowedMentions allowedMentions = null)
{
return await (await user.GetOrCreateDMChannelAsync().ConfigureAwait(false)).SendMessageAsync(text, isTTS, embed, allowedMentions, options).ConfigureAwait(false);
return await (await user.GetOrCreateDMChannelAsync().ConfigureAwait(false)).SendMessageAsync(text, isTTS, embed, options, allowedMentions).ConfigureAwait(false);
}

/// <summary>


+ 1
- 1
src/Discord.Net.Rest/Entities/Channels/RestDMChannel.cs View File

@@ -206,7 +206,7 @@ namespace Discord.Rest
async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS, Embed embed, RequestOptions options, bool isSpoiler)
=> await SendFileAsync(stream, filename, text, isTTS, embed, options, isSpoiler).ConfigureAwait(false);
/// <inheritdoc />
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, AllowedMentions allowedMentions, RequestOptions options)
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options, AllowedMentions allowedMentions)
=> await SendMessageAsync(text, isTTS, embed, allowedMentions, options).ConfigureAwait(false);

//IChannel


+ 1
- 1
src/Discord.Net.Rest/Entities/Channels/RestGroupChannel.cs View File

@@ -184,7 +184,7 @@ namespace Discord.Rest
async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS, Embed embed, RequestOptions options, bool isSpoiler)
=> await SendFileAsync(stream, filename, text, isTTS, embed, options, isSpoiler).ConfigureAwait(false);

async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, AllowedMentions allowedMentions, RequestOptions options)
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options, AllowedMentions allowedMentions)
=> await SendMessageAsync(text, isTTS, embed, allowedMentions, options).ConfigureAwait(false);

//IAudioChannel


+ 1
- 1
src/Discord.Net.Rest/Entities/Channels/RestTextChannel.cs View File

@@ -273,7 +273,7 @@ namespace Discord.Rest
async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS, Embed embed, RequestOptions options, bool isSpoiler)
=> await SendFileAsync(stream, filename, text, isTTS, embed, options, isSpoiler).ConfigureAwait(false);
/// <inheritdoc />
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, AllowedMentions allowedMentions, RequestOptions options)
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options, AllowedMentions allowedMentions)
=> await SendMessageAsync(text, isTTS, embed, allowedMentions, options).ConfigureAwait(false);

//IGuildChannel


+ 1
- 1
src/Discord.Net.WebSocket/Entities/Channels/SocketDMChannel.cs View File

@@ -235,7 +235,7 @@ namespace Discord.WebSocket
async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS, Embed embed, RequestOptions options, bool isSpoiler)
=> await SendFileAsync(stream, filename, text, isTTS, embed, options, isSpoiler).ConfigureAwait(false);
/// <inheritdoc />
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, AllowedMentions allowedMentions, RequestOptions options)
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options, AllowedMentions allowedMentions)
=> await SendMessageAsync(text, isTTS, embed, allowedMentions, options).ConfigureAwait(false);

//IChannel


+ 1
- 1
src/Discord.Net.WebSocket/Entities/Channels/SocketGroupChannel.cs View File

@@ -299,7 +299,7 @@ namespace Discord.WebSocket
async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS, Embed embed, RequestOptions options, bool isSpoiler)
=> await SendFileAsync(stream, filename, text, isTTS, embed, options, isSpoiler).ConfigureAwait(false);
/// <inheritdoc />
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, AllowedMentions allowedMentions, RequestOptions options)
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options, AllowedMentions allowedMentions)
=> await SendMessageAsync(text, isTTS, embed, allowedMentions, options).ConfigureAwait(false);

//IAudioChannel


+ 1
- 1
src/Discord.Net.WebSocket/Entities/Channels/SocketTextChannel.cs View File

@@ -308,7 +308,7 @@ namespace Discord.WebSocket
async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS, Embed embed, RequestOptions options, bool isSpoiler)
=> await SendFileAsync(stream, filename, text, isTTS, embed, options, isSpoiler).ConfigureAwait(false);
/// <inheritdoc />
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, AllowedMentions allowedMentions, RequestOptions options)
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options, AllowedMentions allowedMentions)
=> await SendMessageAsync(text, isTTS, embed, allowedMentions, options).ConfigureAwait(false);

// INestedChannel


Loading…
Cancel
Save