I've been trying to make a small bot and I'm having some trouble with the components in a post.
I have the following method generating the components to be passed to CreatePostAsync:
private MessageComponent CreateChoreList()
{
var messageComponents = new List<IMessageComponentBuilder>
{
new TextDisplayBuilder().WithContent("# 📝 As Tuas Tarefas"),
};
foreach (var chore in chores)
{
var messageContent = new StringBuilder()
.AppendLine($"## 🔹 {chore.Title}")
.AppendLine($"**📝 Descrição**: {chore.Description}")
.AppendLine($"**📅 Criado**: {chore.CreatedAt:g}")
.AppendLine($"**✏️ Atualizado**: {(chore.UpdatedAt.HasValue ? chore.UpdatedAt.Value.ToString("g") : "Nunca")}");
var sectionBuilder = new SectionBuilder()
.WithComponents([new TextDisplayBuilder().WithContent(messageContent.ToString())])
.WithAccessory(new ButtonBuilder()
// TODO: Replace with constant
.WithCustomId($"complete_chore:{chore.Id}")
.WithStyle(ButtonStyle.Success)
.WithDisabled(false)
// TODO: Replace with constant
.WithEmote(new Emoji("✅"))
// TODO: Replace with constant
.WithLabel("Completar Tarefa"));
messageComponents.Add(new SeparatorBuilder());
messageComponents.Add(sectionBuilder);
}
var containerBuilder = new ContainerBuilder()
.WithComponents(messageComponents)
.WithAccentColor(Color.DarkBlue);
var componentsV2 = new ComponentBuilderV2()
.AddComponent(containerBuilder);
return componentsV2.Build();
}
As shown in the picture, it looks as I expected except the buttons are disabled.
My question would be how can I make the buttons work? I'm sure I missed something stupid but I am super new with this library.