public static Long getChatId ( Update update ) { if ( MESSAGE . test ( update ) ) { return update . getMessage ( ) . getChatId ( ) ; } else if ( CALLBACK_QUERY . test ( update ) ) { return update . getCallbackQuery ( ) . getMessage ( ) . getChatId ( ) ; } else if ( INLINE_QUERY . test ( update ) ) { return ( long ) update . getInlineQuery ( ) . getFrom ( ) . getId ( ) ; } else if ( CHANNEL_POST . test ( update ) ) { return update . getChannelPost ( ) . getChatId ( ) ; } else if ( EDITED_CHANNEL_POST . test ( update ) ) { return update . getEditedChannelPost ( ) . getChatId ( ) ; } else if ( EDITED_MESSAGE . test ( update ) ) { return update . getEditedMessage ( ) . getChatId ( ) ; } else if ( CHOSEN_INLINE_QUERY . test ( update ) ) { return ( long ) update . getChosenInlineQuery ( ) . getFrom ( ) . getId ( ) ; } else { throw new IllegalStateException ( "Could not retrieve originating chat ID from update" ) ; } }
Fetches the direct chat ID of the specified update .