Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't listen for both MESSAGE and EDITED_MESSAGE events on default ability #1297

Open
Haarolean opened this issue Jan 10, 2024 · 1 comment

Comments

@Haarolean
Copy link

I'm having a default ability to check the messages (I need to do that for both new and edited messages) defined this way:

return Ability
                .builder()
                .name("default")
                .flag(Flag.MESSAGE, EDITED_MESSAGE)
                .locality(Locality.ALL)
                .privacy(Privacy.PUBLIC)
                .action(ctx -> {
                    checkLinks(ctx);
                })
                .build();

With this approach, checkMessageFlags in BaseAbilityBot always fails, if at least one of the flags tests false (it's always false in my case, since an update can't be both new and an edited message simultaneously).

Another approach I thought of (registering two abilities with different flags) fails as well, as we can't have more than one default ability.

@ekomrak
Copy link

ekomrak commented Apr 14, 2024

You can use the following WA:
.flag(update -> update.hasMessage() || update.hasEditedMessage())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants