diff --git a/src/Discord.Net.Rest/Entities/Messages/RestUserMessage.cs b/src/Discord.Net.Rest/Entities/Messages/RestUserMessage.cs index e5eed874e..d47673002 100644 --- a/src/Discord.Net.Rest/Entities/Messages/RestUserMessage.cs +++ b/src/Discord.Net.Rest/Entities/Messages/RestUserMessage.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Diagnostics; @@ -126,6 +126,8 @@ namespace Discord.Rest public async Task ModifyAsync(Action func, RequestOptions options = null) { + if (Author.Id != Discord.CurrentUser.Id) + throw new InvalidOperationException("Discord allows only the author of a message to change it."); var model = await MessageHelper.ModifyAsync(this, Discord, func, options).ConfigureAwait(false); Update(model); } diff --git a/src/Discord.Net.WebSocket/Entities/Messages/SocketUserMessage.cs b/src/Discord.Net.WebSocket/Entities/Messages/SocketUserMessage.cs index b240645e5..3ae9ae4e1 100644 --- a/src/Discord.Net.WebSocket/Entities/Messages/SocketUserMessage.cs +++ b/src/Discord.Net.WebSocket/Entities/Messages/SocketUserMessage.cs @@ -1,4 +1,4 @@ -using Discord.Rest; +using Discord.Rest; using System; using System.Collections.Generic; using System.Collections.Immutable; @@ -122,7 +122,11 @@ namespace Discord.WebSocket } public Task ModifyAsync(Action func, RequestOptions options = null) - => MessageHelper.ModifyAsync(this, Discord, func, options); + { + if (Author.Id != Discord.CurrentUser.Id) + throw new InvalidOperationException("Discord allows only the author of a message to change it."); + return MessageHelper.ModifyAsync(this, Discord, func, options); + } public Task AddReactionAsync(IEmote emote, RequestOptions options = null) => MessageHelper.AddReactionAsync(this, emote, Discord, options);