ModifyAsync will accept an EmbedBuilderpull/383/head
@@ -498,7 +498,7 @@ namespace Discord.API | |||||
break; | break; | ||||
} | } | ||||
} | } | ||||
public async Task<Message> ModifyMessageAsync(ulong channelId, ulong messageId, ModifyMessageParams args, RequestOptions options = null) | |||||
public async Task<Message> ModifyMessageAsync(ulong channelId, ulong messageId, Rest.ModifyMessageParams args, RequestOptions options = null) | |||||
{ | { | ||||
Preconditions.NotEqual(channelId, 0, nameof(channelId)); | Preconditions.NotEqual(channelId, 0, nameof(channelId)); | ||||
Preconditions.NotEqual(messageId, 0, nameof(messageId)); | Preconditions.NotEqual(messageId, 0, nameof(messageId)); | ||||
@@ -8,5 +8,7 @@ namespace Discord.API.Rest | |||||
{ | { | ||||
[JsonProperty("content")] | [JsonProperty("content")] | ||||
public Optional<string> Content { get; set; } | public Optional<string> Content { get; set; } | ||||
[JsonProperty("embed")] | |||||
public Optional<Embed> Embed { get; set; } | |||||
} | } | ||||
} | } |
@@ -1,5 +1,4 @@ | |||||
using Discord.API.Rest; | |||||
using System; | |||||
using System; | |||||
using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
namespace Discord | namespace Discord | ||||
@@ -0,0 +1,12 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
namespace Discord | |||||
{ | |||||
public class ModifyMessageParams | |||||
{ | |||||
public Optional<string> Content { get; set; } | |||||
public Optional<EmbedBuilder> Embed { get; set; } | |||||
} | |||||
} |
@@ -15,7 +15,12 @@ namespace Discord.Rest | |||||
{ | { | ||||
var args = new ModifyMessageParams(); | var args = new ModifyMessageParams(); | ||||
func(args); | func(args); | ||||
return await client.ApiClient.ModifyMessageAsync(msg.Channel.Id, msg.Id, args, options).ConfigureAwait(false); | |||||
var apiArgs = new API.Rest.ModifyMessageParams | |||||
{ | |||||
Content = args.Content, | |||||
Embed = args.Embed.IsSpecified ? args.Embed.Value.Build() : Optional.Create<API.Embed>() | |||||
}; | |||||
return await client.ApiClient.ModifyMessageAsync(msg.Channel.Id, msg.Id, apiArgs, options).ConfigureAwait(false); | |||||
} | } | ||||
public static async Task DeleteAsync(IMessage msg, BaseDiscordClient client, | public static async Task DeleteAsync(IMessage msg, BaseDiscordClient client, | ||||
RequestOptions options) | RequestOptions options) | ||||