Browse Source

Feature: Allowed mentions object on msg create (interface breaking)

This change implements the AllowedMentions object for the payload of message creation. By default, the mentions behavior remains unchanged, the message content is parsed for all mentionable entities and they are all notified. If this payload is not null, it will use the content of the allowed_mentions field to determine if a role is notified, or just displayed.

This change is interface breaking. This follows the conventions of keeping RequestOptions as the last argument, but could break some users who specify each of these arguments without using named arguments.
pull/1455/head
Chris Johnston 5 years ago
parent
commit
6506031aa2
21 changed files with 140 additions and 36 deletions
  1. +3
    -2
      src/Discord.Net.Commands/ModuleBase.cs
  2. +2
    -1
      src/Discord.Net.Core/Entities/Channels/IMessageChannel.cs
  3. +24
    -0
      src/Discord.Net.Core/Entities/Messages/AllowedMentionTypes.cs
  4. +26
    -0
      src/Discord.Net.Core/Entities/Messages/AllowedMentions.cs
  5. +3
    -1
      src/Discord.Net.Core/Extensions/UserExtensions.cs
  6. +2
    -0
      src/Discord.Net.Rest/API/Common/Message.cs
  7. +3
    -1
      src/Discord.Net.Rest/API/Rest/CreateMessageParams.cs
  8. +5
    -2
      src/Discord.Net.Rest/Entities/Channels/ChannelHelper.cs
  9. +2
    -1
      src/Discord.Net.Rest/Entities/Channels/IRestMessageChannel.cs
  10. +4
    -4
      src/Discord.Net.Rest/Entities/Channels/RestDMChannel.cs
  11. +5
    -4
      src/Discord.Net.Rest/Entities/Channels/RestGroupChannel.cs
  12. +4
    -4
      src/Discord.Net.Rest/Entities/Channels/RestTextChannel.cs
  13. +15
    -0
      src/Discord.Net.Rest/Entities/Messages/AllowedMentions.cs
  14. +19
    -0
      src/Discord.Net.Rest/Extensions/EntityExtensions.cs
  15. +2
    -1
      src/Discord.Net.WebSocket/Entities/Channels/ISocketMessageChannel.cs
  16. +6
    -4
      src/Discord.Net.WebSocket/Entities/Channels/SocketDMChannel.cs
  17. +6
    -4
      src/Discord.Net.WebSocket/Entities/Channels/SocketGroupChannel.cs
  18. +6
    -4
      src/Discord.Net.WebSocket/Entities/Channels/SocketTextChannel.cs
  19. +1
    -1
      test/Discord.Net.Tests.Unit/MockedEntities/MockedDMChannel.cs
  20. +1
    -1
      test/Discord.Net.Tests.Unit/MockedEntities/MockedGroupChannel.cs
  21. +1
    -1
      test/Discord.Net.Tests.Unit/MockedEntities/MockedTextChannel.cs

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

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


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

@@ -22,12 +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>
/// <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, RequestOptions options = null);
Task<IUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, AllowedMentions allowedMentions = null, RequestOptions options = null);
/// <summary>
/// Sends a file to this message channel with an optional caption.
/// </summary>


+ 24
- 0
src/Discord.Net.Core/Entities/Messages/AllowedMentionTypes.cs View File

@@ -0,0 +1,24 @@
using System;

namespace Discord
{
/// <summary>
/// Specifies the type of mentions that will be parsed from the message content.
/// </summary>
[Flags]
public enum AllowedMentionTypes
{
/// <summary>
/// Controls role mentions.
/// </summary>
Roles,
/// <summary>
/// Controls user mentions.
/// </summary>
Users,
/// <summary>
/// Controls <code>@everyone</code> and <code>@here</code> mentions.
/// </summary>
Everyone,
}
}

+ 26
- 0
src/Discord.Net.Core/Entities/Messages/AllowedMentions.cs View File

@@ -0,0 +1,26 @@
using System.Collections.Generic;

namespace Discord
{
/// <summary>
/// Defines which types of mentions will be parsed from a created message's content.
/// </summary>
public class AllowedMentions
{
/// <summary>
/// Gets or sets the allowed mention types to parse from the message content.
/// If <c>null</c>, no users will be notified.
/// </summary>
public AllowedMentionTypes? AllowedTypes { get; set; }

/// <summary>
/// Gets or sets the list of all role Ids that can be mentioned.
/// </summary>
public List<ulong> RoleIds { get; set; }

/// <summary>
/// Gets or sets the list of all user Ids that can be mentioned.
/// </summary>
public List<ulong> UserIds { get; set; }
}
}

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

@@ -27,6 +27,7 @@ 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>
/// <returns>
/// A task that represents the asynchronous send operation. The task result contains the sent message.
@@ -35,9 +36,10 @@ namespace Discord
string text = null,
bool isTTS = false,
Embed embed = null,
AllowedMentions allowedMentions = null,
RequestOptions options = null)
{
return await (await user.GetOrCreateDMChannelAsync().ConfigureAwait(false)).SendMessageAsync(text, isTTS, embed, options).ConfigureAwait(false);
return await (await user.GetOrCreateDMChannelAsync().ConfigureAwait(false)).SendMessageAsync(text, isTTS, embed, allowedMentions, options).ConfigureAwait(false);
}

