From e4dbf27c55437a8315d8b9d7802145a1d7992129 Mon Sep 17 00:00:00 2001 From: Abbas Abou Daya Date: Mon, 27 Apr 2020 21:36:33 -0700 Subject: [PATCH] Adjust getChatId in utils for the new content --- .../telegram/abilitybots/api/util/AbilityUtils.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/util/AbilityUtils.java b/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/util/AbilityUtils.java index f5817bb4..da928a5d 100644 --- a/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/util/AbilityUtils.java +++ b/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/util/AbilityUtils.java @@ -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; } }