diff --git a/src/Discord.Net.Commands/ModuleBase.cs b/src/Discord.Net.Commands/ModuleBase.cs
index 9cd4ea15d..1759f37e4 100644
--- a/src/Discord.Net.Commands/ModuleBase.cs
+++ b/src/Discord.Net.Commands/ModuleBase.cs
@@ -31,9 +31,10 @@ namespace Discord.Commands
///
/// Specifies if Discord should read this aloud using text-to-speech.
/// An embed to be displayed alongside the .
- protected virtual async Task ReplyAsync(string message = null, bool isTTS = false, Embed embed = null, RequestOptions options = null)
+ /// The types of mentions that will be send with this message.
+ protected virtual async Task 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);
}
///
/// The method to execute before executing the command.
diff --git a/src/Discord.Net.Core/Entities/Channels/IMessageChannel.cs b/src/Discord.Net.Core/Entities/Channels/IMessageChannel.cs
index b5aa69d55..856e9ca96 100644
--- a/src/Discord.Net.Core/Entities/Channels/IMessageChannel.cs
+++ b/src/Discord.Net.Core/Entities/Channels/IMessageChannel.cs
@@ -22,12 +22,13 @@ namespace Discord
/// The message to be sent.
/// Determines whether the message should be read aloud by Discord or not.
/// The to be sent.
+ /// The types of mentions that will be send with this message.
/// The options to be used when sending the request.
///
/// A task that represents an asynchronous send operation for delivering the message. The task result
/// contains the sent message.
///
- Task SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null);
+ Task SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, AllowedMentions allowedMentions = null, RequestOptions options = null);
///
/// Sends a file to this message channel with an optional caption.
///
diff --git a/src/Discord.Net.Core/Entities/Messages/AllowedMentionTypes.cs b/src/Discord.Net.Core/Entities/Messages/AllowedMentionTypes.cs
new file mode 100644
index 000000000..e93a00ed1
--- /dev/null
+++ b/src/Discord.Net.Core/Entities/Messages/AllowedMentionTypes.cs
@@ -0,0 +1,24 @@
+using System;
+
+namespace Discord
+{
+ ///
+ /// Specifies the type of mentions that will be parsed from the message content.
+ ///
+ [Flags]
+ public enum AllowedMentionTypes
+ {
+ ///
+ /// Controls role mentions.
+ ///
+ Roles,
+ ///
+ /// Controls user mentions.
+ ///
+ Users,
+ ///
+ /// Controls @everyone
and @here
mentions.
+ ///
+ Everyone,
+ }
+}
diff --git a/src/Discord.Net.Core/Entities/Messages/AllowedMentions.cs b/src/Discord.Net.Core/Entities/Messages/AllowedMentions.cs
new file mode 100644
index 000000000..f4799f288
--- /dev/null
+++ b/src/Discord.Net.Core/Entities/Messages/AllowedMentions.cs
@@ -0,0 +1,26 @@
+using System.Collections.Generic;
+
+namespace Discord
+{
+ ///
+ /// Defines which types of mentions will be parsed from a created message's content.
+ ///
+ public class AllowedMentions
+ {
+ ///
+ /// Gets or sets the allowed mention types to parse from the message content.
+ /// If null, no users will be notified.
+ ///
+ public AllowedMentionTypes? AllowedTypes { get; set; }
+
+ ///
+ /// Gets or sets the list of all role Ids that can be mentioned.
+ ///
+ public List RoleIds { get; set; }
+
+ ///
+ /// Gets or sets the list of all user Ids that can be mentioned.
+ ///
+ public List UserIds { get; set; }
+ }
+}
diff --git a/src/Discord.Net.Core/Extensions/UserExtensions.cs b/src/Discord.Net.Core/Extensions/UserExtensions.cs
index f98bf7227..6875e8cc4 100644
--- a/src/Discord.Net.Core/Extensions/UserExtensions.cs
+++ b/src/Discord.Net.Core/Extensions/UserExtensions.cs
@@ -27,6 +27,7 @@ namespace Discord
/// The message to be sent.
/// Whether the message should be read aloud by Discord or not.
/// The to be sent.
+ /// The types of mentions that will be send with this message.
/// The options to be used when sending the request.
///
/// 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);
}
///
diff --git a/src/Discord.Net.Rest/API/Common/Message.cs b/src/Discord.Net.Rest/API/Common/Message.cs
index f20035685..b4529d457 100644
--- a/src/Discord.Net.Rest/API/Common/Message.cs
+++ b/src/Discord.Net.Rest/API/Common/Message.cs
@@ -54,5 +54,7 @@ namespace Discord.API
public Optional Reference { get; set; }
[JsonProperty("flags")]
public Optional Flags { get; set; }
+ [JsonProperty("allowed_mentions")]
+ public Optional AllowedMentions { get; set; }
}
}
diff --git a/src/Discord.Net.Rest/API/Rest/CreateMessageParams.cs b/src/Discord.Net.Rest/API/Rest/CreateMessageParams.cs
index d77bff8ca..4b56658d6 100644
--- a/src/Discord.Net.Rest/API/Rest/CreateMessageParams.cs
+++ b/src/Discord.Net.Rest/API/Rest/CreateMessageParams.cs
@@ -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 IsTTS { get; set; }
[JsonProperty("embed")]
public Optional