JDA-Applications / JDA-Utilities

A series of tools and utilities for JDA to assist in bot creation
Apache License 2.0
218 stars 111 forks source link

When using Emotes ButtonMenu does not respond to reactions #117

Closed rachied closed 4 years ago

rachied commented 4 years ago

Issue

Issue Checklist

Please follow the following steps before opening this issue.
Issues that do not complete the checklist may be closed without any help.

The issue tracker is reserved for issues, errors, and feature requests related to JDA-Utilities, and not questions and other requests for help.

  • For examples, check out the [examples module][examples-module] or the list of [JDA-Utilities projects][jda-u-projects].
  • For questions join the [official JDA discord server][guild] and ask them in our #jda-utilities channel.
  • For general programming questions, visit [StackOverflow][stack overflow].

Issue Information

Check all that apply:

This issue tracker does not assist or handle issues with the JDA library.
For JDA related issues, visit the [JDA issue tracker][jda-issues] and open an issue there.

Description

Describe your issue here.
Please provide any stack-traces, code, or pictures that will help describe the issue you are encountering.

When creating a ButtonMenu using Emotes, the event consumer in setAction is never called.

private void showPlatformSelectionMenu(Call call, Message welcomeMessage)
    {
        jda.retrieveUserById(call.getCallerId())
                .queue(user -> {

                    var menu = new ButtonMenu.Builder()
                            .setDescription("Please select your platform!")
                            .setUsers(user)
                            .setEventWaiter(waiter)
                            .setAction(reaction -> {
                                log.info("REACHED MENU REACTION EVENT");
                                onPlatformSelected(call, reaction);
                            })
                            .setTimeout(10, TimeUnit.MINUTES);

                    PLATFORMS.keySet().forEach(p -> menu.addChoices("a:" + p));
                    menu.build().display(welcomeMessage);
                    },
                        err -> onFailure(call, "An error occurred during platform selection.", true));
    }
jagrosh commented 4 years ago

As per the documentation for addChoices(String...):

Adds String unicode emojis as button choices. Any non-unicode Emotes should be added using ButtonMenu.Builder#addChoices(Emote...).

Your call to addChoices does not appear to be a string unicode emoji.

rachied commented 4 years ago

You're right, works fine when providing Emote objects.