diff --git a/src/Discord.Net.Core/Discord.Net.Core.xml b/src/Discord.Net.Core/Discord.Net.Core.xml
index 64fbd9e23..eb93d48c9 100644
--- a/src/Discord.Net.Core/Discord.Net.Core.xml
+++ b/src/Discord.Net.Core/Discord.Net.Core.xml
@@ -508,6 +508,11 @@
The user has set a custom status.
+
+
+ The user is competing in a game.
+
+
A user's activity for their custom status.
@@ -7594,6 +7599,14 @@
A string that contains the body of the message; note that this field may be empty if there is an embed.
+
+
+ Gets the clean content for this message.
+
+
+ A string that contains the body of the message stripped of mentions, markdown, emojiis and pings; note that this field may be empty if there is an embed.
+
+
Gets the time this message was sent.
@@ -12920,10 +12933,20 @@
Not full URL validation right now. Just ensures protocol is present and that it's either http or https
+ should be used for url buttons
url to validate before sending to Discord.
A URL must include a protocol (http or https).
true if url is valid by our standard, false if null, throws an error upon invalid
+
+
+ Not full URL validation right now. Just Ensures the protocol is either http, https, or discord
+ should be used everything other than url buttons
+
+ the url to validate before sending to discord
+ A URL must include a protocol (either http, https, or discord).
+ true if the url is valid by our standard, false if null, throws an error upon invalid
+
diff --git a/src/Discord.Net.Core/Entities/Messages/IMessage.cs b/src/Discord.Net.Core/Entities/Messages/IMessage.cs
index 39419f068..c9bcb5f59 100644
--- a/src/Discord.Net.Core/Entities/Messages/IMessage.cs
+++ b/src/Discord.Net.Core/Entities/Messages/IMessage.cs
@@ -53,6 +53,13 @@ namespace Discord
///
string Content { get; }
///
+ /// Gets the clean content for this message.
+ ///
+ ///
+ /// A string that contains the body of the message stripped of mentions, markdown, emojiis and pings; note that this field may be empty if there is an embed.
+ ///
+ string CleanContent { get; }
+ ///
/// Gets the time this message was sent.
///
///
diff --git a/src/Discord.Net.Rest/Discord.Net.Rest.xml b/src/Discord.Net.Rest/Discord.Net.Rest.xml
index 78789b51e..2f396dd1b 100644
--- a/src/Discord.Net.Rest/Discord.Net.Rest.xml
+++ b/src/Discord.Net.Rest/Discord.Net.Rest.xml
@@ -4299,6 +4299,9 @@
+
+
+
diff --git a/src/Discord.Net.Rest/Entities/Messages/MessageHelper.cs b/src/Discord.Net.Rest/Entities/Messages/MessageHelper.cs
index e10be2c0a..8de9ccf32 100644
--- a/src/Discord.Net.Rest/Entities/Messages/MessageHelper.cs
+++ b/src/Discord.Net.Rest/Entities/Messages/MessageHelper.cs
@@ -246,6 +246,12 @@ namespace Discord.Rest
return System.Web.HttpUtility.UrlEncode(text);
#endif
}
+ public static string SanitizeMessage(IMessage message)
+ {
+ var newContent = MentionUtils.Resolve(message, 0, TagHandling.Sanitize, TagHandling.Sanitize, TagHandling.Sanitize, TagHandling.Sanitize, TagHandling.Sanitize);
+ newContent = Format.StripMarkDown(newContent);
+ return newContent;
+ }
public static async Task PinAsync(IMessage msg, BaseDiscordClient client,
RequestOptions options)
diff --git a/src/Discord.Net.Rest/Entities/Messages/RestMessage.cs b/src/Discord.Net.Rest/Entities/Messages/RestMessage.cs
index 09e262f00..d9bcc938e 100644
--- a/src/Discord.Net.Rest/Entities/Messages/RestMessage.cs
+++ b/src/Discord.Net.Rest/Entities/Messages/RestMessage.cs
@@ -28,6 +28,9 @@ namespace Discord.Rest
///
public string Content { get; private set; }
+ ///
+ public string CleanContent => MessageHelper.SanitizeMessage(this);
+
///
public DateTimeOffset CreatedAt => SnowflakeUtils.FromSnowflake(Id);
///
@@ -208,7 +211,6 @@ namespace Discord.Rest
else
_reactions = ImmutableArray.Create();
}
-
///
public async Task UpdateAsync(RequestOptions options = null)
{
diff --git a/src/Discord.Net.WebSocket/Entities/Messages/SocketMessage.cs b/src/Discord.Net.WebSocket/Entities/Messages/SocketMessage.cs
index b86a2bbfa..fe2c98db9 100644
--- a/src/Discord.Net.WebSocket/Entities/Messages/SocketMessage.cs
+++ b/src/Discord.Net.WebSocket/Entities/Messages/SocketMessage.cs
@@ -39,7 +39,7 @@ namespace Discord.WebSocket
public string Content { get; private set; }
///
- public string CleanContent => SanitizeMessage();
+ public string CleanContent => MessageHelper.SanitizeMessage(this);
///
public DateTimeOffset CreatedAt => SnowflakeUtils.FromSnowflake(Id);
@@ -144,8 +144,6 @@ namespace Discord.WebSocket
if (model.Content.IsSpecified)
{
Content = model.Content.Value;
- //Update CleanContent Property
- SanitizeMessage();
}
if (model.Application.IsSpecified)
@@ -272,12 +270,6 @@ namespace Discord.WebSocket
///
IReadOnlyCollection IMessage.Stickers => Stickers;
- internal string SanitizeMessage()
- {
- var newContent = MentionUtils.Resolve(this, 0, TagHandling.Sanitize, TagHandling.Sanitize, TagHandling.Sanitize, TagHandling.Sanitize, TagHandling.Sanitize);
- newContent = Format.StripMarkDown(newContent);
- return newContent;
- }
internal void AddReaction(SocketReaction reaction)
{