Broken message in cache after ModifyAsync with added embed
See original GitHub issueSummary
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.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
c# - ModifyAsync Not Working
You are missing a .Build() after WithDescription . Usually when using the builder pattern you usually need to build the desired type.
Read more >Is there a cached version of messages / embeds history? ...
My bot duplicates the message, deleting the old one, and adds a live countdown - which worked fine when I first set it...
Read more >Changelog
#2644 Added ComponentBuilder component removal methods. ... by after id (529fe3d); #2622 Added default thread ratelimit in guild text channels (f9c8530) ...
Read more >C# (CSharp) IGuildUser.ModifyAsync Examples
ModifyAsync - 34 examples found. These are the top rated real world C# (CSharp) examples of IGuildUser.ModifyAsync extracted from open source projects.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It’s a classic Apple
goto fail;
bug.Fix coming up, will backport to 3.x as well