For example i have this code:
public class MyModule : InteractionModuleBase<SocketInteractionContext>
{
[SlashCommand("example", "example command")]
public async Task Expl()
{
var component = new ComponentBuilder()
.WithButton("leave", "leave", ButtonStyle.Success);
await Context.Interaction.RespondAsync("Response", components: component.Build());
}
[ComponentInteraction("leave")]
public async Task Lv()
{
}
}
How can i access the ID of a message with which a component has been sent?
I tried using Context.Interaction.Data but it is obscure and i don't know what to do with it later. Don't have any other ideas, please help.
Your title is asking to access the data, however your question is asking for the id
In the case of the ID you'll want to assign the sent message to a variable, and then you can access the id afterwards
In the case of the data, if you're further down the chain of the interaction, you can call the original interaction message via
Context.Interaction.GetOriginalResponseAsync