/// <summary>


+ 2
- 0
src/Discord.Net.Rest/API/Common/Message.cs View File

@@ -54,5 +54,7 @@ namespace Discord.API
public Optional<MessageReference> Reference { get; set; }
[JsonProperty("flags")]
public Optional<MessageFlags> Flags { get; set; }
[JsonProperty("allowed_mentions")]
public Optional<AllowedMentions> AllowedMentions { get; set; }
}
}

+ 3
- 1
src/Discord.Net.Rest/API/Rest/CreateMessageParams.cs View File

@@ -1,4 +1,4 @@
#pragma warning disable CS1591
#pragma warning disable CS1591
using Newtonsoft.Json;

namespace Discord.API.Rest
@@ -15,6 +15,8 @@ namespace Discord.API.Rest
public Optional<bool> IsTTS { get; set; }
[JsonProperty("embed")]
public Optional<Embed> Embed { get; set; }
[JsonProperty("allowed_mentions")]
public Optional<AllowedMentions> AllowedMentions { get; set; }

public CreateMessageParams(string content)
{


+ 5
- 2
src/Discord.Net.Rest/Entities/Channels/ChannelHelper.cs View File

@@ -167,9 +167,12 @@ namespace Discord.Rest

/// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception>
public static async Task<RestUserMessage> SendMessageAsync(IMessageChannel channel, BaseDiscordClient client,
string text, bool isTTS, Embed embed, RequestOptions options)
string text, bool isTTS, Embed embed, AllowedMentions allowedMentions, RequestOptions options)
{
var args = new CreateMessageParams(text) { IsTTS = isTTS, Embed = embed?.ToModel() };
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.");

var args = new CreateMessageParams(text) { IsTTS = isTTS, Embed = embed?.ToModel(), AllowedMentions = allowedMentions?.ToModel() };
var model = await client.ApiClient.CreateMessageAsync(channel.Id, args, options).ConfigureAwait(false);
return RestUserMessage.Create(client, channel, client.CurrentUser, model);
}


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

@@ -19,12 +19,13 @@ namespace Discord.Rest
/// <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>
/// <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);
new Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, AllowedMentions allowedMentions = null, RequestOptions options = null);
/// <summary>
/// Sends a file to this message channel with an optional caption.
/// </summary>


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

@@ -93,8 +93,8 @@ namespace Discord.Rest

/// <inheritdoc />
/// <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)
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, options);
public Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, AllowedMentions allowedMentions = null, RequestOptions options = null)
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, null, options);

/// <inheritdoc />
/// <exception cref="ArgumentException">
@@ -206,8 +206,8 @@ 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, RequestOptions options)
=> await SendMessageAsync(text, isTTS, embed, options).ConfigureAwait(false);
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, AllowedMentions allowedMentions, RequestOptions options)
=> await SendMessageAsync(text, isTTS, embed, allowedMentions, options).ConfigureAwait(false);

//IChannel
/// <inheritdoc />


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

@@ -95,8 +95,8 @@ namespace Discord.Rest

/// <inheritdoc />
/// <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)
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, options);
public Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, AllowedMentions allowedMentions = null, RequestOptions options = null)
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, allowedMentions, options);

/// <inheritdoc />
/// <exception cref="ArgumentException">
@@ -183,8 +183,9 @@ 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, RequestOptions options)
=> await SendMessageAsync(text, isTTS, embed, options).ConfigureAwait(false);

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

//IAudioChannel
/// <inheritdoc />


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

@@ -101,8 +101,8 @@ namespace Discord.Rest

/// <inheritdoc />
/// <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)
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, options);
public Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, AllowedMentions allowedMentions = null, RequestOptions options = null)
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, allowedMentions, options);

/// <inheritdoc />
/// <exception cref="ArgumentException">
@@ -273,8 +273,8 @@ 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, RequestOptions options)
=> await SendMessageAsync(text, isTTS, embed, options).ConfigureAwait(false);
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, AllowedMentions allowedMentions, RequestOptions options)
=> await SendMessageAsync(text, isTTS, embed, allowedMentions, options).ConfigureAwait(false);

//IGuildChannel
/// <inheritdoc />


+ 15
- 0
src/Discord.Net.Rest/Entities/Messages/AllowedMentions.cs View File

@@ -0,0 +1,15 @@
using Newtonsoft.Json;

namespace Discord.API
{
public class AllowedMentions
{
[JsonProperty("parse")]
public Optional<string[]> Parse { get; set; }
// Roles and Users have a max size of 100
[JsonProperty("roles")]
public Optional<ulong[]> Roles { get; set; }
[JsonProperty("users")]
public Optional<ulong[]> Users { get; set; }
}
}

+ 19
- 0
src/Discord.Net.Rest/Extensions/EntityExtensions.cs View File

