Adjust getChatId in utils for the new content

This commit is contained in:
Abbas Abou Daya 2020-04-27 21:36:33 -07:00
parent 40c17126ae
commit e4dbf27c55
1 changed files with 7 additions and 3 deletions

View File

@ -150,6 +150,12 @@ public final class AbilityUtils {
return update.getEditedMessage().getChatId();
} else if (CHOSEN_INLINE_QUERY.test(update)) {
return (long) update.getChosenInlineQuery().getFrom().getId();
} else if (SHIPPING_QUERY.test(update)) {
return (long) update.getShippingQuery().getFrom().getId();
} else if (PRECHECKOUT_QUERY.test(update)) {
return (long) update.getPreCheckoutQuery().getFrom().getId();
} else if (POLL_ANSWER.test(update)) {
return (long) update.getPollAnswer().getUser().getId();
} else {
throw new IllegalStateException("Could not retrieve originating chat ID from update");
}
@ -170,10 +176,8 @@ public final class AbilityUtils {
return update.getEditedChannelPost().isUserMessage();
} else if (EDITED_MESSAGE.test(update)) {
return update.getEditedMessage().isUserMessage();
} else if (CHOSEN_INLINE_QUERY.test(update) || INLINE_QUERY.test(update)) {
return true;
} else {
throw new IllegalStateException("Could not retrieve update context origin (user/group)");
return true;
}
}