#Parsing all embeds
1 messages · Page 1 of 1 (latest)
i have issue like
I getting all embeds by var original = button.Message.Embeds.First();
and after i build other embed
and updating button x.Embeds = new[] { original, embed };
But question is how can i add new embed to embeds
i will show example
kk
like here is original embed
after clicking button Gather it will create new embed and add to this message with parameter x.Embeds = new[] { original, embed };
like this
and i wanna if next who clicked this message will add to end of embeds
ModifyAsync(x => x.Embeds = new Embed[] { (Embed)original, newEmbed.Build() });
do u mean something like that
let me check
hmm that seems the same
but i wanna after other click there will be originalEmbed, embed that someone clicked and new embed who clicked, and this can be maximum 9 embeds + original
sadly im confused then
Well
Are you using Iteraction Framework?
no
i wanna add new embed after original embed everytime someone pressing the button
i think something like this might work
var List<Embed> embeds = interaction.Message.Embeds get the list of existing embeds
Check if it has <10 embeds - if(embeds.Length <10)
Then just embeds.Add() new embed to it
And then update the message with interaction.UpdateAsync(x => x.Embeds = embeds)
(interaction it a component interaction you get as a parameter in ButtonExecuted event)
thank you i will try
cannot convert "System.Collections.Generic.List<Discord.Embed>" to "Discord.Optional<Discord.Embed[]>".
sure, thank you
let me check
System.InvalidCastException: Unable to cast object of type 'System.Collections.Immutable.ImmutableArray`1[Discord.Embed]' to type 'System.Collections.Generic.List`1[Discord.Embed]'.
on this line List<Embed> embeds = (List<Embed>)button.Message.Embeds;
its fixed
var embeds = button.Message.Embeds.ToList();
after i use embeds.Add(new embed) and update it by using x.Embeds = embeds.ToArray();
Ah
Yup
That too
Sorry, wrote that on discord
My in-brain compiler didn't catch that issue