@@ -1,3 +1,4 @@
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;

@@ -60,6 +61,24 @@ namespace Discord.Rest
model.Video = entity.Video.Value.ToModel();
return model;
}
public static API.AllowedMentions ToModel(this AllowedMentions entity)
{
return new API.AllowedMentions()
{
Parse = entity.AllowedTypes?.EnumerateMentionTypes().ToArray(),
Roles = entity.RoleIds?.ToArray(),
Users = entity.UserIds?.ToArray(),
};
}
public static IEnumerable<string> EnumerateMentionTypes(this AllowedMentionTypes mentionTypes)
{
if (mentionTypes.HasFlag(AllowedMentionTypes.Everyone))
yield return "everyone";
if (mentionTypes.HasFlag(AllowedMentionTypes.Roles))
yield return "roles";
if (mentionTypes.HasFlag(AllowedMentionTypes.Users))
yield return "users";
}
public static EmbedAuthor ToEntity(this API.EmbedAuthor model)
{
return new EmbedAuthor(model.Name, model.Url, model.IconUrl, model.ProxyIconUrl);


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

@@ -28,12 +28,13 @@ namespace Discord.WebSocket
/// <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>
/// <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);
new Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, AllowedMentions allowedMentions = null, RequestOptions options = null);
/// <summary>
/// Sends a file to this message channel with an optional caption.
/// </summary>


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

@@ -135,8 +135,8 @@ namespace Discord.WebSocket

/// <inheritdoc />
/// <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)
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, options);
public Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, AllowedMentions allowedMentions = null, RequestOptions options = null)
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, allowedMentions, options);

/// <inheritdoc />
public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS = false, Embed embed = null, RequestOptions options = null, bool isSpoiler = false)
@@ -235,8 +235,10 @@ 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, RequestOptions options)
=> await SendMessageAsync(text, isTTS, embed, options).ConfigureAwait(false);
//async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options)
// => await SendMessageAsync(text, isTTS, embed, null, options).ConfigureAwait(false);
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, AllowedMentions allowedMentions, RequestOptions options)
=> await SendMessageAsync(text, isTTS, embed, allowedMentions, options).ConfigureAwait(false);

//IChannel
/// <inheritdoc />


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

@@ -163,8 +163,8 @@ namespace Discord.WebSocket

/// <inheritdoc />
/// <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)
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, options);
public Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, AllowedMentions allowedMentions = null, RequestOptions options = null)
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, allowedMentions, options);

/// <inheritdoc />
public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS = false, Embed embed = null, RequestOptions options = null, bool isSpoiler = false)
@@ -299,8 +299,10 @@ 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, RequestOptions options)
=> await SendMessageAsync(text, isTTS, embed, options).ConfigureAwait(false);
//async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options)
// => await SendMessageAsync(text, isTTS, embed, null, options).ConfigureAwait(false);
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, AllowedMentions allowedMentions, RequestOptions options)
=> await SendMessageAsync(text, isTTS, embed, allowedMentions, options).ConfigureAwait(false);

//IAudioChannel
/// <inheritdoc />


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

@@ -161,8 +161,8 @@ namespace Discord.WebSocket

/// <inheritdoc />
/// <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)
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, options);
public Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, AllowedMentions allowedMentions = null, RequestOptions options = null)
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, allowedMentions, options);

/// <inheritdoc />
public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS = false, Embed embed = null, RequestOptions options = null, bool isSpoiler = false)
@@ -308,8 +308,10 @@ 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, RequestOptions options)
=> await SendMessageAsync(text, isTTS, embed, options).ConfigureAwait(false);
//async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options)
// => await SendMessageAsync(text, isTTS, embed, null, options).ConfigureAwait(false);
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, AllowedMentions allowedMentions, RequestOptions options)
=> await SendMessageAsync(text, isTTS, embed, allowedMentions, options).ConfigureAwait(false);

// INestedChannel
/// <inheritdoc />


+ 1
- 1
test/Discord.Net.Tests.Unit/MockedEntities/MockedDMChannel.cs View File

@@ -83,7 +83,7 @@ namespace Discord
throw new NotImplementedException();
}

public Task<IUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null)
public Task<IUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, AllowedMentions allowedMentions = null, RequestOptions options = null)
{
throw new NotImplementedException();
}


+ 1
- 1
test/Discord.Net.Tests.Unit/MockedEntities/MockedGroupChannel.cs View File

@@ -91,7 +91,7 @@ namespace Discord
throw new NotImplementedException();
}

public Task<IUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null)
public Task<IUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, AllowedMentions allowedMentions = null, RequestOptions options = null)
{
throw new NotImplementedException();
}


+ 1
- 1
test/Discord.Net.Tests.Unit/MockedEntities/MockedTextChannel.cs View File

@@ -177,7 +177,7 @@ namespace Discord
throw new NotImplementedException();
}

public Task<IUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null)
public Task<IUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, AllowedMentions allowedMentions = null, RequestOptions options = null)
{
throw new NotImplementedException();
}


Loading…
Cancel
Save