TelegramBots
TelegramBots copied to clipboard
Can't listen for both MESSAGE and EDITED_MESSAGE events on default ability
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.
You can use the following WA: .flag(update -> update.hasMessage() || update.hasEditedMessage())