sxcybot

Discord bot for OSRS based channels
git clone git://git.wimdupont.com/sxcybot.git
Log | Files | Refs | README | LICENSE

commit 330c5f7bdbefec69141e3681d09b161892512e4b
parent 3c004e84b0e3530657c07a1cf6279df686da12ed
Author: WimDupont <WimDupont@users.noreply.gitlab.com>
Date:   Sun,  7 Nov 2021 18:54:09 +0100

small embedbuilder field improvements

Diffstat:
Msrc/main/java/com/sxcy/sxcybot/listeners/admin/RoleAssignListener.java | 11+++++------
Msrc/main/java/com/sxcy/sxcybot/listeners/admin/pvmrole/AddPvmListener.java | 4++--
2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/src/main/java/com/sxcy/sxcybot/listeners/admin/RoleAssignListener.java b/src/main/java/com/sxcy/sxcybot/listeners/admin/RoleAssignListener.java @@ -45,16 +45,15 @@ public class RoleAssignListener implements Listener { EmbedBuilder embedBuilder = new EmbedBuilder(); embedBuilder.setColor(Color.RED); embedBuilder.setTitle("Role assigner"); - discordMemberFinderUtil.onMemberFoundVerification(event, embedBuilder, privateChannel, (member) -> { - EmbedBuilder roleListEmberBuilder = new EmbedBuilder(); - roleListEmberBuilder.setColor(Color.RED); - roleListEmberBuilder.setTitle("Type the number of the role to add, if the member already has this role it will get removed instead."); + discordMemberFinderUtil.onMemberFoundVerification(event, embedBuilder, privateChannel, member -> { + embedBuilder.clearFields(); + embedBuilder.setTitle("Type the number of the role to add, if the member already has this role it will get removed instead."); List<GuildRole> rolesToAdd = guildRoleService.findAllByElevationGreaterThanEqual(ADDED_ROLE_ELEVATION) .stream().sorted(Comparator.nullsLast(Comparator.comparing(GuildRole::getOrderValue))).collect(Collectors.toList()); for (GuildRole guildRole : rolesToAdd) { - roleListEmberBuilder.addField(String.valueOf(guildRole.getOrderValue()), String.valueOf(guildRole.getName()), true); + embedBuilder.addField(String.valueOf(guildRole.getOrderValue()), String.valueOf(guildRole.getName()), true); } - privateChannel.sendMessage(roleListEmberBuilder.build()).queue(); + privateChannel.sendMessage(embedBuilder.build()).queue(); eventWaiterUtil.waitForPrivateChannelEvent(roleReceiver -> { String roleMessage = roleReceiver.getMessage().getContentRaw(); try { diff --git a/src/main/java/com/sxcy/sxcybot/listeners/admin/pvmrole/AddPvmListener.java b/src/main/java/com/sxcy/sxcybot/listeners/admin/pvmrole/AddPvmListener.java @@ -38,10 +38,10 @@ public class AddPvmListener implements PrivateListener { EmbedBuilder embedBuilder = new EmbedBuilder(); embedBuilder.setColor(Color.RED); embedBuilder.setTitle("Add member for PvM competition"); - discordMemberFinderUtil.onMemberFoundVerification(event, embedBuilder, privateChannel, (member) -> { + discordMemberFinderUtil.onMemberFoundVerification(event, embedBuilder, privateChannel, member -> { + embedBuilder.clearFields(); embedBuilder.addField("Type the RSN (RuneScape name) of the member.", "", true); privateChannel.sendMessage(embedBuilder.build()).queue(); - embedBuilder.clearFields(); eventWaiterUtil.waitForPrivateChannelEvent((rsnReceiver) -> { String creator = JdaUtil.getName(event); try {