Java Discord Bot Tutorial - Ep 6: Buttons

preview_player
Показать описание
This is the sixth episode of the java discord bot tutorial. In this episode we will be looking at adding buttons to our discord bot

Code for this tutorial:

Subscribe:
Рекомендации по теме
Комментарии
Автор

for anyone having trouble with MessageBuilder(), this seems to work fine for me:
@Override
public void event) {
EmbedBuilder builder = new EmbedBuilder();
builder.setTitle("Pizza?");
builder.setDescription("Do you like pizza?");

Button yesButton = Button.danger("yes-button", "Yes");
Button noButton = Button.danger("no-button", "No");

event.reply("")
.addEmbeds(builder.build())
.addActionRow(yesButton, noButton)
.queue();
}

TakeFlow
Автор

hi, I tried using the MessageBuilder() but it dosen't work, yes i know you replied to that below comment but there is something that comes up when I do ActionRow.of(). Two errors come which mention Cast argument into Collection and Cast argument into Item Component. I don't know which one to choose nor know how those works. if you could explain to me it would be really helpful.
Edit: and also the difference between setActionRow and addActionRow

DrEggCake
Автор

hi, when I tried to write the exact same code as yours for the message, it does not have a MessageBuilder() option for me, but only has something like MessageCreateBuilder() and that does not work with rest of the code. Do you know why this is happening? I couldn't find how they updated it online.

yxy