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:
@@ -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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Diagnostics;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Discord.Rest;
|
||||
using Discord.Rest;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
|
||||
Reference in New Issue
Block a user