Browse Source

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
tags/2.0
Joe4evr Christopher F 7 years ago
parent
commit
d50fc3b4e1
3 changed files with 6 additions and 3 deletions
  1. +4
    -1
      src/Discord.Net.Rest/Entities/Messages/MessageHelper.cs
  2. +1
    -1
      src/Discord.Net.Rest/Entities/Messages/RestUserMessage.cs
  3. +1
    -1
      src/Discord.Net.WebSocket/Entities/Messages/SocketUserMessage.cs

+ 4
- 1
src/Discord.Net.Rest/Entities/Messages/MessageHelper.cs 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


+ 1
- 1
src/Discord.Net.Rest/Entities/Messages/RestUserMessage.cs View File

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


+ 1
- 1
src/Discord.Net.WebSocket/Entities/Messages/SocketUserMessage.cs View File

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


Loading…
Cancel
Save