├── .github ├── settings.xml └── workflows │ ├── ci.yml │ └── release.yml ├── .gitignore ├── LICENSE ├── README.md ├── assets ├── logo-bg.ai ├── logo-bg.png ├── logo-bg.svg ├── logo.ai ├── logo.png └── logo.svg ├── jtelegrambotapi-core ├── pom.xml ├── src │ ├── main │ │ └── java │ │ │ └── com │ │ │ └── jtelegram │ │ │ └── api │ │ │ ├── TelegramBot.java │ │ │ ├── TelegramBotRegistry.java │ │ │ ├── TelegramFile.java │ │ │ ├── chat │ │ │ ├── ChannelChat.java │ │ │ ├── Chat.java │ │ │ ├── ChatAction.java │ │ │ ├── ChatMember.java │ │ │ ├── ChatMemberStatus.java │ │ │ ├── ChatPhoto.java │ │ │ ├── ChatType.java │ │ │ ├── GroupChat.java │ │ │ ├── PrivateChat.java │ │ │ ├── SupergroupChat.java │ │ │ ├── id │ │ │ │ ├── ChatId.java │ │ │ │ ├── LongChatId.java │ │ │ │ └── StringChatId.java │ │ │ └── type │ │ │ │ ├── LargeChat.java │ │ │ │ └── MultiMemberChat.java │ │ │ ├── commands │ │ │ ├── Command.java │ │ │ ├── CommandHandler.java │ │ │ ├── CommandRegistry.java │ │ │ └── filters │ │ │ │ ├── AbstractCommandFilter.java │ │ │ │ ├── ChatTypeFilter.java │ │ │ │ ├── CommandFilter.java │ │ │ │ ├── MentionFilter.java │ │ │ │ ├── RegexFilter.java │ │ │ │ ├── RootFilter.java │ │ │ │ └── TextFilter.java │ │ │ ├── events │ │ │ ├── Event.java │ │ │ ├── EventHandler.java │ │ │ ├── EventRegistry.java │ │ │ ├── channel │ │ │ │ ├── ChannelPostEditEvent.java │ │ │ │ └── ChannelPostEvent.java │ │ │ ├── chat │ │ │ │ ├── ChatMemberJoinedEvent.java │ │ │ │ ├── ChatMemberLeftEvent.java │ │ │ │ ├── ChatMigratedFromChatEvent.java │ │ │ │ ├── ChatMigratedToChatEvent.java │ │ │ │ ├── ChatPhotoDeletedEvent.java │ │ │ │ ├── GroupChatCreatedEvent.java │ │ │ │ ├── NewChatPhotoEvent.java │ │ │ │ ├── NewChatTitleEvent.java │ │ │ │ ├── PinnedMessageEvent.java │ │ │ │ └── UserLoggedInEvent.java │ │ │ ├── inline │ │ │ │ ├── ChosenInlineResultEvent.java │ │ │ │ ├── InlineQueryEvent.java │ │ │ │ └── keyboard │ │ │ │ │ └── CallbackQueryEvent.java │ │ │ ├── location │ │ │ │ └── LocationUpdateEvent.java │ │ │ ├── message │ │ │ │ ├── AnimationMessageEvent.java │ │ │ │ ├── AudioMessageEvent.java │ │ │ │ ├── ContactMessageEvent.java │ │ │ │ ├── DocumentMessageEvent.java │ │ │ │ ├── GameMessageEvent.java │ │ │ │ ├── InvoiceMessageEvent.java │ │ │ │ ├── LocationMessageEvent.java │ │ │ │ ├── MessageEvent.java │ │ │ │ ├── PhotoMessageEvent.java │ │ │ │ ├── ServiceMessageEvent.java │ │ │ │ ├── StickerMessageEvent.java │ │ │ │ ├── TextMessageEvent.java │ │ │ │ ├── VenueMessageEvent.java │ │ │ │ ├── VideoMessageEvent.java │ │ │ │ ├── VideoNoteMessageEvent.java │ │ │ │ ├── VoiceMessageEvent.java │ │ │ │ └── edit │ │ │ │ │ ├── CaptionEditEvent.java │ │ │ │ │ └── TextMessageEditEvent.java │ │ │ └── payment │ │ │ │ ├── PreCheckoutQueryEvent.java │ │ │ │ ├── ShippingQueryEvent.java │ │ │ │ └── SuccessfulPaymentEvent.java │ │ │ ├── ex │ │ │ ├── EventException.java │ │ │ ├── InvalidResponseException.java │ │ │ ├── MessageBasedException.java │ │ │ ├── NetworkException.java │ │ │ ├── TelegramApiException.java │ │ │ ├── TelegramException.java │ │ │ └── handler │ │ │ │ ├── DynamicErrorHandler.java │ │ │ │ └── ErrorLogger.java │ │ │ ├── inline │ │ │ ├── CallbackQuery.java │ │ │ ├── InlineQuery.java │ │ │ ├── input │ │ │ │ ├── InputContactMessageContent.java │ │ │ │ ├── InputLocationMessageContent.java │ │ │ │ ├── InputMessageContent.java │ │ │ │ ├── InputTextMessageContent.java │ │ │ │ └── InputVenueMessageContent.java │ │ │ ├── keyboard │ │ │ │ ├── InlineKeyboardButton.java │ │ │ │ ├── InlineKeyboardMarkup.java │ │ │ │ └── InlineKeyboardRow.java │ │ │ └── result │ │ │ │ ├── ChosenInlineResult.java │ │ │ │ ├── InlineResultArticle.java │ │ │ │ ├── InlineResultAudio.java │ │ │ │ ├── InlineResultContact.java │ │ │ │ ├── InlineResultDocument.java │ │ │ │ ├── InlineResultGame.java │ │ │ │ ├── InlineResultGif.java │ │ │ │ ├── InlineResultLocation.java │ │ │ │ ├── InlineResultMpegGif.java │ │ │ │ ├── InlineResultPhoto.java │ │ │ │ ├── InlineResultVenue.java │ │ │ │ ├── InlineResultVideo.java │ │ │ │ ├── InlineResultVoice.java │ │ │ │ ├── cached │ │ │ │ ├── InlineCachedResultAudio.java │ │ │ │ ├── InlineCachedResultDocument.java │ │ │ │ ├── InlineCachedResultGif.java │ │ │ │ ├── InlineCachedResultMpegGif.java │ │ │ │ ├── InlineCachedResultPhoto.java │ │ │ │ ├── InlineCachedResultSticker.java │ │ │ │ ├── InlineCachedResultVideo.java │ │ │ │ └── InlineCachedResultVoice.java │ │ │ │ └── framework │ │ │ │ ├── DimensionalThumbableInlineResult.java │ │ │ │ ├── InlineResult.java │ │ │ │ ├── InlineResultType.java │ │ │ │ └── ThumbableInlineResult.java │ │ │ ├── message │ │ │ ├── CaptionableMessage.java │ │ │ ├── Message.java │ │ │ ├── MessageType.java │ │ │ ├── entity │ │ │ │ ├── MessageEntity.java │ │ │ │ ├── MessageEntityType.java │ │ │ │ ├── TextLinkMessageEntity.java │ │ │ │ ├── TextMentionMessageEntity.java │ │ │ │ └── UnsupportedMessageEntity.java │ │ │ ├── games │ │ │ │ ├── Animation.java │ │ │ │ ├── CallbackGame.java │ │ │ │ ├── Game.java │ │ │ │ └── GameHighScore.java │ │ │ ├── impl │ │ │ │ ├── AnimationMessage.java │ │ │ │ ├── AudioMessage.java │ │ │ │ ├── ContactMessage.java │ │ │ │ ├── DocumentMessage.java │ │ │ │ ├── GameMessage.java │ │ │ │ ├── InvoiceMessage.java │ │ │ │ ├── LocationMessage.java │ │ │ │ ├── PhotoMessage.java │ │ │ │ ├── StickerMessage.java │ │ │ │ ├── SuccessfulPaymentMessage.java │ │ │ │ ├── TextMessage.java │ │ │ │ ├── VenueMessage.java │ │ │ │ ├── VideoMessage.java │ │ │ │ ├── VideoNoteMessage.java │ │ │ │ ├── VoiceMessage.java │ │ │ │ └── service │ │ │ │ │ ├── ChannelChatCreatedMessage.java │ │ │ │ │ ├── DeleteChatPhotoMessage.java │ │ │ │ │ ├── GroupChatCreatedMessage.java │ │ │ │ │ ├── LeftChatMemberMessage.java │ │ │ │ │ ├── MigrateFromChatIdMessage.java │ │ │ │ │ ├── MigrateToChatIdMessage.java │ │ │ │ │ ├── NewChatMembersMessage.java │ │ │ │ │ ├── NewChatPhotoMessage.java │ │ │ │ │ ├── NewChatTitleMessage.java │ │ │ │ │ ├── PinnedMessageMessage.java │ │ │ │ │ ├── ServiceMessage.java │ │ │ │ │ ├── SupergroupChatCreatedMessage.java │ │ │ │ │ └── UserLoggedInMessage.java │ │ │ ├── input │ │ │ │ ├── file │ │ │ │ │ ├── ExternalInputFile.java │ │ │ │ │ ├── IdInputFile.java │ │ │ │ │ ├── InputFile.java │ │ │ │ │ ├── InputFileRequest.java │ │ │ │ │ └── LocalInputFile.java │ │ │ │ └── media │ │ │ │ │ ├── AnimatedInputMedia.java │ │ │ │ │ ├── AnimationInputMedia.java │ │ │ │ │ ├── AudioInputMedia.java │ │ │ │ │ ├── DocumentInputMedia.java │ │ │ │ │ ├── InputMedia.java │ │ │ │ │ ├── InputMediaType.java │ │ │ │ │ ├── PhotoInputMedia.java │ │ │ │ │ ├── ThumbableInputMedia.java │ │ │ │ │ └── VideoInputMedia.java │ │ │ ├── keyboard │ │ │ │ ├── KeyboardButton.java │ │ │ │ ├── ReplyKeyboardMarkup.java │ │ │ │ └── ReplyKeyboardRow.java │ │ │ ├── media │ │ │ │ ├── Animation.java │ │ │ │ ├── Audio.java │ │ │ │ ├── Contact.java │ │ │ │ ├── Document.java │ │ │ │ ├── DuratableMedium.java │ │ │ │ ├── FileMedium.java │ │ │ │ ├── Location.java │ │ │ │ ├── MimeableMedium.java │ │ │ │ ├── PhotoSize.java │ │ │ │ ├── SendableMedium.java │ │ │ │ ├── ThumbableMedium.java │ │ │ │ ├── Venue.java │ │ │ │ ├── Video.java │ │ │ │ ├── VideoNote.java │ │ │ │ ├── VisualFileMedium.java │ │ │ │ └── Voice.java │ │ │ ├── payments │ │ │ │ ├── Invoice.java │ │ │ │ ├── LabeledPrice.java │ │ │ │ ├── OrderInfo.java │ │ │ │ ├── PreCheckoutQuery.java │ │ │ │ ├── ShippingAddress.java │ │ │ │ ├── ShippingOption.java │ │ │ │ ├── ShippingQuery.java │ │ │ │ └── SuccessfulPayment.java │ │ │ └── sticker │ │ │ │ ├── MaskPoint.java │ │ │ │ ├── MaskPosition.java │ │ │ │ ├── Sticker.java │ │ │ │ └── StickerSet.java │ │ │ ├── requests │ │ │ ├── GetFile.java │ │ │ ├── GetMe.java │ │ │ ├── GetUpdates.java │ │ │ ├── GetUserProfilePhotos.java │ │ │ ├── chat │ │ │ │ ├── GetChat.java │ │ │ │ ├── GetChatAdministrators.java │ │ │ │ ├── GetChatMember.java │ │ │ │ ├── GetChatMembersCount.java │ │ │ │ ├── LeaveChat.java │ │ │ │ ├── SendChatAction.java │ │ │ │ └── admin │ │ │ │ │ ├── DeleteChatPhoto.java │ │ │ │ │ ├── DeleteChatStickerSet.java │ │ │ │ │ ├── ExportChatInviteLink.java │ │ │ │ │ ├── KickChatMember.java │ │ │ │ │ ├── PinChatMessage.java │ │ │ │ │ ├── PromoteChatMember.java │ │ │ │ │ ├── RestrictChatMember.java │ │ │ │ │ ├── SetChatDescription.java │ │ │ │ │ ├── SetChatPhoto.java │ │ │ │ │ ├── SetChatStickerSet.java │ │ │ │ │ ├── SetChatTitle.java │ │ │ │ │ ├── UnbanChatMember.java │ │ │ │ │ └── UnpinChatMessage.java │ │ │ ├── framework │ │ │ │ ├── AbstractTelegramRequest.java │ │ │ │ ├── BotRequest.java │ │ │ │ ├── BotRequestQueue.java │ │ │ │ ├── QueryTelegramRequest.java │ │ │ │ ├── ResponseParameters.java │ │ │ │ ├── TelegramRequest.java │ │ │ │ └── UpdateTelegramRequest.java │ │ │ ├── game │ │ │ │ ├── GetGameHighScores.java │ │ │ │ └── SetGameScore.java │ │ │ ├── inline │ │ │ │ ├── AnswerCallbackQuery.java │ │ │ │ └── AnswerInlineQuery.java │ │ │ ├── message │ │ │ │ ├── DeleteMessage.java │ │ │ │ ├── ForwardMessage.java │ │ │ │ ├── StopMessageLiveLocation.java │ │ │ │ ├── edit │ │ │ │ │ ├── EditMessageCaption.java │ │ │ │ │ ├── EditMessageLiveLocation.java │ │ │ │ │ ├── EditMessageMedia.java │ │ │ │ │ ├── EditMessageReplyMarkup.java │ │ │ │ │ └── EditTextMessage.java │ │ │ │ ├── framework │ │ │ │ │ ├── ParseMode.java │ │ │ │ │ ├── ReplyMarkup.java │ │ │ │ │ └── req │ │ │ │ │ │ ├── EditMessageRequest.java │ │ │ │ │ │ ├── InputFileMessageRequest.java │ │ │ │ │ │ ├── InputFileMessageUpdate.java │ │ │ │ │ │ ├── SendableChatRequest.java │ │ │ │ │ │ ├── SendableInlineRequest.java │ │ │ │ │ │ ├── SendableInputFileInlineRequest.java │ │ │ │ │ │ ├── SendableMessageRequest.java │ │ │ │ │ │ ├── UpdatableChatRequest.java │ │ │ │ │ │ └── UserAdminChatRequest.java │ │ │ │ └── send │ │ │ │ │ ├── SendAnimation.java │ │ │ │ │ ├── SendAudio.java │ │ │ │ │ ├── SendContact.java │ │ │ │ │ ├── SendDocument.java │ │ │ │ │ ├── SendGame.java │ │ │ │ │ ├── SendInvoice.java │ │ │ │ │ ├── SendLocation.java │ │ │ │ │ ├── SendMediaGroup.java │ │ │ │ │ ├── SendPhoto.java │ │ │ │ │ ├── SendSticker.java │ │ │ │ │ ├── SendText.java │ │ │ │ │ ├── SendVenue.java │ │ │ │ │ ├── SendVideo.java │ │ │ │ │ ├── SendVideoNote.java │ │ │ │ │ └── SendVoice.java │ │ │ ├── payment │ │ │ │ ├── AnswerPreCheckoutQuery.java │ │ │ │ └── AnswerShippingQuery.java │ │ │ ├── sticker │ │ │ │ ├── AddSticker.java │ │ │ │ ├── CreateNewStickerSet.java │ │ │ │ ├── DeleteSticker.java │ │ │ │ ├── GetStickerSet.java │ │ │ │ ├── SetStickerPosition.java │ │ │ │ └── UploadStickerFile.java │ │ │ └── webhooks │ │ │ │ ├── DeleteWebhook.java │ │ │ │ ├── GetWebhookInfo.java │ │ │ │ ├── SetWebhook.java │ │ │ │ └── WebhookInfo.java │ │ │ ├── update │ │ │ ├── PollingUpdateProvider.java │ │ │ ├── PollingUpdateRunnable.java │ │ │ ├── Update.java │ │ │ ├── UpdateProvider.java │ │ │ └── UpdateType.java │ │ │ ├── user │ │ │ ├── User.java │ │ │ └── UserProfilePhotos.java │ │ │ └── util │ │ │ ├── ExceptionThreadFactory.java │ │ │ ├── LowercaseEnumAdapter.java │ │ │ └── TextBuilder.java │ └── test │ │ └── java │ │ └── com │ │ └── jtelegram │ │ └── api │ │ ├── ex │ │ └── handler │ │ │ └── DynamicErrorHandlerTest.java │ │ └── requests │ │ └── message │ │ ├── DeleteMessageTest.java │ │ ├── ForwardMessageTest.java │ │ └── edit │ │ ├── EditMessageCaptionTest.java │ │ ├── EditMessageLiveLocationTest.java │ │ ├── EditMessageMediaTest.java │ │ ├── EditMessageReplyMarkupTest.java │ │ └── EditTextMessageTest.java └── uml.zip ├── jtelegrambotapi-menus ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── jtelegram │ └── api │ └── menu │ ├── Menu.java │ ├── MenuButton.java │ ├── MenuHandler.java │ ├── MenuRow.java │ ├── MenuViewer.java │ ├── SimpleMenu.java │ ├── SimpleMenuButton.java │ ├── events │ └── UnregisteredMenuInteractionEvent.java │ └── viewer │ ├── InlineMenuViewer.java │ └── RegularMenuViewer.java ├── jtelegrambotapi-test ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── jtelegram │ │ └── api │ │ └── test │ │ ├── AbstractTestModule.java │ │ ├── BotMainTest.java │ │ ├── ResourceTestModule.java │ │ ├── TestModule.java │ │ ├── message │ │ ├── ForwardMessageTest.java │ │ ├── LiveLocationTest.java │ │ ├── LocationMessageTest.java │ │ ├── PhotoTest.java │ │ ├── TextBuilderTest.java │ │ └── VenueTest.java │ │ └── misc │ │ └── UserProfilePhotosTest.java │ └── resources │ └── test-photo.jpg ├── jtelegrambotapi-webhooks ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── jtelegram │ └── api │ └── webhooks │ ├── FailBindingException.java │ └── WebhookUpdateProvider.java ├── ktelegrambotapi ├── pom.xml └── src │ └── main │ └── kotlin │ └── com │ └── jtelegram │ └── api │ └── kotlin │ ├── BotContext.kt │ ├── KTelegramBot.kt │ ├── TelegramBot.kt │ ├── TelegramBotRegistry.kt │ ├── commands │ └── CommandRegistry.kt │ ├── events │ ├── EventRegistry.kt │ ├── inline │ │ └── InlineQueryEvent.kt │ └── message │ │ └── MessageEvent.kt │ └── util │ └── TextBuilder.kt └── pom.xml /.github/settings.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | github 8 | 9 | 10 | 11 | 12 | github 13 | 14 | 15 | github 16 | GitHub jTelegram Apache Maven Packages 17 | https://maven.pkg.github.com/jTelegram/jTelegramBotAPI 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | github 26 | ${github.user} 27 | ${github.password} 28 | 29 | 30 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 'pull_request' 4 | 5 | jobs: 6 | build: 7 | 8 | runs-on: ubuntu-latest 9 | 10 | steps: 11 | - uses: actions/checkout@v1 12 | 13 | - name: Set up JDK 11 14 | uses: actions/setup-java@v1 15 | with: 16 | java-version: 11.0.5 17 | 18 | - name: Build and Test jTelegram 19 | run: mvn clean test 20 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Release 2 | 3 | on: 4 | push: 5 | tags: 6 | - '*' 7 | 8 | jobs: 9 | build: 10 | 11 | runs-on: ubuntu-latest 12 | 13 | steps: 14 | - uses: actions/checkout@v1 15 | 16 | - name: Get the version 17 | id: get_version 18 | run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}\ 19 | 20 | - name: Set up JDK 11 21 | uses: actions/setup-java@v1 22 | with: 23 | java-version: 11.0.5 24 | 25 | - name: Build and Test jTelegram 26 | run: mvn clean test 27 | 28 | - name: Create Release 29 | uses: softprops/action-gh-release@v1 30 | with: 31 | files: ./**/target/*.jar 32 | env: 33 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 34 | 35 | - name: Publish jTelegram 36 | run: mvn -B -e --settings .github/settings.xml -Dmaven.wagon.http.pool=false -Dgithub.user=${{ secrets.github_user }} -Dgithub.password=${{ secrets.github_pat }} org.codehaus.mojo:versions-maven-plugin:2.3:set -DnewVersion=$VERSION clean deploy 37 | env: 38 | VERSION: ${{ steps.get_version.outputs.VERSION }} 39 | 40 | - name: Publish javadocs 41 | uses: JamesIves/github-pages-deploy-action@releases/v3 42 | with: 43 | ACCESS_TOKEN: ${{ secrets.github_pat }} 44 | BRANCH: gh-pages 45 | FOLDER: jtelegrambotapi-core/target/apidocs 46 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # IntelliJ 2 | .idea/ 3 | *.iml 4 | 5 | # Java 6 | *.class 7 | *.jar 8 | 9 | # Others 10 | target/ 11 | **/src/main/delombok/ 12 | dependency-reduced-pom.xml 13 | 14 | # Windows 15 | Thumbs.db 16 | ehthumbs.db 17 | Desktop.ini 18 | $RECYCLE.BIN/ 19 | 20 | # Linux 21 | .* 22 | !.gitattributes 23 | !.gitignore 24 | 25 | # OSX 26 | .DS_Store 27 | .AppleDouble 28 | .LSOverride 29 | ._* 30 | .DocumentRevisions-V100 31 | .fseventsd 32 | .Spotlight-V100 33 | .TemporaryItems 34 | .Trashes 35 | .VolumeIcon.icns 36 | .com.apple.timemachine.donotpresent 37 | .AppleDB 38 | .AppleDesktop 39 | Network Trash Folder 40 | Temporary Items 41 | .apdisk 42 | infer-out/ 43 | 44 | # Ignore travis 45 | !.github/ 46 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2017 jTelegram.com 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # jTelegram Bot API 2 | 3 | [![Build Status](https://travis-ci.org/jTelegram/jTelegramBotAPI.svg?branch=master)](https://travis-ci.org/jTelegram/jTelegramBotAPI) 4 | 5 | jTelegram is a Java API Wrapper for the Telegram Bot API. The wrapper supports all features implemented in v4.0, including: 6 | 7 | ✅ Multiple Concurrent Bots 8 | 9 | ✅ Polling and Webhook Support (including self-signed certificates!) 10 | 11 | ✅ Games API 12 | 13 | ✅ Payments 14 | 15 | ✅ Exceptions 16 | 17 | ✅ ... and a whole variety of features allowing you to build the bot of your desires 18 | 19 | ## Getting Started 20 | 21 | To get started, check out our wiki [here](https://github.com/jtelegram/jTelegramBotAPI/wiki). 22 | 23 | ## Documentation 24 | 25 | Our latest Javadocs are available [here](https://jtelegram.github.io/jTelegramBotAPI/). 26 | 27 | ## Support 28 | 29 | You can find our support group [here](https://t.me/jTelegramSupport). 30 | If you have any questions, request a feature, or help out with an issue, we'd be happy to help in a moments notice. 31 | We can provide support in English, French (Français), and Persian (فارسی). Although, please keep in mind that the group is mainly in English. 32 | 33 | ## Licensing 34 | 35 | This project is under the MIT license, please consult [this link](https://github.com/jTelegram/jTelegramBotAPI/blob/master/LICENSE) for more information. 36 | -------------------------------------------------------------------------------- /assets/logo-bg.ai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jTelegram/jTelegramBotAPI/1696ba9bfcb3d9e6fdb2bed78c942c87dd08c86b/assets/logo-bg.ai -------------------------------------------------------------------------------- /assets/logo-bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jTelegram/jTelegramBotAPI/1696ba9bfcb3d9e6fdb2bed78c942c87dd08c86b/assets/logo-bg.png -------------------------------------------------------------------------------- /assets/logo-bg.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | 17 | logo-bg 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /assets/logo.ai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jTelegram/jTelegramBotAPI/1696ba9bfcb3d9e6fdb2bed78c942c87dd08c86b/assets/logo.ai -------------------------------------------------------------------------------- /assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jTelegram/jTelegramBotAPI/1696ba9bfcb3d9e6fdb2bed78c942c87dd08c86b/assets/logo.png -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/TelegramFile.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api; 2 | 3 | import lombok.AccessLevel; 4 | import lombok.Getter; 5 | import lombok.NoArgsConstructor; 6 | import lombok.ToString; 7 | 8 | @Getter 9 | @ToString 10 | @NoArgsConstructor(access = AccessLevel.PROTECTED) 11 | public class TelegramFile { 12 | private String fileId; 13 | private int fileSize; 14 | private String filePath; 15 | } 16 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/chat/ChannelChat.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.chat; 2 | 3 | import com.jtelegram.api.chat.type.LargeChat; 4 | import lombok.ToString; 5 | 6 | @ToString(callSuper = true) 7 | public class ChannelChat extends LargeChat { 8 | } 9 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/chat/ChatAction.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.chat; 2 | 3 | public enum ChatAction { 4 | TYPING, 5 | UPLOAD_PHOTO, 6 | RECORD_VIDEO, 7 | UPLOAD_VIDEO, 8 | UPLOAD_AUDIO, 9 | UPLOAD_DOCUMENT, 10 | FIND_LOCATION, 11 | RECORD_VIDEO_NOTE, 12 | UPLOAD_VIDEO_NOTE 13 | } 14 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/chat/ChatMember.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.chat; 2 | 3 | import com.jtelegram.api.user.User; 4 | import lombok.*; 5 | 6 | @Getter 7 | @ToString 8 | @NoArgsConstructor(access = AccessLevel.PROTECTED) 9 | @EqualsAndHashCode(of = "user") 10 | public class ChatMember { 11 | private User user; 12 | private ChatMemberStatus status; 13 | private boolean canBeEdited; 14 | private boolean canChangeInfo; 15 | private boolean canPostMessages; 16 | private boolean canEditMessages; 17 | private boolean canDeleteMessages; 18 | private boolean canInviteUsers; 19 | private boolean canRestrictMembers; 20 | private boolean canPinMessages; 21 | private boolean canPromoteMembers; 22 | private boolean canSendMessages; 23 | private boolean canSendMediaMessages; 24 | private boolean canSendOtherMessages; 25 | private boolean canAddWebPagePreviews; 26 | } 27 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/chat/ChatMemberStatus.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.chat; 2 | 3 | public enum ChatMemberStatus { 4 | CREATOR, 5 | ADMINISTRATOR, 6 | MEMBER, 7 | RESTRICTED, 8 | LEFT, 9 | KICKED 10 | } 11 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/chat/ChatPhoto.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.chat; 2 | 3 | import lombok.Getter; 4 | import lombok.ToString; 5 | 6 | @Getter 7 | @ToString 8 | public class ChatPhoto { 9 | private String smallFileId; 10 | private String bigFileId; 11 | } 12 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/chat/ChatType.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.chat; 2 | 3 | import lombok.Getter; 4 | import lombok.ToString; 5 | 6 | public enum ChatType { 7 | PRIVATE(PrivateChat.class), 8 | GROUP(GroupChat.class), 9 | SUPERGROUP(SupergroupChat.class), 10 | CHANNEL(ChannelChat.class); 11 | 12 | @Getter 13 | private Class representingClass; 14 | 15 | ChatType(Class representingClass) { 16 | this.representingClass = representingClass; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/chat/GroupChat.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.chat; 2 | 3 | import com.jtelegram.api.chat.type.MultiMemberChat; 4 | import lombok.ToString; 5 | 6 | @ToString(callSuper = true) 7 | public class GroupChat extends MultiMemberChat { 8 | } 9 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/chat/PrivateChat.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.chat; 2 | 3 | import lombok.Getter; 4 | import lombok.ToString; 5 | 6 | @Getter 7 | @ToString(callSuper = true) 8 | public class PrivateChat extends Chat { 9 | private String firstName; 10 | private String lastName; 11 | 12 | public String getFullName() { 13 | return firstName + " " + lastName; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/chat/SupergroupChat.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.chat; 2 | 3 | import com.jtelegram.api.chat.type.LargeChat; 4 | import lombok.Getter; 5 | import lombok.ToString; 6 | 7 | @Getter 8 | @ToString(callSuper = true) 9 | public class SupergroupChat extends LargeChat { 10 | private String stickerSetName; 11 | private boolean canSetStickerSet; 12 | } 13 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/chat/id/ChatId.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.chat.id; 2 | 3 | import com.google.gson.JsonElement; 4 | import com.google.gson.JsonPrimitive; 5 | import com.google.gson.JsonSerializationContext; 6 | import com.google.gson.JsonSerializer; 7 | import com.jtelegram.api.chat.Chat; 8 | import com.jtelegram.api.message.Message; 9 | 10 | import java.lang.reflect.Type; 11 | 12 | public interface ChatId { 13 | T getId(); 14 | 15 | static LongChatId of(long id) { 16 | return new LongChatId(id); 17 | } 18 | 19 | static LongChatId of(Message message) { 20 | return new LongChatId(message.getChat().getId()); 21 | } 22 | 23 | static StringChatId of(String id) { 24 | return new StringChatId(id); 25 | } 26 | 27 | static LongChatId of(Chat chat) { 28 | return new LongChatId(chat.getId()); 29 | } 30 | 31 | class Serializer implements JsonSerializer { 32 | @Override 33 | public JsonElement serialize(ChatId chatId, Type type, JsonSerializationContext jsonSerializationContext) { 34 | return chatId instanceof LongChatId ? new JsonPrimitive(((LongChatId) chatId).getId()) : new JsonPrimitive(chatId.getId().toString()); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/chat/id/LongChatId.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.chat.id; 2 | 3 | import lombok.EqualsAndHashCode; 4 | import lombok.RequiredArgsConstructor; 5 | 6 | @EqualsAndHashCode(of = "chatId") 7 | @RequiredArgsConstructor 8 | public class LongChatId implements ChatId { 9 | private final long chatId; 10 | 11 | @Override 12 | public Long getId() { 13 | return chatId; 14 | } 15 | 16 | @Override 17 | public String toString() { 18 | return String.valueOf(chatId); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/chat/id/StringChatId.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.chat.id; 2 | 3 | import lombok.EqualsAndHashCode; 4 | import lombok.RequiredArgsConstructor; 5 | 6 | @EqualsAndHashCode(of = "chatId") 7 | @RequiredArgsConstructor 8 | public class StringChatId implements ChatId { 9 | private final String chatId; 10 | //TODO: Explain in javadocs that the username HAS an @ 11 | 12 | @Override 13 | public String getId() { 14 | return chatId; 15 | } 16 | 17 | @Override 18 | public String toString() { 19 | return chatId; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/chat/type/LargeChat.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.chat.type; 2 | 3 | import com.jtelegram.api.message.Message; 4 | import lombok.Getter; 5 | import lombok.ToString; 6 | 7 | @Getter 8 | @ToString(callSuper = true) 9 | public class LargeChat extends MultiMemberChat { 10 | private String description; 11 | private String inviteLink; 12 | private Message pinnedMessage; 13 | } 14 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/chat/type/MultiMemberChat.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.chat.type; 2 | 3 | import com.jtelegram.api.chat.Chat; 4 | import lombok.Getter; 5 | import lombok.ToString; 6 | 7 | @Getter 8 | @ToString(callSuper = true) 9 | public class MultiMemberChat extends Chat { 10 | private String title; 11 | private boolean allMembersAreAdministrators; 12 | } 13 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/commands/Command.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.commands; 2 | 3 | import com.jtelegram.api.chat.Chat; 4 | import com.jtelegram.api.message.impl.TextMessage; 5 | import com.jtelegram.api.user.User; 6 | import lombok.AccessLevel; 7 | import lombok.Getter; 8 | import lombok.RequiredArgsConstructor; 9 | import lombok.ToString; 10 | 11 | import java.util.List; 12 | 13 | @RequiredArgsConstructor(access = AccessLevel.PROTECTED) 14 | @Getter 15 | @ToString 16 | public class Command { 17 | private final String baseCommand; 18 | private final boolean mentioned; 19 | private final List args; 20 | private final TextMessage baseMessage; 21 | 22 | public String getArgsAsText() { 23 | return String.join(" ", args); 24 | } 25 | 26 | public Chat getChat() { 27 | return baseMessage.getChat(); 28 | } 29 | 30 | public User getSender() { 31 | return baseMessage.getSender(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/commands/CommandHandler.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.commands; 2 | 3 | import com.jtelegram.api.commands.filters.CommandFilter; 4 | import com.jtelegram.api.events.message.TextMessageEvent; 5 | 6 | public interface CommandHandler extends CommandFilter { 7 | 8 | /** 9 | * Runs this command. 10 | * 11 | * @param event The event containing the command 12 | * @param command The command being run 13 | */ 14 | void onCommand(TextMessageEvent event, Command command); 15 | 16 | @Override 17 | default boolean test(TextMessageEvent event, Command command) { 18 | try { 19 | onCommand(event, command); 20 | } catch (Exception ex) { 21 | ex.printStackTrace(); 22 | } 23 | return true; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/commands/filters/CommandFilter.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.commands.filters; 2 | 3 | import com.jtelegram.api.commands.Command; 4 | import com.jtelegram.api.events.message.TextMessageEvent; 5 | 6 | /** 7 | * Filters messages out according for if they match certain 8 | * test criteria, as defined by the implementing sub-class. 9 | */ 10 | public interface CommandFilter { 11 | 12 | /** 13 | * Checks to see if the given event and command test to be {@code true} 14 | * according to this filter. 15 | * 16 | * @param event The event to be tested 17 | * @param command The command data executed in this event 18 | * 19 | * @return True if and only if this filter allows this event and 20 | * command combination to go ahead. 21 | */ 22 | boolean test(TextMessageEvent event, Command command); 23 | 24 | } 25 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/commands/filters/MentionFilter.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.commands.filters; 2 | 3 | import com.jtelegram.api.chat.ChatType; 4 | import com.jtelegram.api.commands.Command; 5 | import com.jtelegram.api.events.message.TextMessageEvent; 6 | 7 | /** 8 | * A {@link CommandFilter} testing if the bot was mentioned in 9 | * the command. 10 | */ 11 | public class MentionFilter extends AbstractCommandFilter { 12 | 13 | /** 14 | * Creates a MentionFilter with given children. 15 | * 16 | * @param children The children filters, which will be checked in order 17 | * if this filter tests to be {@code true} 18 | */ 19 | public MentionFilter(CommandFilter... children) { 20 | super(children); 21 | } 22 | 23 | @Override 24 | protected boolean preTest(TextMessageEvent event, Command command) { 25 | return event.getMessage().getChat().getType() == ChatType.PRIVATE || command.isMentioned(); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/commands/filters/RegexFilter.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.commands.filters; 2 | 3 | import com.jtelegram.api.commands.Command; 4 | import com.jtelegram.api.events.message.TextMessageEvent; 5 | import java.util.regex.Pattern; 6 | 7 | /** 8 | * A {@link CommandFilter} testing if the command matches 9 | * a certain {@link Pattern regular expression pattern}. 10 | */ 11 | public class RegexFilter extends AbstractCommandFilter { 12 | 13 | private final Pattern pattern; 14 | 15 | /** 16 | * Creates a RegexFilter with given children. 17 | * 18 | * @param pattern The pattern to match against 19 | * @param children The children filters, which will be checked in order 20 | * if this filter tests to be {@code true} 21 | */ 22 | public RegexFilter(Pattern pattern, CommandFilter... children) { 23 | super(children); 24 | this.pattern = pattern; 25 | } 26 | 27 | @Override 28 | protected boolean preTest(TextMessageEvent event, Command command) { 29 | return pattern.matcher(command.getBaseCommand()).matches(); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/commands/filters/RootFilter.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.commands.filters; 2 | 3 | import com.jtelegram.api.commands.Command; 4 | import com.jtelegram.api.events.message.TextMessageEvent; 5 | 6 | /** 7 | * A {@link CommandFilter} that merely groups filters. 8 | */ 9 | public class RootFilter extends AbstractCommandFilter { 10 | 11 | private static CommandFilter[] combine(CommandFilter first, CommandFilter... remaining) { 12 | CommandFilter[] filters = new CommandFilter[remaining.length + 1]; 13 | filters[0] = first; 14 | System.arraycopy(remaining, 0, filters, 1, remaining.length); 15 | return filters; 16 | } 17 | 18 | /** 19 | * Creates a RootFilter with given children. 20 | * 21 | * @param filter The first filter 22 | * @param children The remaining children filters, which will be checked in order 23 | * if this filter tests to be {@code true} 24 | */ 25 | public RootFilter(CommandFilter filter, CommandFilter... children) { 26 | super(combine(filter, children)); 27 | } 28 | 29 | @Override 30 | protected boolean preTest(TextMessageEvent event, Command command) { 31 | return true; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/commands/filters/TextFilter.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.commands.filters; 2 | 3 | import com.jtelegram.api.commands.Command; 4 | import com.jtelegram.api.events.message.TextMessageEvent; 5 | 6 | /** 7 | * A {@link CommandFilter} testing if the command is a given 8 | * string, with optional case sensitivity. 9 | */ 10 | public class TextFilter extends AbstractCommandFilter { 11 | 12 | private final String command; 13 | private final boolean caseSensitive; 14 | 15 | /** 16 | * Creates a TextFilter with given children. 17 | * 18 | * @param command The command name to match 19 | * @param caseSensitive Whether to enforce case sensitivity or not 20 | * @param children The children filters, which will be checked in order 21 | * if this filter tests to be {@code true} 22 | */ 23 | public TextFilter(String command, boolean caseSensitive, CommandFilter... children) { 24 | super(children); 25 | this.command = command; 26 | this.caseSensitive = caseSensitive; 27 | } 28 | 29 | @Override 30 | protected boolean preTest(TextMessageEvent event, Command command) { 31 | return caseSensitive 32 | ? this.command.equals(command.getBaseCommand()) 33 | : this.command.equalsIgnoreCase(command.getBaseCommand()); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/events/Event.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.events; 2 | 3 | import com.jtelegram.api.TelegramBot; 4 | import lombok.AccessLevel; 5 | import lombok.AllArgsConstructor; 6 | import lombok.Getter; 7 | import lombok.ToString; 8 | 9 | @ToString 10 | @AllArgsConstructor(access = AccessLevel.PROTECTED) 11 | public abstract class Event { 12 | @Getter 13 | private final TelegramBot bot; 14 | 15 | public Class getType() { 16 | return getClass(); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/events/EventHandler.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.events; 2 | 3 | public interface EventHandler { 4 | void onEvent(E event); 5 | } 6 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/events/channel/ChannelPostEditEvent.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.events.channel; 2 | 3 | import com.jtelegram.api.TelegramBot; 4 | import com.jtelegram.api.events.Event; 5 | import com.jtelegram.api.message.Message; 6 | import lombok.Getter; 7 | import lombok.ToString; 8 | 9 | /** 10 | * When a channel post has been edited 11 | */ 12 | @Getter 13 | @ToString(callSuper = true) 14 | public class ChannelPostEditEvent extends Event { 15 | private Message post; 16 | 17 | public ChannelPostEditEvent(TelegramBot bot, Message post) { 18 | super(bot); 19 | this.post = post; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/events/channel/ChannelPostEvent.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.events.channel; 2 | 3 | import com.jtelegram.api.TelegramBot; 4 | import com.jtelegram.api.events.Event; 5 | import com.jtelegram.api.message.Message; 6 | import lombok.Getter; 7 | import lombok.ToString; 8 | 9 | /** 10 | * When a message to a channel has been posted 11 | */ 12 | @Getter 13 | @ToString(callSuper = true) 14 | public class ChannelPostEvent extends Event { 15 | private Message post; 16 | 17 | public ChannelPostEvent(TelegramBot bot, Message post) { 18 | super(bot); 19 | this.post = post; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/events/chat/ChatMemberJoinedEvent.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.events.chat; 2 | 3 | import com.jtelegram.api.TelegramBot; 4 | import com.jtelegram.api.events.message.ServiceMessageEvent; 5 | import com.jtelegram.api.message.impl.service.NewChatMembersMessage; 6 | import com.jtelegram.api.user.User; 7 | import lombok.Getter; 8 | 9 | import java.util.List; 10 | import lombok.ToString; 11 | 12 | @Getter 13 | @ToString(callSuper = true) 14 | public class ChatMemberJoinedEvent extends ServiceMessageEvent { 15 | private List newMembers; 16 | 17 | public ChatMemberJoinedEvent(TelegramBot bot, NewChatMembersMessage originMessage) { 18 | super(bot, originMessage); 19 | this.newMembers = originMessage.getNewChatMembers(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/events/chat/ChatMemberLeftEvent.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.events.chat; 2 | 3 | import com.jtelegram.api.TelegramBot; 4 | import com.jtelegram.api.events.message.ServiceMessageEvent; 5 | import com.jtelegram.api.user.User; 6 | import com.jtelegram.api.message.impl.service.LeftChatMemberMessage; 7 | import lombok.Getter; 8 | import lombok.ToString; 9 | 10 | @Getter 11 | @ToString(callSuper = true) 12 | public class ChatMemberLeftEvent extends ServiceMessageEvent { 13 | private User leftMember; 14 | 15 | public ChatMemberLeftEvent(TelegramBot bot, LeftChatMemberMessage originMessage) { 16 | super(bot, originMessage); 17 | this.leftMember = originMessage.getLeftChatMember(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/events/chat/ChatMigratedFromChatEvent.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.events.chat; 2 | 3 | import com.jtelegram.api.TelegramBot; 4 | import com.jtelegram.api.chat.Chat; 5 | import com.jtelegram.api.events.message.ServiceMessageEvent; 6 | import com.jtelegram.api.message.impl.service.MigrateFromChatIdMessage; 7 | import lombok.Getter; 8 | import lombok.ToString; 9 | 10 | @Getter 11 | @ToString(callSuper = true) 12 | public class ChatMigratedFromChatEvent extends ServiceMessageEvent { 13 | private Chat newChat; 14 | 15 | public ChatMigratedFromChatEvent(TelegramBot bot, MigrateFromChatIdMessage originMessage) { 16 | super(bot, originMessage); 17 | this.newChat = originMessage.getChat(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/events/chat/ChatMigratedToChatEvent.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.events.chat; 2 | 3 | import com.jtelegram.api.TelegramBot; 4 | import com.jtelegram.api.chat.Chat; 5 | import com.jtelegram.api.events.message.ServiceMessageEvent; 6 | import com.jtelegram.api.message.impl.service.MigrateToChatIdMessage; 7 | import lombok.Getter; 8 | import lombok.ToString; 9 | 10 | @Getter 11 | @ToString(callSuper = true) 12 | public class ChatMigratedToChatEvent extends ServiceMessageEvent { 13 | private Chat newChat; 14 | 15 | public ChatMigratedToChatEvent(TelegramBot bot, MigrateToChatIdMessage originMessage) { 16 | super(bot, originMessage); 17 | this.newChat = originMessage.getChat(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/events/chat/ChatPhotoDeletedEvent.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.events.chat; 2 | 3 | import com.jtelegram.api.TelegramBot; 4 | import com.jtelegram.api.events.message.ServiceMessageEvent; 5 | import com.jtelegram.api.message.impl.service.DeleteChatPhotoMessage; 6 | import lombok.ToString; 7 | 8 | @ToString(callSuper = true) 9 | public class ChatPhotoDeletedEvent extends ServiceMessageEvent { 10 | public ChatPhotoDeletedEvent(TelegramBot bot, DeleteChatPhotoMessage originMessage) { 11 | super(bot, originMessage); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/events/chat/GroupChatCreatedEvent.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.events.chat; 2 | 3 | import com.jtelegram.api.chat.Chat; 4 | import com.jtelegram.api.TelegramBot; 5 | import com.jtelegram.api.events.message.ServiceMessageEvent; 6 | import com.jtelegram.api.message.impl.service.GroupChatCreatedMessage; 7 | import lombok.Getter; 8 | import lombok.ToString; 9 | 10 | @Getter 11 | @ToString(callSuper = true) 12 | public class GroupChatCreatedEvent extends ServiceMessageEvent { 13 | private Chat newChat; 14 | 15 | public GroupChatCreatedEvent(TelegramBot bot, GroupChatCreatedMessage originMessage) { 16 | super(bot, originMessage); 17 | this.newChat = originMessage.getChat(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/events/chat/NewChatPhotoEvent.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.events.chat; 2 | 3 | import com.jtelegram.api.TelegramBot; 4 | import com.jtelegram.api.events.message.ServiceMessageEvent; 5 | import com.jtelegram.api.message.impl.service.NewChatPhotoMessage; 6 | import com.jtelegram.api.message.media.PhotoSize; 7 | import java.util.List; 8 | import lombok.Getter; 9 | import lombok.ToString; 10 | 11 | @Getter 12 | @ToString(callSuper = true) 13 | public class NewChatPhotoEvent extends ServiceMessageEvent { 14 | private List newChatPhoto; 15 | 16 | public NewChatPhotoEvent(TelegramBot bot, NewChatPhotoMessage originMessage) { 17 | super(bot, originMessage); 18 | this.newChatPhoto = originMessage.getNewChatPhoto(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/events/chat/NewChatTitleEvent.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.events.chat; 2 | 3 | import com.jtelegram.api.events.message.ServiceMessageEvent; 4 | import com.jtelegram.api.message.impl.service.NewChatTitleMessage; 5 | import com.jtelegram.api.TelegramBot; 6 | import lombok.Getter; 7 | import lombok.ToString; 8 | 9 | @Getter 10 | @ToString(callSuper = true) 11 | public class NewChatTitleEvent extends ServiceMessageEvent { 12 | private String newTitle; 13 | 14 | public NewChatTitleEvent(TelegramBot bot, NewChatTitleMessage originMessage) { 15 | super(bot, originMessage); 16 | this.newTitle = originMessage.getNewChatTitle(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/events/chat/PinnedMessageEvent.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.events.chat; 2 | 3 | import com.jtelegram.api.events.message.ServiceMessageEvent; 4 | import com.jtelegram.api.TelegramBot; 5 | import com.jtelegram.api.message.Message; 6 | import com.jtelegram.api.message.impl.service.PinnedMessageMessage; 7 | import lombok.Getter; 8 | import lombok.ToString; 9 | 10 | @Getter 11 | @ToString(callSuper = true) 12 | public class PinnedMessageEvent extends ServiceMessageEvent { 13 | private Message pinnedMessage; 14 | 15 | public PinnedMessageEvent(TelegramBot bot, PinnedMessageMessage originMessage) { 16 | super(bot, originMessage); 17 | this.pinnedMessage = originMessage.getPinnedMessage(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/events/chat/UserLoggedInEvent.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.events.chat; 2 | 3 | import com.jtelegram.api.TelegramBot; 4 | import com.jtelegram.api.events.message.ServiceMessageEvent; 5 | import com.jtelegram.api.message.impl.service.UserLoggedInMessage; 6 | import lombok.ToString; 7 | 8 | /** 9 | * When the user logs in from a website 10 | * (and most of the time, a new chat is instantiated) 11 | * 12 | * At this point, it is guaranteed that the bot can 13 | * send messages to the user. 14 | */ 15 | @ToString(callSuper = true) 16 | public class UserLoggedInEvent extends ServiceMessageEvent { 17 | public UserLoggedInEvent(TelegramBot bot, UserLoggedInMessage originMessage) { 18 | super(bot, originMessage); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/events/inline/ChosenInlineResultEvent.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.events.inline; 2 | 3 | import com.jtelegram.api.TelegramBot; 4 | import com.jtelegram.api.events.Event; 5 | import com.jtelegram.api.inline.result.ChosenInlineResult; 6 | import lombok.Getter; 7 | import lombok.ToString; 8 | 9 | /** 10 | * When a user has selected their inline result 11 | */ 12 | @Getter 13 | @ToString(callSuper = true) 14 | public class ChosenInlineResultEvent extends Event { 15 | private ChosenInlineResult chosenResult; 16 | 17 | public ChosenInlineResultEvent(TelegramBot bot, ChosenInlineResult chosenResult) { 18 | super(bot); 19 | this.chosenResult = chosenResult; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/events/inline/InlineQueryEvent.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.events.inline; 2 | 3 | import com.jtelegram.api.TelegramBot; 4 | import com.jtelegram.api.events.Event; 5 | import com.jtelegram.api.inline.InlineQuery; 6 | import lombok.Getter; 7 | import lombok.ToString; 8 | 9 | /** 10 | * When an inline query is sent to the bot 11 | */ 12 | @Getter 13 | @ToString(callSuper = true) 14 | public class InlineQueryEvent extends Event { 15 | private InlineQuery query; 16 | 17 | public InlineQueryEvent(TelegramBot bot, InlineQuery query) { 18 | super(bot); 19 | this.query = query; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/events/inline/keyboard/CallbackQueryEvent.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.events.inline.keyboard; 2 | 3 | import com.jtelegram.api.TelegramBot; 4 | import com.jtelegram.api.events.Event; 5 | import com.jtelegram.api.inline.CallbackQuery; 6 | import lombok.Getter; 7 | import lombok.ToString; 8 | 9 | @Getter 10 | @ToString(callSuper = true) 11 | public class CallbackQueryEvent extends Event { 12 | private CallbackQuery query; 13 | 14 | public CallbackQueryEvent(TelegramBot bot, CallbackQuery query) { 15 | super(bot); 16 | this.query = query; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/events/location/LocationUpdateEvent.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.events.location; 2 | 3 | import com.jtelegram.api.message.impl.LocationMessage; 4 | import com.jtelegram.api.TelegramBot; 5 | import com.jtelegram.api.events.Event; 6 | import com.jtelegram.api.message.media.Location; 7 | import lombok.Getter; 8 | import lombok.ToString; 9 | 10 | @Getter 11 | @ToString(callSuper = true) 12 | public class LocationUpdateEvent extends Event { 13 | private Location location; 14 | private LocationMessage message; 15 | 16 | public LocationUpdateEvent(TelegramBot bot, LocationMessage message) { 17 | super(bot); 18 | this.location = message.getLocation(); 19 | this.message = message; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/events/message/AnimationMessageEvent.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.events.message; 2 | 3 | import com.jtelegram.api.TelegramBot; 4 | import com.jtelegram.api.message.impl.AnimationMessage; 5 | 6 | public class AnimationMessageEvent extends MessageEvent { 7 | public AnimationMessageEvent(TelegramBot bot, AnimationMessage message) { 8 | super(bot, message); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/events/message/AudioMessageEvent.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.events.message; 2 | 3 | import com.jtelegram.api.TelegramBot; 4 | import com.jtelegram.api.message.impl.AudioMessage; 5 | import lombok.ToString; 6 | 7 | @ToString(callSuper = true) 8 | public class AudioMessageEvent extends MessageEvent { 9 | public AudioMessageEvent(TelegramBot bot, AudioMessage message) { 10 | super(bot, message); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/events/message/ContactMessageEvent.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.events.message; 2 | 3 | import com.jtelegram.api.TelegramBot; 4 | import com.jtelegram.api.message.impl.ContactMessage; 5 | import lombok.ToString; 6 | 7 | @ToString(callSuper = true) 8 | public class ContactMessageEvent extends MessageEvent { 9 | public ContactMessageEvent(TelegramBot bot, ContactMessage message) { 10 | super(bot, message); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/events/message/DocumentMessageEvent.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.events.message; 2 | 3 | import com.jtelegram.api.TelegramBot; 4 | import com.jtelegram.api.message.impl.DocumentMessage; 5 | import lombok.ToString; 6 | 7 | @ToString(callSuper = true) 8 | public class DocumentMessageEvent extends MessageEvent { 9 | public DocumentMessageEvent(TelegramBot bot, DocumentMessage message) { 10 | super(bot, message); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/events/message/GameMessageEvent.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.events.message; 2 | 3 | import com.jtelegram.api.TelegramBot; 4 | import com.jtelegram.api.message.impl.GameMessage; 5 | import lombok.ToString; 6 | 7 | @ToString(callSuper = true) 8 | public class GameMessageEvent extends MessageEvent { 9 | public GameMessageEvent(TelegramBot bot, GameMessage message) { 10 | super(bot, message); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/events/message/InvoiceMessageEvent.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.events.message; 2 | 3 | import com.jtelegram.api.TelegramBot; 4 | import com.jtelegram.api.message.impl.InvoiceMessage; 5 | 6 | public class InvoiceMessageEvent extends MessageEvent { 7 | public InvoiceMessageEvent(TelegramBot bot, InvoiceMessage message) { 8 | super(bot, message); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/events/message/LocationMessageEvent.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.events.message; 2 | 3 | import com.jtelegram.api.message.impl.LocationMessage; 4 | import com.jtelegram.api.TelegramBot; 5 | import lombok.ToString; 6 | 7 | @ToString(callSuper = true) 8 | public class LocationMessageEvent extends MessageEvent { 9 | public LocationMessageEvent(TelegramBot bot, LocationMessage message) { 10 | super(bot, message); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/events/message/MessageEvent.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.events.message; 2 | 3 | import com.jtelegram.api.TelegramBot; 4 | import com.jtelegram.api.events.Event; 5 | import com.jtelegram.api.message.Message; 6 | import lombok.Getter; 7 | import lombok.ToString; 8 | 9 | @ToString(callSuper = true) 10 | public class MessageEvent extends Event { 11 | @Getter 12 | private T message; 13 | 14 | public MessageEvent(TelegramBot bot, T message) { 15 | super(bot); 16 | this.message = message; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/events/message/PhotoMessageEvent.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.events.message; 2 | 3 | import com.jtelegram.api.TelegramBot; 4 | import com.jtelegram.api.message.impl.PhotoMessage; 5 | import lombok.ToString; 6 | 7 | @ToString(callSuper = true) 8 | public class PhotoMessageEvent extends MessageEvent { 9 | public PhotoMessageEvent(TelegramBot bot, PhotoMessage message) { 10 | super(bot, message); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/events/message/ServiceMessageEvent.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.events.message; 2 | 3 | import com.jtelegram.api.message.impl.service.ServiceMessage; 4 | import com.jtelegram.api.TelegramBot; 5 | import lombok.ToString; 6 | 7 | @ToString(callSuper = true) 8 | public abstract class ServiceMessageEvent extends MessageEvent { 9 | protected ServiceMessageEvent(TelegramBot bot, T originMessage) { 10 | super(bot, originMessage); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/events/message/StickerMessageEvent.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.events.message; 2 | 3 | import com.jtelegram.api.TelegramBot; 4 | import com.jtelegram.api.message.impl.StickerMessage; 5 | import lombok.ToString; 6 | 7 | @ToString(callSuper = true) 8 | public class StickerMessageEvent extends MessageEvent { 9 | public StickerMessageEvent(TelegramBot bot, StickerMessage message) { 10 | super(bot, message); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/events/message/TextMessageEvent.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.events.message; 2 | 3 | import com.jtelegram.api.message.impl.TextMessage; 4 | import com.jtelegram.api.TelegramBot; 5 | import lombok.ToString; 6 | 7 | @ToString(callSuper = true) 8 | public class TextMessageEvent extends MessageEvent { 9 | public TextMessageEvent(TelegramBot bot, TextMessage message) { 10 | super(bot, message); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/events/message/VenueMessageEvent.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.events.message; 2 | 3 | import com.jtelegram.api.TelegramBot; 4 | import com.jtelegram.api.message.impl.VenueMessage; 5 | import lombok.ToString; 6 | 7 | @ToString(callSuper = true) 8 | public class VenueMessageEvent extends MessageEvent { 9 | public VenueMessageEvent(TelegramBot bot, VenueMessage message) { 10 | super(bot, message); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/events/message/VideoMessageEvent.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.events.message; 2 | 3 | import com.jtelegram.api.message.impl.VideoMessage; 4 | import com.jtelegram.api.TelegramBot; 5 | import lombok.ToString; 6 | 7 | @ToString(callSuper = true) 8 | public class VideoMessageEvent extends MessageEvent { 9 | public VideoMessageEvent(TelegramBot bot, VideoMessage message) { 10 | super(bot, message); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/events/message/VideoNoteMessageEvent.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.events.message; 2 | 3 | import com.jtelegram.api.TelegramBot; 4 | import com.jtelegram.api.message.impl.VideoNoteMessage; 5 | import lombok.ToString; 6 | 7 | @ToString(callSuper = true) 8 | public class VideoNoteMessageEvent extends MessageEvent { 9 | public VideoNoteMessageEvent(TelegramBot bot, VideoNoteMessage message) { 10 | super(bot, message); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/events/message/VoiceMessageEvent.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.events.message; 2 | 3 | import com.jtelegram.api.TelegramBot; 4 | import com.jtelegram.api.message.impl.VoiceMessage; 5 | import lombok.ToString; 6 | 7 | @ToString(callSuper = true) 8 | public class VoiceMessageEvent extends MessageEvent { 9 | public VoiceMessageEvent(TelegramBot bot, VoiceMessage message) { 10 | super(bot, message); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/events/message/edit/CaptionEditEvent.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.events.message.edit; 2 | 3 | import com.jtelegram.api.TelegramBot; 4 | import com.jtelegram.api.events.Event; 5 | import com.jtelegram.api.message.CaptionableMessage; 6 | import lombok.Getter; 7 | import lombok.ToString; 8 | 9 | @ToString(callSuper = true) 10 | public class CaptionEditEvent extends Event { 11 | @Getter 12 | private CaptionableMessage message; 13 | 14 | public CaptionEditEvent(TelegramBot bot, CaptionableMessage message) { 15 | super(bot); 16 | this.message = message; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/events/message/edit/TextMessageEditEvent.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.events.message.edit; 2 | 3 | import com.jtelegram.api.message.impl.TextMessage; 4 | import com.jtelegram.api.TelegramBot; 5 | import com.jtelegram.api.events.Event; 6 | import lombok.Getter; 7 | import lombok.ToString; 8 | 9 | @ToString(callSuper = true) 10 | public class TextMessageEditEvent extends Event { 11 | @Getter 12 | private TextMessage newMessage; 13 | 14 | public TextMessageEditEvent(TelegramBot bot, TextMessage newMessage) { 15 | super(bot); 16 | this.newMessage = newMessage; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/events/payment/PreCheckoutQueryEvent.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.events.payment; 2 | 3 | import com.jtelegram.api.TelegramBot; 4 | import com.jtelegram.api.events.Event; 5 | import com.jtelegram.api.message.payments.PreCheckoutQuery; 6 | import lombok.Getter; 7 | import lombok.ToString; 8 | 9 | @Getter 10 | @ToString(callSuper = true) 11 | public class PreCheckoutQueryEvent extends Event { 12 | private PreCheckoutQuery checkoutQuery; 13 | 14 | public PreCheckoutQueryEvent(TelegramBot bot, PreCheckoutQuery checkoutQuery) { 15 | super(bot); 16 | this.checkoutQuery = checkoutQuery; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/events/payment/ShippingQueryEvent.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.events.payment; 2 | 3 | import com.jtelegram.api.TelegramBot; 4 | import com.jtelegram.api.events.Event; 5 | import com.jtelegram.api.message.payments.ShippingQuery; 6 | import lombok.ToString; 7 | 8 | /** 9 | * When a new shipping query is received 10 | */ 11 | @ToString(callSuper = true) 12 | public class ShippingQueryEvent extends Event { 13 | private ShippingQuery shippingQuery; 14 | 15 | public ShippingQueryEvent(TelegramBot bot, ShippingQuery shippingQuery) { 16 | super(bot); 17 | this.shippingQuery = shippingQuery; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/events/payment/SuccessfulPaymentEvent.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.events.payment; 2 | 3 | import com.jtelegram.api.events.message.MessageEvent; 4 | import com.jtelegram.api.message.impl.SuccessfulPaymentMessage; 5 | import com.jtelegram.api.message.payments.SuccessfulPayment; 6 | import com.jtelegram.api.TelegramBot; 7 | import lombok.Getter; 8 | import lombok.ToString; 9 | 10 | @Getter 11 | @ToString(callSuper = true) 12 | public class SuccessfulPaymentEvent extends MessageEvent { 13 | private SuccessfulPayment payment; 14 | 15 | public SuccessfulPaymentEvent(TelegramBot bot, SuccessfulPaymentMessage message) { 16 | super(bot, message); 17 | this.payment = message.getSuccessfulPayment(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/ex/EventException.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.ex; 2 | 3 | import lombok.ToString; 4 | 5 | @ToString(callSuper = true) 6 | public class EventException extends MessageBasedException { 7 | public EventException(String message) { 8 | super(message); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/ex/InvalidResponseException.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.ex; 2 | 3 | import lombok.Getter; 4 | import lombok.ToString; 5 | 6 | /** 7 | * This exception is called when the API returns 8 | * a non-JSON response 9 | */ 10 | @ToString(callSuper = true) 11 | @Getter 12 | public class InvalidResponseException extends MessageBasedException { 13 | /** 14 | * A description of the error which could contain 15 | * sensitive information (e.g. message contents) 16 | * 17 | * Separate from getMessage() in order to avoid 18 | * unnecessary logging of sensitive data 19 | */ 20 | private String sensitiveMessage; 21 | 22 | public InvalidResponseException(String message, String sensitiveAddition) { 23 | super(message); 24 | this.sensitiveMessage = message + " SENSITIVE: " + sensitiveAddition; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/ex/MessageBasedException.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.ex; 2 | 3 | public abstract class MessageBasedException extends TelegramException { 4 | public MessageBasedException(String message) { 5 | super(message); 6 | } 7 | 8 | @Override 9 | public String getDescription() { 10 | return getMessage(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/ex/NetworkException.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.ex; 2 | 3 | import lombok.Getter; 4 | import lombok.ToString; 5 | 6 | import java.io.IOException; 7 | 8 | @Getter 9 | @ToString(callSuper = true) 10 | public class NetworkException extends MessageBasedException { 11 | private final IOException underlyingException; 12 | 13 | public NetworkException(IOException underlyingException) { 14 | super(underlyingException.getMessage()); 15 | this.underlyingException = underlyingException; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/ex/TelegramApiException.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.ex; 2 | 3 | import com.jtelegram.api.requests.framework.ResponseParameters; 4 | import lombok.Getter; 5 | import lombok.ToString; 6 | 7 | @Getter 8 | @ToString 9 | public class TelegramApiException extends TelegramException { 10 | private int errorCode; 11 | private String description; 12 | private ResponseParameters parameters; 13 | 14 | @Override 15 | public String getMessage() { 16 | return description; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/ex/TelegramException.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.ex; 2 | 3 | import lombok.Getter; 4 | import lombok.ToString; 5 | 6 | @Getter 7 | @ToString 8 | public abstract class TelegramException extends RuntimeException { 9 | public TelegramException() { 10 | } 11 | 12 | public TelegramException(String message) { 13 | super(message); 14 | } 15 | 16 | public abstract String getDescription(); 17 | } 18 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/ex/handler/ErrorLogger.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.ex.handler; 2 | 3 | import com.jtelegram.api.ex.InvalidResponseException; 4 | import com.jtelegram.api.ex.TelegramException; 5 | import lombok.AllArgsConstructor; 6 | import lombok.Builder; 7 | import lombok.NoArgsConstructor; 8 | 9 | import java.util.function.Consumer; 10 | import java.util.logging.Logger; 11 | 12 | /** 13 | * Logs exceptions with no further action. 14 | * 15 | * When sensitive is true, sensitive information 16 | * related to the exception will be printed. 17 | * 18 | * The sensitive flag is useful for debugging, but 19 | * should be set to false in production. 20 | */ 21 | @AllArgsConstructor 22 | @NoArgsConstructor 23 | @Builder 24 | public class ErrorLogger implements Consumer { 25 | @Builder.Default 26 | private String identifier = "Generic"; 27 | @Builder.Default 28 | private Logger logger = Logger.getGlobal(); 29 | @Builder.Default 30 | private boolean sensitive = false; 31 | 32 | @Override 33 | public void accept(TelegramException e) { 34 | logger.severe(identifier + ": An error occurred during a Telegram API call, printing stacktrace..."); 35 | 36 | if (sensitive) { 37 | if (e instanceof InvalidResponseException) { 38 | logger.severe("Full Message: " + ((InvalidResponseException) e).getSensitiveMessage()); 39 | } 40 | } 41 | 42 | e.printStackTrace(); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/inline/CallbackQuery.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.inline; 2 | 3 | import com.jtelegram.api.user.User; 4 | import com.jtelegram.api.message.Message; 5 | import lombok.AccessLevel; 6 | import lombok.EqualsAndHashCode; 7 | import lombok.Getter; 8 | import lombok.NoArgsConstructor; 9 | import lombok.ToString; 10 | 11 | @Getter 12 | @ToString 13 | @EqualsAndHashCode(of = "id") 14 | @NoArgsConstructor(access = AccessLevel.PROTECTED) 15 | public class CallbackQuery { 16 | private String id; 17 | private User from; 18 | private Message message; 19 | private String inlineMessageId; 20 | private String chatInstance; 21 | private String data; 22 | private String gameShortName; 23 | } 24 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/inline/InlineQuery.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.inline; 2 | 3 | import com.jtelegram.api.user.User; 4 | import com.jtelegram.api.message.media.Location; 5 | import lombok.*; 6 | 7 | @Getter 8 | @ToString 9 | @EqualsAndHashCode(of = "id") 10 | @NoArgsConstructor(access = AccessLevel.PROTECTED) 11 | public class InlineQuery { 12 | private String id; 13 | private User from; 14 | private Location location; 15 | private String query; 16 | private String offset; 17 | } 18 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/inline/input/InputContactMessageContent.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.inline.input; 2 | 3 | import lombok.Builder; 4 | import lombok.Getter; 5 | import lombok.ToString; 6 | 7 | @Getter 8 | @Builder 9 | @ToString 10 | public class InputContactMessageContent extends InputMessageContent { 11 | private String phoneNumber; 12 | private String firstName; 13 | private String lastName; 14 | private String vcard; 15 | } 16 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/inline/input/InputLocationMessageContent.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.inline.input; 2 | 3 | import lombok.Builder; 4 | import lombok.Getter; 5 | import lombok.ToString; 6 | 7 | @Getter 8 | @Builder 9 | @ToString 10 | public class InputLocationMessageContent extends InputMessageContent { 11 | private Float latitude; 12 | private Float longitude; 13 | private Integer livePeriod; 14 | } 15 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/inline/input/InputMessageContent.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.inline.input; 2 | 3 | public abstract class InputMessageContent { 4 | } 5 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/inline/input/InputTextMessageContent.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.inline.input; 2 | 3 | import com.jtelegram.api.requests.message.framework.ParseMode; 4 | import com.jtelegram.api.util.TextBuilder; 5 | import lombok.Builder; 6 | import lombok.Getter; 7 | import lombok.ToString; 8 | 9 | @Getter 10 | @ToString 11 | @Builder 12 | public class InputTextMessageContent extends InputMessageContent { 13 | private String messageText; 14 | private ParseMode parseMode; 15 | private Boolean disableWebPagePreview; 16 | 17 | public static class InputTextMessageContentBuilder { 18 | public InputTextMessageContentBuilder messageText(TextBuilder builder) { 19 | this.parseMode = ParseMode.HTML; 20 | this.messageText = builder.toHtml(); 21 | return this; 22 | } 23 | 24 | public InputTextMessageContentBuilder messageText(String str) { 25 | this.messageText = str; 26 | return this; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/inline/input/InputVenueMessageContent.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.inline.input; 2 | 3 | import lombok.Builder; 4 | import lombok.Getter; 5 | import lombok.ToString; 6 | 7 | @Getter 8 | @Builder 9 | @ToString 10 | public class InputVenueMessageContent extends InputMessageContent { 11 | private Float latitude; 12 | private Float longtitude; 13 | private String title; 14 | private String address; 15 | private String foursquareId; 16 | private String foursquareType; 17 | } 18 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/inline/keyboard/InlineKeyboardButton.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.inline.keyboard; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | import com.jtelegram.api.message.games.CallbackGame; 5 | import lombok.*; 6 | 7 | @Getter 8 | @ToString 9 | @Builder 10 | public class InlineKeyboardButton { 11 | @SerializedName("text") 12 | private String label; 13 | private String url; 14 | private String callbackData; 15 | private String switchInlineQuery; 16 | private String switchInlineQueryCurrentChat; 17 | private CallbackGame callbackGame; 18 | private Boolean pay; 19 | } 20 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/inline/keyboard/InlineKeyboardMarkup.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.inline.keyboard; 2 | 3 | import com.jtelegram.api.requests.message.framework.ReplyMarkup; 4 | import lombok.Builder; 5 | import lombok.Getter; 6 | import lombok.Singular; 7 | 8 | import java.util.List; 9 | import lombok.ToString; 10 | 11 | @Getter 12 | @Builder 13 | @ToString 14 | public class InlineKeyboardMarkup implements ReplyMarkup { 15 | @Singular("keyboard") 16 | private List inlineKeyboard; 17 | } 18 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/inline/keyboard/InlineKeyboardRow.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.inline.keyboard; 2 | 3 | import com.google.gson.JsonArray; 4 | import com.google.gson.JsonElement; 5 | import com.google.gson.JsonSerializationContext; 6 | import com.google.gson.JsonSerializer; 7 | import lombok.Builder; 8 | import lombok.Getter; 9 | import lombok.Singular; 10 | 11 | import java.lang.reflect.Type; 12 | import java.util.List; 13 | import lombok.ToString; 14 | 15 | @Getter 16 | @Builder 17 | @ToString 18 | public class InlineKeyboardRow { 19 | @Singular 20 | private List buttons; 21 | 22 | public static class Serializer implements JsonSerializer { 23 | @Override 24 | public JsonElement serialize(InlineKeyboardRow row, Type type, JsonSerializationContext context) { 25 | JsonArray array = new JsonArray(); 26 | row.buttons.forEach((e) -> array.add(context.serialize(e))); 27 | return array; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/inline/result/ChosenInlineResult.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.inline.result; 2 | 3 | import com.jtelegram.api.message.media.Location; 4 | import com.jtelegram.api.user.User; 5 | import lombok.*; 6 | 7 | @Getter 8 | @ToString 9 | @EqualsAndHashCode(of = "resultId") 10 | @NoArgsConstructor(access = AccessLevel.PROTECTED) 11 | public class ChosenInlineResult { 12 | private String resultId; 13 | private User from; 14 | private String query; 15 | private Location location; 16 | private String inlineMessageId; 17 | } 18 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/inline/result/InlineResultArticle.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.inline.result; 2 | 3 | import com.jtelegram.api.inline.result.framework.DimensionalThumbableInlineResult; 4 | import com.jtelegram.api.inline.result.framework.InlineResult; 5 | import com.jtelegram.api.inline.input.InputMessageContent; 6 | import com.jtelegram.api.inline.keyboard.InlineKeyboardMarkup; 7 | import lombok.Builder; 8 | import lombok.Getter; 9 | import lombok.ToString; 10 | 11 | @Getter 12 | @ToString(callSuper = true) 13 | public class InlineResultArticle extends DimensionalThumbableInlineResult implements InlineResult.Titled, InlineResult.Urlable, InlineResult.Describeable { 14 | private String title; 15 | private String url; 16 | private Boolean hideUrl; 17 | private String description; 18 | 19 | @Builder 20 | private InlineResultArticle(String id, InlineKeyboardMarkup replyMarkup, InputMessageContent inputMessageContent, String thumbUrl, Integer thumbWidth, Integer thumbHeight, String title, String url, Boolean hideUrl, String description) { 21 | super(id, replyMarkup, inputMessageContent, thumbUrl, thumbWidth, thumbHeight); 22 | this.title = title; 23 | this.url = url; 24 | this.hideUrl = hideUrl; 25 | this.description = description; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/inline/result/InlineResultContact.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.inline.result; 2 | 3 | import com.jtelegram.api.inline.input.InputMessageContent; 4 | import com.jtelegram.api.inline.keyboard.InlineKeyboardMarkup; 5 | import com.jtelegram.api.inline.result.framework.DimensionalThumbableInlineResult; 6 | import lombok.Builder; 7 | import lombok.Getter; 8 | import lombok.ToString; 9 | 10 | @Getter 11 | @ToString(callSuper = true) 12 | public class InlineResultContact extends DimensionalThumbableInlineResult { 13 | private String phoneNumber; 14 | private String firstName; 15 | private String lastName; 16 | private String vcard; 17 | 18 | @Builder 19 | private InlineResultContact(String id, InlineKeyboardMarkup replyMarkup, InputMessageContent inputMessageContent, 20 | String thumbUrl, Integer thumbWidth, Integer thumbHeight, String phoneNumber, String firstName, 21 | String lastName, String vcard) { 22 | super(id, replyMarkup, inputMessageContent, thumbUrl, thumbWidth, thumbHeight); 23 | this.phoneNumber = phoneNumber; 24 | this.firstName = firstName; 25 | this.lastName = lastName; 26 | this.vcard = vcard; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/inline/result/InlineResultGame.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.inline.result; 2 | 3 | import com.jtelegram.api.inline.keyboard.InlineKeyboardMarkup; 4 | import com.jtelegram.api.inline.result.framework.InlineResult; 5 | import com.jtelegram.api.inline.input.InputMessageContent; 6 | import lombok.Getter; 7 | import lombok.ToString; 8 | 9 | @Getter 10 | @ToString(callSuper = true) 11 | // this class is the only one which doesn't 12 | // allow for input message content, so it's 13 | // handled like the outlier that it is. 14 | public class InlineResultGame extends InlineResult { 15 | private String gameShortName; 16 | 17 | public InlineResultGame(String id, InlineKeyboardMarkup replyMarkup, String gameShortName) { 18 | super(id, replyMarkup, null); 19 | this.gameShortName = gameShortName; 20 | } 21 | 22 | @Override 23 | public InputMessageContent getInputMessageContent() { 24 | throw new UnsupportedOperationException(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/inline/result/InlineResultLocation.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.inline.result; 2 | 3 | import com.jtelegram.api.inline.keyboard.InlineKeyboardMarkup; 4 | import com.jtelegram.api.inline.result.framework.DimensionalThumbableInlineResult; 5 | import com.jtelegram.api.inline.result.framework.InlineResult; 6 | import com.jtelegram.api.inline.input.InputMessageContent; 7 | import lombok.Builder; 8 | import lombok.Getter; 9 | import lombok.ToString; 10 | 11 | @Getter 12 | @ToString(callSuper = true) 13 | public class InlineResultLocation extends DimensionalThumbableInlineResult implements InlineResult.Titled { 14 | private String title; 15 | private Integer livePeriod; 16 | private Float latitude; 17 | private Float longitude; 18 | 19 | @Builder 20 | private InlineResultLocation(String id, InlineKeyboardMarkup replyMarkup, InputMessageContent inputMessageContent, String thumbUrl, Integer thumbWidth, 21 | Integer thumbHeight, String title, Integer livePeriod, Float latitude, Float longitude) { 22 | super(id, replyMarkup, inputMessageContent, thumbUrl, thumbWidth, thumbHeight); 23 | this.title = title; 24 | this.livePeriod = livePeriod; 25 | this.latitude = latitude; 26 | this.longitude = longitude; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/inline/result/InlineResultVoice.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.inline.result; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | import com.jtelegram.api.inline.result.framework.InlineResult; 5 | import com.jtelegram.api.inline.input.InputMessageContent; 6 | import com.jtelegram.api.inline.keyboard.InlineKeyboardMarkup; 7 | import com.jtelegram.api.requests.message.framework.ParseMode; 8 | import lombok.Builder; 9 | import lombok.Getter; 10 | import lombok.ToString; 11 | 12 | @Getter 13 | @ToString(callSuper = true) 14 | public class InlineResultVoice extends InlineResult implements InlineResult.Urlable, InlineResult.Captioned, 15 | InlineResult.Titled, InlineResult.Duratable { 16 | private String title; 17 | private String caption; 18 | private ParseMode captionParseMode; 19 | @SerializedName("voice_duration") 20 | private Integer duration; 21 | @SerializedName("voice_url") 22 | private String url; 23 | 24 | @Builder 25 | private InlineResultVoice(String id, InlineKeyboardMarkup replyMarkup, InputMessageContent inputMessageContent, 26 | String title, String caption, ParseMode captionParseMode, Integer duration, String url) { 27 | super(id, replyMarkup, inputMessageContent); 28 | this.title = title; 29 | this.caption = caption; 30 | this.captionParseMode = captionParseMode; 31 | this.duration = duration; 32 | this.url = url; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/inline/result/cached/InlineCachedResultAudio.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.inline.result.cached; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | import com.jtelegram.api.inline.keyboard.InlineKeyboardMarkup; 5 | import com.jtelegram.api.inline.result.framework.InlineResult; 6 | import com.jtelegram.api.message.input.file.IdInputFile; 7 | import com.jtelegram.api.inline.input.InputMessageContent; 8 | import com.jtelegram.api.requests.message.framework.ParseMode; 9 | import lombok.Builder; 10 | import lombok.Getter; 11 | import lombok.ToString; 12 | 13 | @Getter 14 | @ToString(callSuper = true) 15 | public class InlineCachedResultAudio extends InlineResult implements InlineResult.Cached, InlineResult.Captioned { 16 | @SerializedName("audio_file_id") 17 | private IdInputFile fileId; 18 | private String caption; 19 | private ParseMode captionParseMode; 20 | 21 | @Builder 22 | private InlineCachedResultAudio(String id, InlineKeyboardMarkup replyMarkup, InputMessageContent inputMessageContent, 23 | IdInputFile fileId, String caption, ParseMode captionParseMode) { 24 | super(id, replyMarkup, inputMessageContent); 25 | this.fileId = fileId; 26 | this.caption = caption; 27 | this.captionParseMode = captionParseMode; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/inline/result/cached/InlineCachedResultDocument.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.inline.result.cached; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | import com.jtelegram.api.inline.keyboard.InlineKeyboardMarkup; 5 | import com.jtelegram.api.inline.result.framework.InlineResult; 6 | import com.jtelegram.api.message.input.file.IdInputFile; 7 | import com.jtelegram.api.inline.input.InputMessageContent; 8 | import com.jtelegram.api.requests.message.framework.ParseMode; 9 | import lombok.Builder; 10 | import lombok.Getter; 11 | import lombok.ToString; 12 | 13 | @Getter 14 | @ToString(callSuper = true) 15 | public class InlineCachedResultDocument extends InlineResult implements InlineResult.Cached, 16 | InlineResult.Titled, InlineResult.Captioned { 17 | @SerializedName("document_file_id") 18 | private IdInputFile fileId; 19 | private String title; 20 | private String caption; 21 | private ParseMode captionParseMode; 22 | 23 | @Builder 24 | private InlineCachedResultDocument(String id, InlineKeyboardMarkup replyMarkup, InputMessageContent inputMessageContent, 25 | IdInputFile fileId, String title, String caption, ParseMode captionParseMode) { 26 | super(id, replyMarkup, inputMessageContent); 27 | this.fileId = fileId; 28 | this.title = title; 29 | this.caption = caption; 30 | this.captionParseMode = captionParseMode; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/inline/result/cached/InlineCachedResultGif.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.inline.result.cached; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | import com.jtelegram.api.inline.keyboard.InlineKeyboardMarkup; 5 | import com.jtelegram.api.inline.result.framework.InlineResult; 6 | import com.jtelegram.api.message.input.file.IdInputFile; 7 | import com.jtelegram.api.inline.input.InputMessageContent; 8 | import com.jtelegram.api.requests.message.framework.ParseMode; 9 | import lombok.Builder; 10 | import lombok.Getter; 11 | import lombok.ToString; 12 | 13 | @Getter 14 | @ToString(callSuper = true) 15 | public class InlineCachedResultGif extends InlineResult implements InlineResult.Cached, 16 | InlineResult.Titled, InlineResult.Captioned { 17 | @SerializedName("gif_file_id") 18 | private IdInputFile fileId; 19 | private String title; 20 | private String caption; 21 | private ParseMode captionParseMode; 22 | 23 | @Builder 24 | private InlineCachedResultGif(String id, InlineKeyboardMarkup replyMarkup, InputMessageContent inputMessageContent, 25 | IdInputFile fileId, String title, String caption, ParseMode captionParseMode) { 26 | super(id, replyMarkup, inputMessageContent); 27 | this.fileId = fileId; 28 | this.title = title; 29 | this.caption = caption; 30 | this.captionParseMode = captionParseMode; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/inline/result/cached/InlineCachedResultMpegGif.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.inline.result.cached; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | import com.jtelegram.api.inline.input.InputMessageContent; 5 | import com.jtelegram.api.inline.keyboard.InlineKeyboardMarkup; 6 | import com.jtelegram.api.inline.result.framework.InlineResult; 7 | import com.jtelegram.api.message.input.file.IdInputFile; 8 | import com.jtelegram.api.requests.message.framework.ParseMode; 9 | import lombok.Builder; 10 | import lombok.Getter; 11 | import lombok.ToString; 12 | 13 | @Getter 14 | @ToString(callSuper = true) 15 | public class InlineCachedResultMpegGif extends InlineResult implements InlineResult.Cached, 16 | InlineResult.Titled, InlineResult.Captioned { 17 | @SerializedName("mpeg4_file_id") 18 | private IdInputFile fileId; 19 | private String title; 20 | private String caption; 21 | private ParseMode captionParseMode; 22 | 23 | @Builder 24 | private InlineCachedResultMpegGif(String id, InlineKeyboardMarkup replyMarkup, InputMessageContent inputMessageContent, 25 | IdInputFile fileId, String title, String caption, ParseMode captionParseMode) { 26 | super(id, replyMarkup, inputMessageContent); 27 | this.fileId = fileId; 28 | this.title = title; 29 | this.caption = caption; 30 | this.captionParseMode = captionParseMode; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/inline/result/cached/InlineCachedResultSticker.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.inline.result.cached; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | import com.jtelegram.api.inline.keyboard.InlineKeyboardMarkup; 5 | import com.jtelegram.api.inline.result.framework.InlineResult; 6 | import com.jtelegram.api.message.input.file.IdInputFile; 7 | import com.jtelegram.api.inline.input.InputMessageContent; 8 | import lombok.Builder; 9 | import lombok.Getter; 10 | import lombok.ToString; 11 | 12 | @Getter 13 | @ToString(callSuper = true) 14 | public class InlineCachedResultSticker extends InlineResult implements InlineResult.Cached { 15 | @SerializedName("sticker_file_id") 16 | private IdInputFile fileId; 17 | 18 | @Builder 19 | private InlineCachedResultSticker(String id, InlineKeyboardMarkup replyMarkup, InputMessageContent inputMessageContent, IdInputFile fileId) { 20 | super(id, replyMarkup, inputMessageContent); 21 | this.fileId = fileId; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/inline/result/cached/InlineCachedResultVideo.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.inline.result.cached; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | import com.jtelegram.api.inline.keyboard.InlineKeyboardMarkup; 5 | import com.jtelegram.api.inline.result.framework.InlineResult; 6 | import com.jtelegram.api.message.input.file.IdInputFile; 7 | import com.jtelegram.api.inline.input.InputMessageContent; 8 | import com.jtelegram.api.requests.message.framework.ParseMode; 9 | import lombok.Builder; 10 | import lombok.Getter; 11 | import lombok.ToString; 12 | 13 | @Getter 14 | @ToString(callSuper = true) 15 | public class InlineCachedResultVideo extends InlineResult implements InlineResult.Cached, 16 | InlineResult.Titled, InlineResult.Captioned { 17 | @SerializedName("video_file_id") 18 | private IdInputFile fileId; 19 | private String title; 20 | private String caption; 21 | private ParseMode captionParseMode; 22 | 23 | @Builder 24 | private InlineCachedResultVideo(String id, InlineKeyboardMarkup replyMarkup, InputMessageContent inputMessageContent, 25 | IdInputFile fileId, String title, String caption, ParseMode captionParseMode) { 26 | super(id, replyMarkup, inputMessageContent); 27 | this.fileId = fileId; 28 | this.title = title; 29 | this.caption = caption; 30 | this.captionParseMode = captionParseMode; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/inline/result/cached/InlineCachedResultVoice.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.inline.result.cached; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | import com.jtelegram.api.inline.input.InputMessageContent; 5 | import com.jtelegram.api.inline.keyboard.InlineKeyboardMarkup; 6 | import com.jtelegram.api.inline.result.framework.InlineResult; 7 | import com.jtelegram.api.message.input.file.IdInputFile; 8 | import com.jtelegram.api.requests.message.framework.ParseMode; 9 | import lombok.Builder; 10 | import lombok.Getter; 11 | import lombok.ToString; 12 | 13 | @Getter 14 | @ToString(callSuper = true) 15 | public class InlineCachedResultVoice extends InlineResult implements InlineResult.Cached, 16 | InlineResult.Titled, InlineResult.Captioned { 17 | @SerializedName("voice_file_id") 18 | private IdInputFile fileId; 19 | private String title; 20 | private String caption; 21 | private ParseMode captionParseMode; 22 | 23 | @Builder 24 | private InlineCachedResultVoice(String id, InlineKeyboardMarkup replyMarkup, InputMessageContent inputMessageContent, 25 | IdInputFile fileId, String title, String caption, ParseMode captionParseMode) { 26 | super(id, replyMarkup, inputMessageContent); 27 | this.fileId = fileId; 28 | this.title = title; 29 | this.caption = caption; 30 | this.captionParseMode = captionParseMode; 31 | } 32 | } 33 | 34 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/inline/result/framework/DimensionalThumbableInlineResult.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.inline.result.framework; 2 | 3 | import com.jtelegram.api.inline.input.InputMessageContent; 4 | import com.jtelegram.api.inline.keyboard.InlineKeyboardMarkup; 5 | import lombok.Getter; 6 | import lombok.ToString; 7 | 8 | @Getter 9 | @ToString(callSuper = true) 10 | public abstract class DimensionalThumbableInlineResult extends ThumbableInlineResult { 11 | private Integer thumbWidth; 12 | private Integer thumbHeight; 13 | 14 | protected DimensionalThumbableInlineResult(String id, InlineKeyboardMarkup replyMarkup, InputMessageContent inputMessageContent, String thumbUrl, Integer thumbWidth, Integer thumbHeight) { 15 | super(id, replyMarkup, inputMessageContent, thumbUrl); 16 | this.thumbWidth = thumbWidth; 17 | this.thumbHeight = thumbHeight; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/inline/result/framework/ThumbableInlineResult.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.inline.result.framework; 2 | 3 | import com.jtelegram.api.inline.keyboard.InlineKeyboardMarkup; 4 | import com.jtelegram.api.inline.input.InputMessageContent; 5 | import lombok.Getter; 6 | import lombok.ToString; 7 | 8 | @Getter 9 | @ToString(callSuper = true) 10 | public abstract class ThumbableInlineResult extends InlineResult { 11 | private String thumbUrl; 12 | 13 | protected ThumbableInlineResult(String id, InlineKeyboardMarkup replyMarkup, InputMessageContent inputMessageContent, String thumbUrl) { 14 | super(id, replyMarkup, inputMessageContent); 15 | this.thumbUrl = thumbUrl; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/message/CaptionableMessage.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.message; 2 | 3 | import com.jtelegram.api.message.entity.MessageEntity; 4 | import lombok.Getter; 5 | 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | import lombok.ToString; 9 | 10 | @ToString(callSuper = true) 11 | public abstract class CaptionableMessage extends Message { 12 | @Getter 13 | private String caption; 14 | private transient boolean entitiesUpdated = false; 15 | private List captionEntities = new ArrayList<>(); 16 | 17 | public List getCaptionEntities() { 18 | if (!entitiesUpdated) { 19 | captionEntities.forEach((e) -> e.updateContent(caption)); 20 | entitiesUpdated = true; 21 | } 22 | 23 | return captionEntities; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/message/entity/MessageEntityType.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.message.entity; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | import lombok.Getter; 5 | 6 | @Getter 7 | public enum MessageEntityType { 8 | @SerializedName("mention") 9 | MENTION, 10 | @SerializedName("hashtag") 11 | HASHTAG, 12 | @SerializedName("bot_command") 13 | BOT_COMMAND, 14 | @SerializedName("url") 15 | URL, 16 | @SerializedName("email") 17 | EMAIL, 18 | @SerializedName("bold") 19 | BOLD, 20 | @SerializedName("italic") 21 | ITALIC, 22 | @SerializedName("code") 23 | CODE, 24 | @SerializedName("pre") 25 | PRE, 26 | @SerializedName("cashtag") 27 | CASHTAG, 28 | @SerializedName("phone_number") 29 | PHONE_NUMBER, 30 | @SerializedName("text_link") 31 | TEXT_LINK(TextLinkMessageEntity.class), 32 | @SerializedName("text_mention") 33 | TEXT_MENTION(TextMentionMessageEntity.class), 34 | @SerializedName("@@unsupported_by_api@@") 35 | UNSUPPORTED(UnsupportedMessageEntity.class); 36 | 37 | private Class implementationClass; 38 | 39 | MessageEntityType() { 40 | this.implementationClass = MessageEntity.DefaultMessageEntity.class; 41 | } 42 | 43 | MessageEntityType(Class implementationClass) { 44 | this.implementationClass = implementationClass; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/message/entity/TextLinkMessageEntity.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.message.entity; 2 | 3 | import lombok.EqualsAndHashCode; 4 | import lombok.Getter; 5 | import lombok.ToString; 6 | 7 | @Getter 8 | @ToString(callSuper = true) 9 | @EqualsAndHashCode(callSuper = true) 10 | public class TextLinkMessageEntity extends MessageEntity { 11 | 12 | private String url; 13 | 14 | } 15 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/message/entity/TextMentionMessageEntity.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.message.entity; 2 | 3 | import com.jtelegram.api.user.User; 4 | import lombok.EqualsAndHashCode; 5 | import lombok.Getter; 6 | import lombok.ToString; 7 | 8 | @Getter 9 | @ToString(callSuper = true) 10 | @EqualsAndHashCode(callSuper = true) 11 | public class TextMentionMessageEntity extends MessageEntity { 12 | 13 | private User user; 14 | 15 | } 16 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/message/games/Animation.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.message.games; 2 | 3 | import com.jtelegram.api.message.media.PhotoSize; 4 | import lombok.AccessLevel; 5 | import lombok.Builder; 6 | import lombok.Getter; 7 | import lombok.RequiredArgsConstructor; 8 | import lombok.ToString; 9 | 10 | @Getter 11 | @Builder 12 | @ToString 13 | @RequiredArgsConstructor(access = AccessLevel.PROTECTED) 14 | public class Animation { 15 | private final String fileId; 16 | private final PhotoSize thumb; 17 | private final String fileName; 18 | private final String mimeType; 19 | private final Integer fileSize; 20 | } 21 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/message/games/CallbackGame.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.message.games; 2 | 3 | public class CallbackGame { 4 | } 5 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/message/games/Game.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.message.games; 2 | 3 | import com.jtelegram.api.message.media.PhotoSize; 4 | import com.jtelegram.api.message.entity.MessageEntity; 5 | import lombok.AccessLevel; 6 | import lombok.Getter; 7 | import lombok.RequiredArgsConstructor; 8 | import lombok.ToString; 9 | 10 | import java.util.List; 11 | 12 | @Getter 13 | @ToString 14 | @RequiredArgsConstructor(access = AccessLevel.PROTECTED) 15 | public class Game { 16 | private final String title; 17 | private final String description; 18 | private final List photo; 19 | private final String text; 20 | private final List textEntities; 21 | private final Animation animation; 22 | } 23 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/message/games/GameHighScore.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.message.games; 2 | 3 | import com.jtelegram.api.user.User; 4 | import lombok.AccessLevel; 5 | import lombok.Getter; 6 | import lombok.RequiredArgsConstructor; 7 | import lombok.ToString; 8 | 9 | @Getter 10 | @ToString 11 | @RequiredArgsConstructor(access = AccessLevel.PROTECTED) 12 | public class GameHighScore { 13 | private final Integer position; 14 | private final User user; 15 | private final Integer score; 16 | } 17 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/message/impl/AnimationMessage.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.message.impl; 2 | 3 | import com.jtelegram.api.message.Message; 4 | import com.jtelegram.api.message.media.Animation; 5 | import lombok.Getter; 6 | import lombok.ToString; 7 | 8 | @Getter 9 | @ToString(callSuper = true) 10 | public class AnimationMessage extends Message { 11 | private Animation animation; 12 | 13 | @Override 14 | public Animation getContent() { 15 | return animation; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /jtelegrambotapi-core/src/main/java/com/jtelegram/api/message/impl/AudioMessage.java: -------------------------------------------------------------------------------- 1 | package com.jtelegram.api.message.impl; 2 | 3 | import com.jtelegram.api.message.CaptionableMessage; 4 | import com.jtelegram.api.message.media.Audio; 5 | import com.jtelegram.api.requests.message.edit.EditMessageCaption; 6 | import com.jtelegram.api.requests.message.edit.EditMessageMedia; 7 | import lombok.Getter; 8 | import lombok.ToString; 9 | 10 | @Getter 11 | @ToString(callSuper = true) 12 | public class AudioMessage extends CaptionableMessage