I am creating my first Discord Bot. The bot is for a student society server. I am wanting to assign a role/allow a user join the server based on certain questions.
At the momment, when a new member joins, I send a message in the welcome channel with a welcome message. I also send an Embed with a question. I have it where if they react with thumbs up, it sends another embed asking for their student id. If they thumbs down I send an embed asking if they are student, if they thumb up react then I ask for their student.
How can I get their message and check it equals a String? e.g.(User enters student id: 32984230875 it is then check is equal to string.)
My current reaction listener method:
public void onGuildMessageReactionAdd(GuildMessageReactionAddEvent event) {
Guild guild = event.getGuild();
if(event.getMember().equals(member)) {
if(event.getChannel().getId().equals("ChannelID") && event.getReactionEmote().getName().equals("????")) {
EmbedBuilder enterStudentID = new EmbedBuilder();
enterStudentID.setTitle("Enter your Student ID:");
guild.getTextChannelById("ChannelID").sendMessage(enterStudentID.build()).queue();
} else {
EmbedBuilder isMemberStudent = new EmbedBuilder();
isMemberStudent.setTitle("Are you a Student?");
guild.getTextChannelById("ChannelID").sendMessage(isMemberStudent.build()).queue(message -> {
message.addReaction("????").queue();
message.addReaction("????").queue();
});
if(event.getChannel().getId().equals("ChannelID") && event.getReactionEmote().getName().equals("????")) {
EmbedBuilder enterStudentID = new EmbedBuilder();
enterStudentID.setTitle("Enter your Student ID:");
guild.getTextChannelById("channelID").sendMessage(enterStudentID.build()).queue();
}
}
}
}
Ps. First embed asking if they society member, is on member join method. That's what the first react is listening to.
Thanks in advance.