Broken message in cache after ModifyAsync with added embed
Created by: KillyMXI
Summary
GetMessageAsync
returns a message with no Content, if it was previously edited with ModifyAsync
to add an embed. (it doesn't reproduce if no embed added on edit)
Details
D#+ 3.2.3 (no custom sockets) (got couple of confirmations it also happens on 4.0 nightly) .Net Core 2.2
Steps to reproduce
First, add the following commands:
private ulong testMsgId = 0;
[Command("test1")]
public async Task Test1Async(CommandContext ctx)
{
var msg1 = await ctx.RespondAsync("test message");
testMsgId = msg1.Id;
msg1 = await ctx.Channel.GetMessageAsync(testMsgId);
await ctx.RespondAsync($"A: {msg1.Author.Username} at {msg1.Timestamp}: \"{msg1.Content}\"");
}
[Command("test2")]
public async Task Test2Async(CommandContext ctx)
{
if (testMsgId == 0) { return; }
var msg1 = await ctx.Channel.GetMessageAsync(testMsgId);
await ctx.RespondAsync($"A: {msg1.Author.Username} at {msg1.Timestamp}: \"{msg1.Content}\"");
if (msg1.Content != null)
{
await msg1.ModifyAsync(
msg1.Content,
new DiscordEmbedBuilder { Description = "test", Timestamp = DateTimeOffset.Now }
);
}
msg1 = await ctx.Channel.GetMessageAsync(testMsgId);
await ctx.RespondAsync($"B: {msg1.Author.Username} at {msg1.Timestamp}: \"{msg1.Content}\"");
}
Then, run them in the following order:
!test1
!test2
!test2
Every command should output "test message" in place of {msg1.Content}
. But after first run of .test2
has modified it, on the second run it is empty.
Notes
I hope to have a fix or workaround for 3.2.x, unless you releasing 4.0 like tomorrow.