#UpdateAsync Exception

1 messages · Page 1 of 1 (latest)

meager lotus
#

It says everytime that the Embed is not specified. But the message has an embed...

await msgc.UpdateAsync(x =>
{
      x.Embed.Value.ToEmbedBuilder().Description = $"**\\:white_check_mark: Correct**\nYou answered: {((ButtonComponent)msgc.Message.Components.First().Components.First(x => x.CustomId == Moby.ColorQuizCorrectAnswerCId)).Label}";
      x.Components = new ComponentBuilder().Build();
});
sudden sedge
#

properties of x param are not populated

meager lotus
#

But this works await msgc.UpdateAsync(x => x.Embed = MobyUtil.GetCoinflipEmbed(Random.Shared.Next(0, 2) == 0));

sudden sedge
#

that's a completely different case

meager lotus
#

Ah yeah I see

#

Makes sense

#

So I can't get an embed from a message line this?

sudden sedge
#

d.net doesn't populate properties of delegate params

#

you can
just use the message object, not the delegate param

#

its msgc in your case

#

so like

...
{
  x.Embeds = new [] { msgc.Embed.Value.ToEmbedBuilder().WithDescription(.... new desc ...).Build()};
}
....
#

or something like that

meager lotus
#

Ahh okay