Skip to content

Commit

Permalink
fix: Fixed an issue where an alias with a role that doesn't resolve w…
Browse files Browse the repository at this point in the history
…ould halt our discovery iterator for dropdowns
  • Loading branch information
benaclejames committed Nov 18, 2023
1 parent e900904 commit 23139e3
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.awt.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

public class InteractionHandler extends ListenerAdapter {
Expand Down Expand Up @@ -160,8 +161,14 @@ public static List<Pair<String, String>> getMemberNewRoles(Guild guild, Member m

var userRoleIDs = member.getRoles().stream().map(net.dv8tion.jda.api.entities.Role::getIdLong).collect(Collectors.toList());
// Now create a list of gumroad IDs that corresponds to the IDs the user already has
Map<String, GumRole> roles = gumGuild.getRoles();
aliases.forEach((alias, id) -> {
if (!userRoleIDs.contains(gumGuild.getRoles().get(id).RoleId)) {
if (!roles.containsKey(id)) {
return;
}

GumRole foundRole = roles.get(id);
if (!userRoleIDs.contains(foundRole.RoleId)) {
returnList.add(new Pair<>(alias, id));
}
});
Expand Down

0 comments on commit 23139e3

Please # to comment.