Skip to content

Commit bc84a55

Browse files
committed
Move buttons around
1 parent 7012c6c commit bc84a55

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/watcher/java/com/mcmoddev/mmdbot/watcher/rules/UpdateRulesCommand.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,9 @@ protected void execute(final SlashCommandEvent event) {
118118
event.getHook().sendMessage("There was an exception executing that command: " + e.getLocalizedMessage())
119119
.setEphemeral(true).queue();
120120
} else {
121-
channel.sendMessage("By clicking the button below you agree to have read the rules, and you will have access to talk in the server.")
121+
channel.sendMessage("Click the button bellow to be able to talk in the server.")
122122
.setActionRow(Button.of(
123-
ButtonStyle.SECONDARY, "rules-accept-start", "\uD83D\uDCDA I agree to the rules"
124-
), Button.of(
125-
ButtonStyle.SUCCESS, "rules-accept-denied", "\uD83D\uDEAE️ I refuse to accept the rules"
123+
ButtonStyle.PRIMARY, "rules-accept-start", "Click me!"
126124
))
127125
.flatMap($$$$ -> event.getHook().sendMessage("Successfully updated the rules!").setEphemeral(true))
128126
.queue();
@@ -158,15 +156,12 @@ public static void onEvent(final GenericEvent gEvent) {
158156
final var role = event.getGuild().getRoleById(getAcceptedRulesRole(event.getGuild().getIdLong()));
159157
if (role == null) {
160158
event.reply("The server has not configured a valid 'Rules Agreed' rule, please contact server admins.")
161-
.setEphemeral(true).queue();
159+
.setEphemeral(true)
160+
.queue();
162161
return;
163162
}
164163

165164
if (event.getButton().getId().equals("rules-accept-start")) {
166-
if (event.getMember().getRoles().stream().anyMatch(it -> it.getIdLong() == role.getIdLong())) {
167-
event.reply("You have already agreed to the rules!").setEphemeral(true).queue();
168-
return;
169-
}
170165
event.reply("By clicking the button below, you accept that you have read the rules, you agree to them, and you will follow them in every interaction in the server.")
171166
.addActionRow(Button.of(
172167
ButtonStyle.SECONDARY, "rules-agreed", "\uD83D\uDCDA I agree to the rules"
@@ -176,6 +171,10 @@ public static void onEvent(final GenericEvent gEvent) {
176171
.setEphemeral(true)
177172
.queue();
178173
} else if (event.getButton().getId().equals("rules-agreed")) {
174+
if (event.getMember().getRoles().stream().anyMatch(it -> it.getIdLong() == role.getIdLong())) {
175+
event.reply("You have already agreed to the rules!").setEphemeral(true).queue();
176+
return;
177+
}
179178
event.getGuild().modifyMemberRoles(event.getMember(), List.of(role), null)
180179
.flatMap(v -> event.reply("Role granted! Have fun in the server, and remember to abide to the rules!")
181180
.setEphemeral(true))

0 commit comments

Comments
 (0)