Throw when attempting to modify a message not made by the current user (#992)

* Throw when attempting to modify a message not made by the current user

* Didn't realize the client is passed into the MessageHelper function

* Respond to feedback
This commit is contained in:
Joe4evr
2018-03-24 18:12:34 +01:00
committed by Christopher F
parent 810f6d610e
commit d50fc3b4e1
3 changed files with 6 additions and 3 deletions

View File

@@ -1,4 +1,4 @@
using Discord.API.Rest;
using Discord.API.Rest;
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
@@ -13,6 +13,9 @@ namespace Discord.Rest
public static async Task<Model> ModifyAsync(IMessage msg, BaseDiscordClient client, Action<MessageProperties> func,
RequestOptions options)
{
if (msg.Author.Id != client.CurrentUser.Id)
throw new InvalidOperationException("Only the author of a message may change it.");
var args = new MessageProperties();
func(args);
var apiArgs = new API.Rest.ModifyMessageParams

View File

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

View File

@@ -1,4 +1,4 @@
using Discord.Rest;
using Discord.Rest;
using System;
using System.Collections.Generic;
using System.Collections.Immutable;