├── .github ├── dependabot.yml ├── javadoc-publish-clear ├── release.yml └── workflows │ ├── build-and-release.yml │ ├── build-pr.yml │ └── update-pr-label.yml ├── .gitignore ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── build.gradle.kts ├── demo ├── build.gradle.kts └── src │ └── main │ ├── java │ └── org │ │ └── teleight │ │ └── teleightbots │ │ └── demo │ │ ├── MainDemo.java │ │ ├── command │ │ ├── TestCommand.java │ │ └── TestConversationCommand.java │ │ └── conversations │ │ └── TestConversation.java │ └── resources │ └── logback.xml ├── gradle ├── libs.versions.toml └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle.kts └── src └── main ├── java └── org │ └── teleight │ └── teleightbots │ ├── TeleightBots.java │ ├── TeleightBotsProcess.java │ ├── TeleightBotsProcessImpl.java │ ├── api │ ├── ApiMethod.java │ ├── ApiMethodBoolean.java │ ├── ApiMethodMessage.java │ ├── ApiMethodMultiResponse.java │ ├── ApiResult.java │ ├── MultiPartApiMethod.java │ ├── MultiPartApiMethodBoolean.java │ ├── MultiPartApiMethodMessage.java │ ├── methods │ │ ├── AddStickerToSet.java │ │ ├── AnswerCallbackQuery.java │ │ ├── AnswerInlineQuery.java │ │ ├── AnswerPreCheckoutQuery.java │ │ ├── AnswerShippingQuery.java │ │ ├── AnswerWebAppQuery.java │ │ ├── ApproveChatJoinRequest.java │ │ ├── BanChatMember.java │ │ ├── BanChatSenderChat.java │ │ ├── BatchCopyMessages.java │ │ ├── BatchDeleteMessages.java │ │ ├── BatchForwardMessages.java │ │ ├── CloseForumTopic.java │ │ ├── CloseGeneralForumTopic.java │ │ ├── ConvertGiftToStars.java │ │ ├── CopyMessage.java │ │ ├── CopyTextButton.java │ │ ├── CreateChatInviteLink.java │ │ ├── CreateChatSubscriptionInviteLink.java │ │ ├── CreateForumTopic.java │ │ ├── CreateInvoiceLink.java │ │ ├── CreateNewStickerSet.java │ │ ├── DeclineChatJoinRequest.java │ │ ├── DeleteBusinessMessages.java │ │ ├── DeleteChatPhoto.java │ │ ├── DeleteChatStickerSet.java │ │ ├── DeleteForumTopic.java │ │ ├── DeleteMessage.java │ │ ├── DeleteMyCommands.java │ │ ├── DeleteStickerFromSet.java │ │ ├── DeleteStickerSet.java │ │ ├── DeleteStory.java │ │ ├── DeleteWebhook.java │ │ ├── EditChatInviteLink.java │ │ ├── EditChatSubscriptionInviteLink.java │ │ ├── EditForumTopic.java │ │ ├── EditGeneralForumTopic.java │ │ ├── EditMessageCaption.java │ │ ├── EditMessageLiveLocation.java │ │ ├── EditMessageMedia.java │ │ ├── EditMessageReplyMarkup.java │ │ ├── EditMessageText.java │ │ ├── EditStory.java │ │ ├── EditUserStarSubscription.java │ │ ├── ExportChatInviteLink.java │ │ ├── ForwardMessage.java │ │ ├── GetAvailableGifts.java │ │ ├── GetBusinessAccountGifts.java │ │ ├── GetBusinessAccountStarBalance.java │ │ ├── GetBusinessConnection.java │ │ ├── GetChat.java │ │ ├── GetChatAdministrators.java │ │ ├── GetChatMember.java │ │ ├── GetChatMemberCount.java │ │ ├── GetChatMenuButton.java │ │ ├── GetCustomEmojiStickers.java │ │ ├── GetFile.java │ │ ├── GetForumTopicIconStickers.java │ │ ├── GetGameHighScores.java │ │ ├── GetMe.java │ │ ├── GetMyCommands.java │ │ ├── GetMyDefaultAdministratorRights.java │ │ ├── GetMyDescription.java │ │ ├── GetMyName.java │ │ ├── GetMyShortDescription.java │ │ ├── GetStarTransactions.java │ │ ├── GetStickerSet.java │ │ ├── GetUpdates.java │ │ ├── GetUserChatBoosts.java │ │ ├── GetUserProfilePhotos.java │ │ ├── GetWebhookInfo.java │ │ ├── GiftPremiumSubscription.java │ │ ├── HideGeneralForumTopic.java │ │ ├── LeaveChat.java │ │ ├── PinChatMessage.java │ │ ├── PostStory.java │ │ ├── PromoteChatMember.java │ │ ├── ReadBusinessMessage.java │ │ ├── RefundStarPayment.java │ │ ├── RemoveBusinessAccountProfilePhoto.java │ │ ├── RemoveChatVerification.java │ │ ├── RemoveUserVerification.java │ │ ├── ReopenForumTopic.java │ │ ├── ReopenGeneralForumTopic.java │ │ ├── ReplaceStickerInSet.java │ │ ├── RestrictChatMember.java │ │ ├── RevokeChatInviteLink.java │ │ ├── SavePreparedInlineMessage.java │ │ ├── SendAnimation.java │ │ ├── SendAudio.java │ │ ├── SendChatAction.java │ │ ├── SendContact.java │ │ ├── SendDice.java │ │ ├── SendDocument.java │ │ ├── SendGame.java │ │ ├── SendGift.java │ │ ├── SendInvoice.java │ │ ├── SendLocation.java │ │ ├── SendMediaGroup.java │ │ ├── SendMessage.java │ │ ├── SendPaidMedia.java │ │ ├── SendPhoto.java │ │ ├── SendPoll.java │ │ ├── SendSticker.java │ │ ├── SendVenue.java │ │ ├── SendVideo.java │ │ ├── SendVideoNote.java │ │ ├── SendVoice.java │ │ ├── SetBusinessAccountBio.java │ │ ├── SetBusinessAccountGiftSettings.java │ │ ├── SetBusinessAccountName.java │ │ ├── SetBusinessAccountProfilePhoto.java │ │ ├── SetBusinessAccountUsername.java │ │ ├── SetChatAdministratorCustomTitle.java │ │ ├── SetChatDescription.java │ │ ├── SetChatMenuButton.java │ │ ├── SetChatPermissions.java │ │ ├── SetChatPhoto.java │ │ ├── SetChatStickerSet.java │ │ ├── SetChatTitle.java │ │ ├── SetCustomEmojiStickerSetThumbnail.java │ │ ├── SetGameScore.java │ │ ├── SetMessageReaction.java │ │ ├── SetMyCommands.java │ │ ├── SetMyDefaultAdministratorRights.java │ │ ├── SetMyDescription.java │ │ ├── SetMyName.java │ │ ├── SetMyShortDescription.java │ │ ├── SetPassportDataErrors.java │ │ ├── SetStickerEmojiList.java │ │ ├── SetStickerKeywords.java │ │ ├── SetStickerMaskPosition.java │ │ ├── SetStickerPositionInSet.java │ │ ├── SetStickerSetThumbnail.java │ │ ├── SetStickerSetTitle.java │ │ ├── SetUserEmojiStatus.java │ │ ├── SetWebhook.java │ │ ├── StopMessageLiveLocation.java │ │ ├── StopPoll.java │ │ ├── TransferBusinessAccountStars.java │ │ ├── TransferGift.java │ │ ├── UnbanChatMember.java │ │ ├── UnbanChatSenderChat.java │ │ ├── UnhideGeneralForumTopic.java │ │ ├── UnpinAllChatMessages.java │ │ ├── UnpinAllForumTopicMessages.java │ │ ├── UnpinAllGeneralForumTopicMessages.java │ │ ├── UnpinChatMessage.java │ │ ├── UpgradeGift.java │ │ ├── UploadStickerFile.java │ │ ├── VerifyChat.java │ │ └── VerifyUser.java │ ├── objects │ │ ├── AcceptedGiftTypes.java │ │ ├── AffiliateInfo.java │ │ ├── Animation.java │ │ ├── ApiResponse.java │ │ ├── Audio.java │ │ ├── BackgroundFill.java │ │ ├── BackgroundFillFreeformGradient.java │ │ ├── BackgroundFillGradient.java │ │ ├── BackgroundFillSolid.java │ │ ├── BackgroundType.java │ │ ├── BackgroundTypeChatTheme.java │ │ ├── BackgroundTypeFill.java │ │ ├── BackgroundTypePattern.java │ │ ├── BackgroundTypeWallpaper.java │ │ ├── Birthdate.java │ │ ├── BotCommand.java │ │ ├── BotCommandScope.java │ │ ├── BotCommandScopeAllChatAdministrators.java │ │ ├── BotCommandScopeAllGroupChats.java │ │ ├── BotCommandScopeAllPrivateChats.java │ │ ├── BotCommandScopeChat.java │ │ ├── BotCommandScopeChatAdministrators.java │ │ ├── BotCommandScopeChatMember.java │ │ ├── BotCommandScopeDefault.java │ │ ├── BotDescription.java │ │ ├── BotName.java │ │ ├── BotShortDescription.java │ │ ├── BusinessBotRights.java │ │ ├── BusinessConnection.java │ │ ├── BusinessIntro.java │ │ ├── BusinessLocation.java │ │ ├── BusinessMessagesDeleted.java │ │ ├── BusinessOpeningHours.java │ │ ├── BusinessOpeningHoursInterval.java │ │ ├── CallbackGame.java │ │ ├── CallbackQuery.java │ │ ├── Chat.java │ │ ├── ChatAction.java │ │ ├── ChatAdministratorRights.java │ │ ├── ChatBackground.java │ │ ├── ChatBoost.java │ │ ├── ChatBoostAdded.java │ │ ├── ChatBoostRemoved.java │ │ ├── ChatBoostSource.java │ │ ├── ChatBoostSourceGiftCode.java │ │ ├── ChatBoostSourceGiveaway.java │ │ ├── ChatBoostSourcePremium.java │ │ ├── ChatBoostUpdated.java │ │ ├── ChatFullInfo.java │ │ ├── ChatInviteLink.java │ │ ├── ChatJoinRequest.java │ │ ├── ChatLocation.java │ │ ├── ChatMember.java │ │ ├── ChatMemberAdministrator.java │ │ ├── ChatMemberBanned.java │ │ ├── ChatMemberLeft.java │ │ ├── ChatMemberMember.java │ │ ├── ChatMemberOwner.java │ │ ├── ChatMemberRestricted.java │ │ ├── ChatMemberUpdated.java │ │ ├── ChatPermissions.java │ │ ├── ChatPhoto.java │ │ ├── ChatShared.java │ │ ├── ChosenInlineResult.java │ │ ├── Contact.java │ │ ├── Dice.java │ │ ├── Document.java │ │ ├── EncryptedCredentials.java │ │ ├── EncryptedPassportElement.java │ │ ├── ExternalReplyInfo.java │ │ ├── File.java │ │ ├── ForceReplyKeyboard.java │ │ ├── ForumTopicClosed.java │ │ ├── ForumTopicCreated.java │ │ ├── ForumTopicEdited.java │ │ ├── ForumTopicReopened.java │ │ ├── Game.java │ │ ├── GameHighScore.java │ │ ├── GeneralForumTopicHidden.java │ │ ├── GeneralForumTopicUnhidden.java │ │ ├── Gift.java │ │ ├── GiftInfo.java │ │ ├── Gifts.java │ │ ├── Giveaway.java │ │ ├── GiveawayCompleted.java │ │ ├── GiveawayCreated.java │ │ ├── GiveawayWinners.java │ │ ├── InaccessibleMessage.java │ │ ├── InlineKeyboardButton.java │ │ ├── InlineKeyboardMarkup.java │ │ ├── InlineQuery.java │ │ ├── InlineQueryResult.java │ │ ├── InlineQueryResultArticle.java │ │ ├── InlineQueryResultAudio.java │ │ ├── InlineQueryResultCachedAudio.java │ │ ├── InlineQueryResultCachedDocument.java │ │ ├── InlineQueryResultCachedGif.java │ │ ├── InlineQueryResultCachedMpeg4Gif.java │ │ ├── InlineQueryResultCachedPhoto.java │ │ ├── InlineQueryResultCachedSticker.java │ │ ├── InlineQueryResultCachedVideo.java │ │ ├── InlineQueryResultCachedVoice.java │ │ ├── InlineQueryResultContact.java │ │ ├── InlineQueryResultDocument.java │ │ ├── InlineQueryResultGame.java │ │ ├── InlineQueryResultGif.java │ │ ├── InlineQueryResultLocation.java │ │ ├── InlineQueryResultMpeg4Gif.java │ │ ├── InlineQueryResultPhoto.java │ │ ├── InlineQueryResultVenue.java │ │ ├── InlineQueryResultVideo.java │ │ ├── InlineQueryResultVoice.java │ │ ├── InputContactMessageContent.java │ │ ├── InputFile.java │ │ ├── InputInvoiceMessageContent.java │ │ ├── InputLocationMessageContent.java │ │ ├── InputMedia.java │ │ ├── InputMediaAnimation.java │ │ ├── InputMediaAudio.java │ │ ├── InputMediaDocument.java │ │ ├── InputMediaPhoto.java │ │ ├── InputMediaVideo.java │ │ ├── InputMessageContent.java │ │ ├── InputPaidMedia.java │ │ ├── InputPaidMediaPhoto.java │ │ ├── InputPaidMediaVideo.java │ │ ├── InputPollOption.java │ │ ├── InputProfilePhoto.java │ │ ├── InputProfilePhotoAnimated.java │ │ ├── InputProfilePhotoStatic.java │ │ ├── InputSticker.java │ │ ├── InputStoryContent.java │ │ ├── InputStoryContentPhoto.java │ │ ├── InputStoryContentVideo.java │ │ ├── InputTextMessageContent.java │ │ ├── InputVenueMessageContent.java │ │ ├── Invoice.java │ │ ├── KeyboardButton.java │ │ ├── KeyboardButtonPollType.java │ │ ├── KeyboardButtonRequestChat.java │ │ ├── KeyboardButtonRequestUsers.java │ │ ├── LabeledPrice.java │ │ ├── LinkPreviewOptions.java │ │ ├── LivePeriod.java │ │ ├── Location.java │ │ ├── LocationAddress.java │ │ ├── LoginUrl.java │ │ ├── MaskPosition.java │ │ ├── MaybeInaccessibleMessage.java │ │ ├── MenuButton.java │ │ ├── MenuButtonCommands.java │ │ ├── MenuButtonDefault.java │ │ ├── MenuButtonWebApp.java │ │ ├── Message.java │ │ ├── MessageAutoDeleteTimerChanged.java │ │ ├── MessageEntity.java │ │ ├── MessageId.java │ │ ├── MessageOrigin.java │ │ ├── MessageOriginChannel.java │ │ ├── MessageOriginChat.java │ │ ├── MessageOriginHiddenUser.java │ │ ├── MessageOriginUser.java │ │ ├── MessageReactionCountUpdated.java │ │ ├── MessageReactionUpdated.java │ │ ├── OrderInfo.java │ │ ├── OwnedGift.java │ │ ├── OwnedGiftRegular.java │ │ ├── OwnedGiftUnique.java │ │ ├── OwnedGifts.java │ │ ├── PaidMedia.java │ │ ├── PaidMediaInfo.java │ │ ├── PaidMediaPhoto.java │ │ ├── PaidMediaPreview.java │ │ ├── PaidMediaPurchased.java │ │ ├── PaidMediaVideo.java │ │ ├── PaidMessagePriceChanged.java │ │ ├── ParseMode.java │ │ ├── PassportData.java │ │ ├── PassportElementError.java │ │ ├── PassportElementErrorDataField.java │ │ ├── PassportElementErrorFile.java │ │ ├── PassportElementErrorFiles.java │ │ ├── PassportElementErrorFrontSide.java │ │ ├── PassportElementErrorReverseSide.java │ │ ├── PassportElementErrorSelfie.java │ │ ├── PassportElementErrorTranslationFile.java │ │ ├── PassportElementErrorTranslationFiles.java │ │ ├── PassportElementErrorUnspecified.java │ │ ├── PassportFile.java │ │ ├── PhotoSize.java │ │ ├── Poll.java │ │ ├── PollAnswer.java │ │ ├── PollOption.java │ │ ├── PreCheckoutQuery.java │ │ ├── PreparedInlineMessage.java │ │ ├── ProximityAlertTriggered.java │ │ ├── ReactionCount.java │ │ ├── ReactionType.java │ │ ├── ReactionTypeCustomEmoji.java │ │ ├── ReactionTypeEmoji.java │ │ ├── ReactionTypePaid.java │ │ ├── RefundedPayment.java │ │ ├── ReplyKeyboard.java │ │ ├── ReplyKeyboardMarkup.java │ │ ├── ReplyKeyboardRemove.java │ │ ├── ReplyParameters.java │ │ ├── ResponseParameters.java │ │ ├── RevenueWithdrawalState.java │ │ ├── RevenueWithdrawalStateFailed.java │ │ ├── RevenueWithdrawalStatePending.java │ │ ├── RevenueWithdrawalStateSucceeded.java │ │ ├── SentWebAppMessage.java │ │ ├── SharedUser.java │ │ ├── ShippingAddress.java │ │ ├── ShippingOption.java │ │ ├── ShippingQuery.java │ │ ├── StarAmount.java │ │ ├── StarTransaction.java │ │ ├── StarTransactions.java │ │ ├── Sticker.java │ │ ├── StickerFormat.java │ │ ├── StickerSet.java │ │ ├── StickerType.java │ │ ├── Story.java │ │ ├── StoryArea.java │ │ ├── StoryAreaPosition.java │ │ ├── StoryAreaType.java │ │ ├── StoryAreaTypeLink.java │ │ ├── StoryAreaTypeLocation.java │ │ ├── StoryAreaTypeSuggestedReaction.java │ │ ├── StoryAreaTypeUniqueGift.java │ │ ├── StoryAreaTypeWeather.java │ │ ├── SuccessfulPayment.java │ │ ├── SwitchInlineQueryChosenChat.java │ │ ├── TextQuote.java │ │ ├── TransactionPartner.java │ │ ├── TransactionPartnerAffiliateProgram.java │ │ ├── TransactionPartnerChat.java │ │ ├── TransactionPartnerFragment.java │ │ ├── TransactionPartnerOther.java │ │ ├── TransactionPartnerTelegramAds.java │ │ ├── TransactionPartnerTelegramApi.java │ │ ├── TransactionPartnerUser.java │ │ ├── TransactionType.java │ │ ├── UniqueGift.java │ │ ├── UniqueGiftBackdrop.java │ │ ├── UniqueGiftBackdropColors.java │ │ ├── UniqueGiftInfo.java │ │ ├── UniqueGiftModel.java │ │ ├── UniqueGiftOrigin.java │ │ ├── UniqueGiftSymbol.java │ │ ├── Update.java │ │ ├── User.java │ │ ├── UserChatBoosts.java │ │ ├── UserProfilePhotos.java │ │ ├── UsersShared.java │ │ ├── Venue.java │ │ ├── Video.java │ │ ├── VideoChatEnded.java │ │ ├── VideoChatParticipantsInvited.java │ │ ├── VideoChatScheduled.java │ │ ├── VideoChatStarted.java │ │ ├── VideoNote.java │ │ ├── Voice.java │ │ ├── WebAppData.java │ │ ├── WebAppInfo.java │ │ ├── WebhookInfo.java │ │ └── WriteAccessAllowed.java │ └── serialization │ │ ├── deserializers │ │ ├── ColorDeserializer.java │ │ ├── DateDeserializer.java │ │ ├── KeyboardDeserializer.java │ │ ├── LivePeriodDeserializer.java │ │ └── MaybeInaccessibleMessageDeserializer.java │ │ └── serializers │ │ ├── ColorSerializer.java │ │ ├── DateSerializer.java │ │ ├── InputFileSerializer.java │ │ └── LivePeriodSerializer.java │ ├── bot │ ├── LongPollingTelegramBot.java │ ├── LongPollingTelegramBotImpl.java │ ├── TelegramBot.java │ ├── WebhookTelegramBot.java │ ├── WebhookTelegramBotImpl.java │ ├── manager │ │ ├── BotManager.java │ │ └── BotManagerImpl.java │ └── settings │ │ ├── BotSettings.java │ │ ├── LongPollingBotSettings.java │ │ └── WebhookBotSettings.java │ ├── commands │ ├── CommandManager.java │ ├── CommandManagerImpl.java │ ├── CommandParser.java │ ├── CommandParserImpl.java │ ├── ExecutableCommand.java │ └── builder │ │ ├── Command.java │ │ ├── CommandExecutor.java │ │ ├── CommandSyntax.java │ │ ├── argument │ │ ├── Argument.java │ │ ├── ArgumentInteger.java │ │ └── ArgumentString.java │ │ ├── condition │ │ └── CommandCondition.java │ │ ├── exception │ │ └── ArgumentSyntaxException.java │ │ └── parser │ │ ├── ArgumentReader.java │ │ └── CommandContext.java │ ├── conversation │ ├── Conversation.java │ ├── ConversationContext.java │ ├── ConversationExecutor.java │ ├── ConversationInstanceConstraints.java │ ├── ConversationManager.java │ ├── ConversationManagerImpl.java │ └── Property.java │ ├── event │ ├── EventListener.java │ ├── EventListenerImpl.java │ ├── EventManager.java │ ├── EventManagerImpl.java │ ├── bot │ │ ├── BotShutdownEvent.java │ │ ├── MethodSendEvent.java │ │ ├── UpdateReceivedEvent.java │ │ ├── channel │ │ │ └── ChannelSendMessageEvent.java │ │ └── group │ │ │ ├── BotJoinGroupEvent.java │ │ │ ├── BotQuitGroupEvent.java │ │ │ ├── SelfJoinGroupEvent.java │ │ │ └── SelfQuitGroupEvent.java │ ├── keyboard │ │ └── ButtonPressEvent.java │ ├── trait │ │ ├── CancellableEvent.java │ │ ├── Event.java │ │ ├── GroupBotEvent.java │ │ └── MessageEvent.java │ └── user │ │ ├── UserInlineQueryReceivedEvent.java │ │ ├── UserMessageReceivedEvent.java │ │ └── group │ │ ├── UserJoinGroupEvent.java │ │ └── UserQuitGroupEvent.java │ ├── exception │ ├── ExceptionHandler.java │ ├── ExceptionManager.java │ └── exceptions │ │ ├── RateLimitException.java │ │ └── TelegramRequestException.java │ ├── extensions │ ├── DiscoveredExtension.java │ ├── Extension.java │ ├── ExtensionClassLoader.java │ ├── ExtensionManager.java │ ├── ExtensionManagerImpl.java │ └── annotation │ │ ├── ExtensionAnnotationProcessor.java │ │ ├── ExtensionInfo.java │ │ └── ExtensionInfoFile.java │ ├── files │ ├── DownloadFileException.java │ ├── FileDownloader.java │ └── FileDownloaderImpl.java │ ├── menu │ ├── Menu.java │ ├── MenuBuilder.java │ ├── MenuImpl.java │ ├── MenuManager.java │ └── MenuManagerImpl.java │ ├── scheduler │ ├── Scheduler.java │ ├── SchedulerImpl.java │ └── Task.java │ ├── updateprocessor │ ├── BotMethodExecutor.java │ ├── LongPollingUpdateProcessor.java │ ├── MultiPartBodyPublisher.java │ ├── UpdateProcessor.java │ ├── WebhookUpdateProcessor.java │ └── events │ │ ├── CallbackQueryEventProcessor.java │ │ ├── ChannelPostEventProcessor.java │ │ ├── ChatMemberStatusEventProcessor.java │ │ ├── EventProcessor.java │ │ ├── InlineQueryEventProcessor.java │ │ └── MessageEventProcessor.java │ └── webhook │ ├── HttpResponse.java │ ├── SunWebhookServerImpl.java │ ├── WebhookServer.java │ └── WebhookServerConfig.java └── resources └── META-INF └── services └── javax.annotation.processing.Processor /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "gradle" 4 | directory: "/" 5 | schedule: 6 | interval: "weekly" 7 | commit-message: 8 | prefix: "chore(deps)" 9 | labels: 10 | - "dependencies" 11 | - package-ecosystem: github-actions 12 | directory: "/" 13 | schedule: 14 | interval: weekly 15 | commit-message: 16 | prefix: "chore(deps)" 17 | labels: 18 | - "dependencies" 19 | -------------------------------------------------------------------------------- /.github/javadoc-publish-clear: -------------------------------------------------------------------------------- 1 | **/* 2 | !.git 3 | !CNAME 4 | -------------------------------------------------------------------------------- /.github/release.yml: -------------------------------------------------------------------------------- 1 | changelog: 2 | exclude: 3 | labels: 4 | - ignore-for-release 5 | categories: 6 | - title: Breaking Changes 🛠 7 | labels: 8 | - breaking-change 9 | - title: New Features 🎉 10 | labels: 11 | - feature 12 | - enhancement 13 | - title: Bug fixes 🐛 14 | labels: 15 | - fix 16 | - title: Dependency Updates ⬆️ 17 | labels: 18 | - dependencies 19 | - title: Other Changes 🔄 20 | labels: 21 | - "*" 22 | -------------------------------------------------------------------------------- /.github/workflows/build-pr.yml: -------------------------------------------------------------------------------- 1 | name: Pull Request CI Job 2 | permissions: 3 | contents: write 4 | on: 5 | pull_request: 6 | jobs: 7 | build-and-release: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - uses: actions/checkout@v4 11 | with: 12 | fetch-depth: 0 13 | 14 | - name: Set up JDK 15 | uses: actions/setup-java@v4 16 | with: 17 | java-version: 21 18 | distribution: 'oracle' 19 | 20 | - name: Grant execute permission for gradlew 21 | run: chmod +x gradlew 22 | 23 | - name: Setup Gradle 24 | uses: gradle/actions/setup-gradle@v4 25 | 26 | - name: Build 27 | run: | 28 | ./gradlew shadowJar --parallel --no-daemon 29 | -------------------------------------------------------------------------------- /.github/workflows/update-pr-label.yml: -------------------------------------------------------------------------------- 1 | name: PR Conventional Commit Validation 2 | 3 | permissions: 4 | contents: write 5 | pull-requests: write 6 | 7 | on: 8 | pull_request: 9 | types: [opened, synchronize, reopened, edited] 10 | 11 | jobs: 12 | validate-pr-title: 13 | runs-on: ubuntu-latest 14 | steps: 15 | - name: PR Conventional Commit Validation 16 | uses: ytanikin/pr-conventional-commits@1.4.1 17 | with: 18 | task_types: '["feat","fix","docs","test","ci","refactor","perf","chore","revert"]' 19 | custom_labels: '{"feat": "feature", "fix": "fix", "docs": "documentation", "test": "test", "ci": "CI/CD", "refactor": "refactor", "perf": "performance", "chore": "chore", "revert": "revert", "wip": "WIP"}' 20 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | build/ 3 | !gradle/wrapper/gradle-wrapper.jar 4 | !**/src/main/**/build/ 5 | !**/src/test/**/build/ 6 | 7 | ### IntelliJ IDEA ### 8 | .idea/modules.xml 9 | .idea/jarRepositories.xml 10 | .idea/compiler.xml 11 | .idea/libraries/ 12 | *.iws 13 | *.iml 14 | *.ipr 15 | out/ 16 | !**/src/main/**/out/ 17 | !**/src/test/**/out/ 18 | 19 | ### Eclipse ### 20 | .apt_generated 21 | .classpath 22 | .factorypath 23 | .project 24 | .settings 25 | .springBeans 26 | .sts4-cache 27 | bin/ 28 | !**/src/main/**/bin/ 29 | !**/src/test/**/bin/ 30 | 31 | ### NetBeans ### 32 | /nbproject/private/ 33 | /nbbuild/ 34 | /dist/ 35 | /nbdist/ 36 | /.nb-gradle/ 37 | 38 | ### VS Code ### 39 | .vscode/ 40 | 41 | ### Mac OS ### 42 | .DS_Store -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ## How to contribute 2 | #### **Did you find a bug?** 3 | * Open a new GitHub issue if it's not already reported. 4 | 5 | * Explain it clearly, with steps (or code) to reproduce it. 6 | 7 | #### **Why don't some methods exist?** 8 | * Teleight is a fairly new library and some methods may not be available. 9 | * New pull requests adding methods to the library are welcomed. 10 | 11 | #### **How to wrap methods and objects from Telegram?** 12 | 1. Visit [Telegram Bot Api](https://core.telegram.org/bots/api). 13 | 2. Take a look at [GetUpdates method](https://github.com/Teleight/TeleightBots/blob/master/src/main/java/org/teleight/teleightbots/api/methods/GetUpdates.java) and [GetUpdates result](https://github.com/Teleight/TeleightBots/blob/master/src/main/java/org/teleight/teleightbots/api/objects/Update.java). 14 | 3. Make sure to follow the current syntax and design. 15 | 4. Create a pull request. 16 | 17 | Feel free to ask for anything, Teleight is a community project not affiliated to Telegram in any way 18 | 19 | Thank you! ❤️ 20 | -------------------------------------------------------------------------------- /demo/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("application") 3 | } 4 | 5 | dependencies { 6 | implementation(rootProject) 7 | implementation(libs.jetbrains.annotations) 8 | implementation(libs.logback) 9 | configurations.all { 10 | exclude(group = "org.slf4j", module = "slf4j-simple") 11 | } 12 | 13 | } 14 | 15 | tasks.withType { 16 | exclude("**") 17 | } 18 | 19 | application { 20 | mainClass.set("org.teleight.teleightbots.demo.MainDemo") 21 | } 22 | -------------------------------------------------------------------------------- /demo/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %green(%d{HH:mm:ss.SSS}) %highlight(%-5level) %logger{36} - %msg%n 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Teleight/TeleightBots/2c2e4b2c7ec65d79d234a910562770d24474b201/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionSha256Sum=31c55713e40233a8303827ceb42ca48a47267a0ad4bab9177123121e71524c26 4 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip 5 | networkTimeout=10000 6 | validateDistributionUrl=true 7 | zipStoreBase=GRADLE_USER_HOME 8 | zipStorePath=wrapper/dists 9 | -------------------------------------------------------------------------------- /settings.gradle.kts: -------------------------------------------------------------------------------- 1 | rootProject.name = "TeleightBots" 2 | include("demo") 3 | 4 | val isCiServer = System.getenv().containsKey("CI") 5 | buildCache { 6 | local { 7 | isEnabled = !isCiServer 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/TeleightBotsProcess.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.teleight.teleightbots.bot.manager.BotManager; 5 | import org.teleight.teleightbots.exception.ExceptionManager; 6 | import org.teleight.teleightbots.scheduler.Scheduler; 7 | 8 | import java.io.Closeable; 9 | 10 | public sealed interface TeleightBotsProcess extends Closeable permits TeleightBotsProcessImpl { 11 | 12 | @NotNull Scheduler scheduler(); 13 | 14 | @NotNull BotManager botManager(); 15 | 16 | @NotNull 17 | ExceptionManager exceptionManager(); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/ApiMethodBoolean.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.teleight.teleightbots.exception.exceptions.TelegramRequestException; 5 | 6 | /** 7 | * Represents a method that returns a boolean result. 8 | */ 9 | public interface ApiMethodBoolean extends ApiMethod { 10 | 11 | @Override 12 | default @NotNull Boolean deserializeResponse(@NotNull String answer) throws TelegramRequestException { 13 | return deserializeResponse(answer, Boolean.class); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/ApiMethodMessage.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.teleight.teleightbots.api.objects.Message; 5 | import org.teleight.teleightbots.exception.exceptions.TelegramRequestException; 6 | 7 | /** 8 | * Represents a method that returns a message result. 9 | */ 10 | public interface ApiMethodMessage extends ApiMethod { 11 | 12 | @Override 13 | default @NotNull Message deserializeResponse(@NotNull String answer) throws TelegramRequestException { 14 | return deserializeResponse(answer, Message.class); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/ApiResult.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonInclude; 5 | 6 | import java.io.Serializable; 7 | 8 | /** 9 | * Marker interface for all API results. 10 | */ 11 | @JsonIgnoreProperties(ignoreUnknown = true) 12 | @JsonInclude(JsonInclude.Include.NON_NULL) 13 | public interface ApiResult extends Serializable { 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/MultiPartApiMethod.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import java.io.Serializable; 6 | import java.util.Map; 7 | 8 | /** 9 | * Interface representing a multipart API method. 10 | *

11 | * This interface extends the {@link ApiMethod} interface and provides methods to access parameters and input files, 12 | * as well as a method to build a request with a multipart body. 13 | * 14 | * @param the type of the response expected from the API method 15 | */ 16 | public interface MultiPartApiMethod extends ApiMethod { 17 | 18 | /** 19 | * Gets the parameters of the multipart API method. 20 | * 21 | * @return a map containing the parameters of the multipart API method 22 | */ 23 | @NotNull Map getParameters(); 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/MultiPartApiMethodBoolean.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.teleight.teleightbots.exception.exceptions.TelegramRequestException; 5 | 6 | /** 7 | * Interface representing a multipart API method that returns a Boolean. 8 | */ 9 | public interface MultiPartApiMethodBoolean extends MultiPartApiMethod { 10 | 11 | @Override 12 | default @NotNull Boolean deserializeResponse(@NotNull String answer) throws TelegramRequestException { 13 | return deserializeResponse(answer, Boolean.class); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/MultiPartApiMethodMessage.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.teleight.teleightbots.api.objects.Message; 5 | import org.teleight.teleightbots.exception.exceptions.TelegramRequestException; 6 | 7 | /** 8 | * Interface representing a multipart API method that returns a Message. 9 | */ 10 | public interface MultiPartApiMethodMessage extends MultiPartApiMethod { 11 | 12 | @Override 13 | default @NotNull Message deserializeResponse(@NotNull String answer) throws TelegramRequestException { 14 | return deserializeResponse(answer, Message.class); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/methods/CloseGeneralForumTopic.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.methods; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Builder; 5 | import lombok.extern.jackson.Jacksonized; 6 | import org.jetbrains.annotations.NotNull; 7 | import org.teleight.teleightbots.api.ApiMethodBoolean; 8 | 9 | @Builder(builderClassName = "Builder", toBuilder = true, builderMethodName = "ofBuilder") 10 | @Jacksonized 11 | public record CloseGeneralForumTopic( 12 | @JsonProperty(value = "chat_id", required = true) 13 | @NotNull 14 | String chatId 15 | ) implements ApiMethodBoolean { 16 | 17 | public static @NotNull Builder ofBuilder(String chatId) { 18 | return new CloseGeneralForumTopic.Builder().chatId(chatId); 19 | } 20 | 21 | @Override 22 | public @NotNull String getEndpointURL() { 23 | return "closeGeneralForumTopic"; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/methods/CopyTextButton.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.methods; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Builder; 5 | import lombok.extern.jackson.Jacksonized; 6 | import org.jetbrains.annotations.NotNull; 7 | import org.teleight.teleightbots.api.ApiMethodBoolean; 8 | 9 | @Builder(builderClassName = "Builder", toBuilder = true, builderMethodName = "ofBuilder") 10 | @Jacksonized 11 | public record CopyTextButton( 12 | @JsonProperty(value = "text", required = true) 13 | @NotNull 14 | String text 15 | ) implements ApiMethodBoolean { 16 | 17 | public static @NotNull Builder ofBuilder(String text) { 18 | return new CopyTextButton.Builder().text(text); 19 | } 20 | 21 | @Override 22 | public @NotNull String getEndpointURL() { 23 | return "copyTextButton"; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/methods/DeleteChatPhoto.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.methods; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Builder; 5 | import lombok.extern.jackson.Jacksonized; 6 | import org.jetbrains.annotations.NotNull; 7 | import org.teleight.teleightbots.api.ApiMethodBoolean; 8 | 9 | @Builder(builderClassName = "Builder", toBuilder = true, builderMethodName = "ofBuilder") 10 | @Jacksonized 11 | public record DeleteChatPhoto( 12 | @JsonProperty(value = "chat_id", required = true) 13 | @NotNull 14 | String chatId 15 | ) implements ApiMethodBoolean { 16 | 17 | public static @NotNull Builder ofBuilder(String chatId) { 18 | return new DeleteChatPhoto.Builder().chatId(chatId); 19 | } 20 | 21 | @Override 22 | public @NotNull String getEndpointURL() { 23 | return "deleteChatPhoto"; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/methods/DeleteChatStickerSet.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.methods; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Builder; 5 | import lombok.extern.jackson.Jacksonized; 6 | import org.jetbrains.annotations.NotNull; 7 | import org.teleight.teleightbots.api.ApiMethodBoolean; 8 | 9 | @Builder(builderClassName = "Builder", toBuilder = true, builderMethodName = "ofBuilder") 10 | @Jacksonized 11 | public record DeleteChatStickerSet( 12 | @JsonProperty(value = "chat_id", required = true) 13 | @NotNull 14 | String chatId 15 | ) implements ApiMethodBoolean { 16 | 17 | public static @NotNull Builder ofBuilder(String chatId) { 18 | return new DeleteChatStickerSet.Builder().chatId(chatId); 19 | } 20 | 21 | @Override 22 | public @NotNull String getEndpointURL() { 23 | return "deleteChatStickerSet"; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/methods/DeleteMessage.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.methods; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Builder; 5 | import lombok.extern.jackson.Jacksonized; 6 | import org.jetbrains.annotations.NotNull; 7 | import org.teleight.teleightbots.api.ApiMethodBoolean; 8 | 9 | @Builder(builderClassName = "Builder", toBuilder = true, builderMethodName = "ofBuilder") 10 | @Jacksonized 11 | public record DeleteMessage( 12 | @JsonProperty(value = "chat_id", required = true) 13 | @NotNull 14 | String chatId, 15 | 16 | @JsonProperty(value = "message_id", required = true) 17 | int messageId 18 | ) implements ApiMethodBoolean { 19 | 20 | public static @NotNull Builder ofBuilder(String chatId, int messageId) { 21 | return new DeleteMessage.Builder().chatId(chatId).messageId(messageId); 22 | } 23 | 24 | @Override 25 | public @NotNull String getEndpointURL() { 26 | return "deleteMessage"; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/methods/DeleteMyCommands.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.methods; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Builder; 5 | import lombok.extern.jackson.Jacksonized; 6 | import org.jetbrains.annotations.NotNull; 7 | import org.jetbrains.annotations.Nullable; 8 | import org.teleight.teleightbots.api.ApiMethodBoolean; 9 | import org.teleight.teleightbots.api.objects.BotCommandScope; 10 | 11 | @Builder(builderClassName = "Builder", toBuilder = true, builderMethodName = "ofBuilder") 12 | @Jacksonized 13 | public record DeleteMyCommands( 14 | @JsonProperty(value = "scope") 15 | @Nullable 16 | BotCommandScope scope, 17 | 18 | @JsonProperty(value = "language_code") 19 | @Nullable 20 | String languageCode 21 | ) implements ApiMethodBoolean { 22 | 23 | @Override 24 | public @NotNull String getEndpointURL() { 25 | return "deleteMyCommands"; 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/methods/DeleteStickerFromSet.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.methods; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Builder; 5 | import lombok.extern.jackson.Jacksonized; 6 | import org.jetbrains.annotations.NotNull; 7 | import org.teleight.teleightbots.api.ApiMethodBoolean; 8 | 9 | @Builder(builderClassName = "Builder", toBuilder = true, builderMethodName = "ofBuilder") 10 | @Jacksonized 11 | public record DeleteStickerFromSet( 12 | @JsonProperty(value = "sticker", required = true) 13 | @NotNull 14 | String sticker 15 | ) implements ApiMethodBoolean { 16 | 17 | public static @NotNull Builder ofBuilder(String sticker) { 18 | return new DeleteStickerFromSet.Builder().sticker(sticker); 19 | } 20 | 21 | @Override 22 | public @NotNull String getEndpointURL() { 23 | return "deleteStickerFromSet"; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/methods/DeleteStickerSet.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.methods; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Builder; 5 | import lombok.extern.jackson.Jacksonized; 6 | import org.jetbrains.annotations.NotNull; 7 | import org.teleight.teleightbots.api.ApiMethodBoolean; 8 | 9 | @Builder(builderClassName = "Builder", toBuilder = true, builderMethodName = "ofBuilder") 10 | @Jacksonized 11 | public record DeleteStickerSet( 12 | @JsonProperty(value = "name", required = true) 13 | @NotNull 14 | String name 15 | ) implements ApiMethodBoolean { 16 | 17 | public static @NotNull Builder ofBuilder(String name) { 18 | return new DeleteStickerSet.Builder().name(name); 19 | } 20 | 21 | @Override 22 | public @NotNull String getEndpointURL() { 23 | return "deleteStickerSet"; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/methods/DeleteWebhook.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.methods; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Builder; 5 | import lombok.extern.jackson.Jacksonized; 6 | import org.jetbrains.annotations.NotNull; 7 | import org.jetbrains.annotations.Nullable; 8 | import org.teleight.teleightbots.api.ApiMethodBoolean; 9 | 10 | @Builder(builderClassName = "Builder", toBuilder = true, builderMethodName = "ofBuilder") 11 | @Jacksonized 12 | public record DeleteWebhook( 13 | @JsonProperty(value = "drop_pending_updates") 14 | boolean dropPendingUpdates 15 | ) implements ApiMethodBoolean { 16 | 17 | @Override 18 | public @NotNull String getEndpointURL() { 19 | return "deleteWebhook"; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/methods/ExportChatInviteLink.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.methods; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Builder; 5 | import lombok.extern.jackson.Jacksonized; 6 | import org.jetbrains.annotations.NotNull; 7 | import org.teleight.teleightbots.api.ApiMethodBoolean; 8 | 9 | @Builder(builderClassName = "Builder", toBuilder = true, builderMethodName = "ofBuilder") 10 | @Jacksonized 11 | public record ExportChatInviteLink( 12 | @JsonProperty(value = "chat_id", required = true) 13 | @NotNull 14 | String chatId 15 | ) implements ApiMethodBoolean { 16 | 17 | public static @NotNull Builder ofBuilder(String chatId) { 18 | return new ExportChatInviteLink.Builder().chatId(chatId); 19 | } 20 | 21 | @Override 22 | public @NotNull String getEndpointURL() { 23 | return "exportChatInviteLink"; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/methods/GetAvailableGifts.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.methods; 2 | 3 | import lombok.Builder; 4 | import lombok.extern.jackson.Jacksonized; 5 | import org.jetbrains.annotations.NotNull; 6 | import org.teleight.teleightbots.api.ApiMethod; 7 | import org.teleight.teleightbots.api.objects.Gifts; 8 | import org.teleight.teleightbots.exception.exceptions.TelegramRequestException; 9 | 10 | @Builder(builderClassName = "Builder", toBuilder = true, builderMethodName = "ofBuilder") 11 | @Jacksonized 12 | public record GetAvailableGifts() implements ApiMethod { 13 | 14 | public static @NotNull Builder ofBuilder() { 15 | return new GetAvailableGifts.Builder(); 16 | } 17 | 18 | @Override 19 | public @NotNull String getEndpointURL() { 20 | return "getAvailableGifts"; 21 | } 22 | 23 | @Override 24 | public @NotNull Gifts deserializeResponse(@NotNull String answer) throws TelegramRequestException { 25 | return deserializeResponse(answer, Gifts.class); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/methods/GetForumTopicIconStickers.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.methods; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.teleight.teleightbots.api.ApiMethod; 5 | import org.teleight.teleightbots.api.objects.Sticker; 6 | import org.teleight.teleightbots.exception.exceptions.TelegramRequestException; 7 | 8 | public record GetForumTopicIconStickers() implements ApiMethod { 9 | 10 | @Override 11 | public @NotNull String getEndpointURL() { 12 | return "getForumTopicIconStickers"; 13 | } 14 | 15 | @Override 16 | public @NotNull Sticker @NotNull [] deserializeResponse(@NotNull String answer) throws TelegramRequestException { 17 | return deserializeResponseArray(answer, Sticker[].class); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/methods/GetMe.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.methods; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.teleight.teleightbots.api.ApiMethod; 5 | import org.teleight.teleightbots.api.objects.User; 6 | import org.teleight.teleightbots.exception.exceptions.TelegramRequestException; 7 | 8 | public record GetMe() implements ApiMethod { 9 | 10 | @Override 11 | public @NotNull String getEndpointURL() { 12 | return "getMe"; 13 | } 14 | 15 | @Override 16 | public @NotNull User deserializeResponse(@NotNull String answer) throws TelegramRequestException { 17 | return deserializeResponse(answer, User.class); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/methods/GetWebhookInfo.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.methods; 2 | 3 | import lombok.Builder; 4 | import lombok.extern.jackson.Jacksonized; 5 | import org.jetbrains.annotations.NotNull; 6 | import org.teleight.teleightbots.api.ApiMethod; 7 | import org.teleight.teleightbots.api.objects.WebhookInfo; 8 | import org.teleight.teleightbots.exception.exceptions.TelegramRequestException; 9 | 10 | @Builder(builderClassName = "Builder", toBuilder = true, builderMethodName = "ofBuilder") 11 | @Jacksonized 12 | public record GetWebhookInfo() implements ApiMethod { 13 | 14 | @Override 15 | public @NotNull String getEndpointURL() { 16 | return "getWebhookInfo"; 17 | } 18 | 19 | @Override 20 | public @NotNull WebhookInfo deserializeResponse(@NotNull String answer) throws TelegramRequestException { 21 | return deserializeResponse(answer, WebhookInfo.class); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/methods/HideGeneralForumTopic.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.methods; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Builder; 5 | import lombok.extern.jackson.Jacksonized; 6 | import org.jetbrains.annotations.NotNull; 7 | import org.teleight.teleightbots.api.ApiMethodBoolean; 8 | 9 | @Builder(builderClassName = "Builder", toBuilder = true, builderMethodName = "ofBuilder") 10 | @Jacksonized 11 | public record HideGeneralForumTopic( 12 | @JsonProperty(value = "chat_id", required = true) 13 | @NotNull 14 | String chatId 15 | ) implements ApiMethodBoolean { 16 | 17 | public static @NotNull Builder ofBuilder(String chatId) { 18 | return new HideGeneralForumTopic.Builder().chatId(chatId); 19 | } 20 | 21 | @Override 22 | public @NotNull String getEndpointURL() { 23 | return "hideGeneralForumTopic"; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/methods/LeaveChat.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.methods; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Builder; 5 | import lombok.extern.jackson.Jacksonized; 6 | import org.jetbrains.annotations.NotNull; 7 | import org.teleight.teleightbots.api.ApiMethodBoolean; 8 | 9 | @Builder(builderClassName = "Builder", toBuilder = true, builderMethodName = "ofBuilder") 10 | @Jacksonized 11 | public record LeaveChat( 12 | @JsonProperty(value = "chat_id", required = true) 13 | @NotNull 14 | String chatId 15 | ) implements ApiMethodBoolean { 16 | 17 | public static @NotNull Builder ofBuilder(String chatId) { 18 | return new LeaveChat.Builder().chatId(chatId); 19 | } 20 | 21 | @Override 22 | public @NotNull String getEndpointURL() { 23 | return "leaveChat"; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/methods/RemoveChatVerification.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.methods; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Builder; 5 | import lombok.extern.jackson.Jacksonized; 6 | import org.jetbrains.annotations.NotNull; 7 | import org.teleight.teleightbots.api.ApiMethodBoolean; 8 | 9 | @Builder(builderClassName = "Builder", toBuilder = true, builderMethodName = "ofBuilder") 10 | @Jacksonized 11 | public record RemoveChatVerification( 12 | @JsonProperty(value = "chat_id", required = true) 13 | @NotNull 14 | String chatId 15 | ) implements ApiMethodBoolean { 16 | 17 | public static @NotNull Builder ofBuilder(String chatId) { 18 | return new RemoveChatVerification.Builder().chatId(chatId); 19 | } 20 | 21 | @Override 22 | public @NotNull String getEndpointURL() { 23 | return "removeChatVerification"; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/methods/RemoveUserVerification.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.methods; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Builder; 5 | import lombok.extern.jackson.Jacksonized; 6 | import org.jetbrains.annotations.NotNull; 7 | import org.teleight.teleightbots.api.ApiMethodBoolean; 8 | 9 | @Builder(builderClassName = "Builder", toBuilder = true, builderMethodName = "ofBuilder") 10 | @Jacksonized 11 | public record RemoveUserVerification( 12 | @JsonProperty(value = "user_id", required = true) 13 | long userId 14 | ) implements ApiMethodBoolean { 15 | 16 | public static @NotNull Builder ofBuilder(long userId) { 17 | return new RemoveUserVerification.Builder().userId(userId); 18 | } 19 | 20 | @Override 21 | public @NotNull String getEndpointURL() { 22 | return "removeUserVerification"; 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/methods/ReopenGeneralForumTopic.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.methods; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Builder; 5 | import lombok.extern.jackson.Jacksonized; 6 | import org.jetbrains.annotations.NotNull; 7 | import org.teleight.teleightbots.api.ApiMethodBoolean; 8 | 9 | @Builder(builderClassName = "Builder", toBuilder = true, builderMethodName = "ofBuilder") 10 | @Jacksonized 11 | public record ReopenGeneralForumTopic( 12 | @JsonProperty(value = "chat_id", required = true) 13 | @NotNull 14 | String chatId 15 | ) implements ApiMethodBoolean { 16 | 17 | public static @NotNull Builder ofBuilder(String chatId) { 18 | return new ReopenGeneralForumTopic.Builder().chatId(chatId); 19 | } 20 | 21 | @Override 22 | public @NotNull String getEndpointURL() { 23 | return "reopenGeneralForumTopic"; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/methods/SetChatMenuButton.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.methods; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Builder; 5 | import lombok.extern.jackson.Jacksonized; 6 | import org.jetbrains.annotations.NotNull; 7 | import org.teleight.teleightbots.api.ApiMethodBoolean; 8 | import org.teleight.teleightbots.api.objects.MenuButton; 9 | 10 | @Builder(builderClassName = "Builder", toBuilder = true, builderMethodName = "ofBuilder") 11 | @Jacksonized 12 | public record SetChatMenuButton( 13 | @JsonProperty(value = "chat_id") 14 | String chatId, 15 | 16 | @JsonProperty(value = "menu_button") 17 | MenuButton menuButton 18 | ) implements ApiMethodBoolean { 19 | 20 | public static @NotNull Builder ofBuilder() { 21 | return new SetChatMenuButton.Builder(); 22 | } 23 | 24 | @Override 25 | public @NotNull String getEndpointURL() { 26 | return "setChatMenuButton"; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/methods/SetChatTitle.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.methods; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Builder; 5 | import lombok.extern.jackson.Jacksonized; 6 | import org.jetbrains.annotations.NotNull; 7 | import org.teleight.teleightbots.api.ApiMethodBoolean; 8 | 9 | @Builder(builderClassName = "Builder", toBuilder = true, builderMethodName = "ofBuilder") 10 | @Jacksonized 11 | public record SetChatTitle( 12 | @JsonProperty(value = "chat_id", required = true) 13 | @NotNull 14 | String chatId, 15 | 16 | @JsonProperty(value = "title", required = true) 17 | @NotNull 18 | String title 19 | ) implements ApiMethodBoolean { 20 | 21 | public static @NotNull Builder ofBuilder(String chatId, String title) { 22 | return new SetChatTitle.Builder().chatId(chatId).title(title); 23 | } 24 | 25 | @Override 26 | public @NotNull String getEndpointURL() { 27 | return "setChatTitle"; 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/methods/SetMyDefaultAdministratorRights.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.methods; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Builder; 5 | import lombok.extern.jackson.Jacksonized; 6 | import org.jetbrains.annotations.NotNull; 7 | import org.jetbrains.annotations.Nullable; 8 | import org.teleight.teleightbots.api.ApiMethodBoolean; 9 | import org.teleight.teleightbots.api.objects.ChatAdministratorRights; 10 | 11 | @Builder(builderClassName = "Builder", toBuilder = true, builderMethodName = "ofBuilder") 12 | @Jacksonized 13 | public record SetMyDefaultAdministratorRights( 14 | @JsonProperty(value = "rights") 15 | @Nullable 16 | ChatAdministratorRights rights, 17 | 18 | @JsonProperty(value = "for_channels") 19 | boolean forChannels 20 | ) implements ApiMethodBoolean { 21 | 22 | @Override 23 | public @NotNull String getEndpointURL() { 24 | return "setMyDefaultAdministratorRights"; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/methods/SetMyDescription.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.methods; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Builder; 5 | import lombok.extern.jackson.Jacksonized; 6 | import org.jetbrains.annotations.NotNull; 7 | import org.jetbrains.annotations.Nullable; 8 | import org.teleight.teleightbots.api.ApiMethodBoolean; 9 | 10 | @Builder(builderClassName = "Builder", toBuilder = true, builderMethodName = "ofBuilder") 11 | @Jacksonized 12 | public record SetMyDescription( 13 | @JsonProperty(value = "description") 14 | @Nullable 15 | String description, 16 | 17 | @JsonProperty(value = "language_code") 18 | @Nullable 19 | String languageCode 20 | ) implements ApiMethodBoolean { 21 | 22 | @Override 23 | public @NotNull String getEndpointURL() { 24 | return "setMyDescription"; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/methods/SetMyName.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.methods; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Builder; 5 | import lombok.extern.jackson.Jacksonized; 6 | import org.jetbrains.annotations.NotNull; 7 | import org.jetbrains.annotations.Nullable; 8 | import org.teleight.teleightbots.api.ApiMethodBoolean; 9 | 10 | @Builder(builderClassName = "Builder", toBuilder = true, builderMethodName = "ofBuilder") 11 | @Jacksonized 12 | public record SetMyName( 13 | @JsonProperty(value = "name") 14 | @Nullable 15 | String name, 16 | 17 | @JsonProperty(value = "language_code") 18 | @Nullable 19 | String languageCode 20 | ) implements ApiMethodBoolean { 21 | 22 | @Override 23 | public @NotNull String getEndpointURL() { 24 | return "setMyName"; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/methods/SetMyShortDescription.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.methods; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Builder; 5 | import lombok.extern.jackson.Jacksonized; 6 | import org.jetbrains.annotations.NotNull; 7 | import org.jetbrains.annotations.Nullable; 8 | import org.teleight.teleightbots.api.ApiMethodBoolean; 9 | 10 | @Builder(builderClassName = "Builder", toBuilder = true, builderMethodName = "ofBuilder") 11 | @Jacksonized 12 | public record SetMyShortDescription( 13 | @JsonProperty(value = "short_description") 14 | @Nullable 15 | String shortDescription, 16 | 17 | @JsonProperty(value = "language_code") 18 | @Nullable 19 | String languageCode 20 | ) implements ApiMethodBoolean { 21 | 22 | @Override 23 | public @NotNull String getEndpointURL() { 24 | return "setMyShortDescription"; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/methods/SetPassportDataErrors.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.methods; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Builder; 5 | import lombok.extern.jackson.Jacksonized; 6 | import org.jetbrains.annotations.NotNull; 7 | import org.teleight.teleightbots.api.ApiMethodBoolean; 8 | import org.teleight.teleightbots.api.objects.PassportElementError; 9 | 10 | @Builder(builderClassName = "Builder", toBuilder = true, builderMethodName = "ofBuilder") 11 | @Jacksonized 12 | public record SetPassportDataErrors( 13 | @JsonProperty(value = "user_id", required = true) 14 | long userId, 15 | 16 | @JsonProperty(value = "errors", required = true) 17 | @NotNull 18 | PassportElementError[] errors 19 | ) implements ApiMethodBoolean { 20 | 21 | @Override 22 | public @NotNull String getEndpointURL() { 23 | return "setPassportDataErrors"; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/methods/SetStickerSetTitle.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.methods; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Builder; 5 | import lombok.extern.jackson.Jacksonized; 6 | import org.jetbrains.annotations.NotNull; 7 | import org.teleight.teleightbots.api.ApiMethodBoolean; 8 | 9 | @Builder(builderClassName = "Builder", toBuilder = true, builderMethodName = "ofBuilder") 10 | @Jacksonized 11 | public record SetStickerSetTitle( 12 | @JsonProperty(value = "name", required = true) 13 | @NotNull 14 | String name, 15 | 16 | @JsonProperty(value = "title", required = true) 17 | @NotNull 18 | String title 19 | ) implements ApiMethodBoolean { 20 | 21 | public static @NotNull Builder ofBuilder(String name, String title) { 22 | return new SetStickerSetTitle.Builder().name(name).title(title); 23 | } 24 | 25 | @Override 26 | public @NotNull String getEndpointURL() { 27 | return "setStickerSetTitle"; 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/methods/UnhideGeneralForumTopic.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.methods; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Builder; 5 | import lombok.extern.jackson.Jacksonized; 6 | import org.jetbrains.annotations.NotNull; 7 | import org.teleight.teleightbots.api.ApiMethodBoolean; 8 | 9 | @Builder(builderClassName = "Builder", toBuilder = true, builderMethodName = "ofBuilder") 10 | @Jacksonized 11 | public record UnhideGeneralForumTopic( 12 | @JsonProperty(value = "chat_id", required = true) 13 | @NotNull 14 | String chatId 15 | ) implements ApiMethodBoolean { 16 | 17 | public static @NotNull Builder ofBuilder(String chatId) { 18 | return new UnhideGeneralForumTopic.Builder().chatId(chatId); 19 | } 20 | 21 | @Override 22 | public @NotNull String getEndpointURL() { 23 | return "unhideGeneralForumTopic"; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/methods/UnpinAllChatMessages.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.methods; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Builder; 5 | import lombok.extern.jackson.Jacksonized; 6 | import org.jetbrains.annotations.NotNull; 7 | import org.teleight.teleightbots.api.ApiMethodBoolean; 8 | 9 | @Builder(builderClassName = "Builder", toBuilder = true, builderMethodName = "ofBuilder") 10 | @Jacksonized 11 | public record UnpinAllChatMessages( 12 | @JsonProperty(value = "chat_id", required = true) 13 | @NotNull 14 | String chatId 15 | ) implements ApiMethodBoolean { 16 | 17 | public static @NotNull Builder ofBuilder(String chatId) { 18 | return new UnpinAllChatMessages.Builder().chatId(chatId); 19 | } 20 | 21 | @Override 22 | public @NotNull String getEndpointURL() { 23 | return "unpinAllChatMessages"; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/methods/UnpinAllGeneralForumTopicMessages.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.methods; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Builder; 5 | import lombok.extern.jackson.Jacksonized; 6 | import org.jetbrains.annotations.NotNull; 7 | import org.teleight.teleightbots.api.ApiMethodBoolean; 8 | 9 | @Builder(builderClassName = "Builder", toBuilder = true, builderMethodName = "ofBuilder") 10 | @Jacksonized 11 | public record UnpinAllGeneralForumTopicMessages( 12 | @JsonProperty(value = "chat_id", required = true) 13 | @NotNull 14 | String chatId 15 | ) implements ApiMethodBoolean { 16 | 17 | public static @NotNull Builder ofBuilder(String chatId) { 18 | return new UnpinAllGeneralForumTopicMessages.Builder().chatId(chatId); 19 | } 20 | 21 | @Override 22 | public @NotNull String getEndpointURL() { 23 | return "unpinAllGeneralForumTopicMessages"; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/methods/VerifyUser.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.methods; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Builder; 5 | import lombok.extern.jackson.Jacksonized; 6 | import org.jetbrains.annotations.NotNull; 7 | import org.jetbrains.annotations.Nullable; 8 | import org.teleight.teleightbots.api.ApiMethodBoolean; 9 | 10 | @Builder(builderClassName = "Builder", toBuilder = true, builderMethodName = "ofBuilder") 11 | @Jacksonized 12 | public record VerifyUser( 13 | @JsonProperty(value = "user_id", required = true) 14 | long userId, 15 | 16 | @JsonProperty(value = "custom_description") 17 | @Nullable 18 | String customDescription // 0-70 characters 19 | ) implements ApiMethodBoolean { 20 | 21 | public static @NotNull Builder ofBuilder(long userId) { 22 | return new VerifyUser.Builder().userId(userId); 23 | } 24 | 25 | @Override 26 | public @NotNull String getEndpointURL() { 27 | return "verifyUser"; 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/AcceptedGiftTypes.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Builder; 5 | import lombok.extern.jackson.Jacksonized; 6 | import org.teleight.teleightbots.api.ApiResult; 7 | 8 | @Builder(builderClassName = "Builder", toBuilder = true, builderMethodName = "ofBuilder") 9 | @Jacksonized 10 | public record AcceptedGiftTypes( 11 | @JsonProperty(value = "unlimited_gifts", required = true) 12 | boolean unlimitedGifts, 13 | 14 | @JsonProperty(value = "limited_gifts", required = true) 15 | boolean limitedGifts, 16 | 17 | @JsonProperty(value = "unique_gifts", required = true) 18 | boolean uniqueGifts, 19 | 20 | @JsonProperty(value = "premium_subscription", required = true) 21 | boolean premiumSubscription 22 | ) implements ApiResult { 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/AffiliateInfo.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.Nullable; 5 | import org.jetbrains.annotations.Range; 6 | import org.teleight.teleightbots.api.ApiResult; 7 | 8 | public record AffiliateInfo( 9 | @JsonProperty(value = "affiliate_user") 10 | @Nullable 11 | User affiliateUser, 12 | 13 | @JsonProperty(value = "affiliate_chat") 14 | @Nullable 15 | Chat affiliateChat, 16 | 17 | @JsonProperty(value = "commission_per_mille", required = true) 18 | int commissionPerMille, 19 | 20 | @JsonProperty(value = "amount", required = true) 21 | int amount, 22 | 23 | @JsonProperty(value = "nanostar_amount") 24 | @Range(from = -999_999_999, to = 999_999_999) 25 | int nanostarAmount 26 | ) implements ApiResult { 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/ApiResponse.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.teleight.teleightbots.api.ApiResult; 5 | 6 | public record ApiResponse( 7 | @JsonProperty(value = "ok") 8 | boolean ok, 9 | 10 | @JsonProperty(value = "error_code") 11 | int errorCode, 12 | 13 | @JsonProperty(value = "description") 14 | String errorDescription, 15 | 16 | @JsonProperty(value = "parameters") 17 | ResponseParameters parameters, 18 | 19 | @JsonProperty(value = "result") 20 | T result 21 | ) implements ApiResult { 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/BackgroundFillFreeformGradient.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | import java.awt.Color; 7 | 8 | public record BackgroundFillFreeformGradient( 9 | @JsonProperty(value = "colors", required = true) 10 | @NotNull 11 | Color[] colors 12 | ) implements BackgroundFill { 13 | 14 | @Override 15 | public String type() { 16 | return "freeform_gradient"; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/BackgroundFillGradient.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.checkerframework.common.value.qual.IntRange; 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | import java.awt.Color; 8 | 9 | public record BackgroundFillGradient( 10 | @JsonProperty(value = "top_color", required = true) 11 | @NotNull 12 | Color topColor, 13 | 14 | @JsonProperty(value = "bottom_color", required = true) 15 | @NotNull 16 | Color bottomColor, 17 | 18 | @JsonProperty(value = "rotation_angle", required = true) 19 | @IntRange(from = 0, to = 359) 20 | int rotationAngle 21 | ) implements BackgroundFill { 22 | 23 | @Override 24 | public String type() { 25 | return "gradient"; 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/BackgroundFillSolid.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | import java.awt.Color; 7 | 8 | public record BackgroundFillSolid( 9 | @JsonProperty(value = "color", required = true) 10 | @NotNull 11 | Color color 12 | ) implements BackgroundFill { 13 | 14 | @Override 15 | public String type() { 16 | return "solid"; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/BackgroundTypeChatTheme.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | public record BackgroundTypeChatTheme( 7 | @JsonProperty(value = "theme_name", required = true) 8 | @NotNull 9 | String themeName 10 | ) implements BackgroundType { 11 | 12 | @Override 13 | public String type() { 14 | return "chat_theme"; 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/BackgroundTypeFill.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.checkerframework.common.value.qual.IntRange; 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | public record BackgroundTypeFill( 8 | @JsonProperty(value = "fill", required = true) 9 | @NotNull 10 | BackgroundFill fill, 11 | 12 | @JsonProperty(value = "dark_theme_dimming", required = true) 13 | @IntRange(from = 0, to = 100) 14 | int darkThemeDimming 15 | ) implements BackgroundType { 16 | 17 | @Override 18 | public String type() { 19 | return "fill"; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/BackgroundTypePattern.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.checkerframework.common.value.qual.IntRange; 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | public record BackgroundTypePattern( 8 | @JsonProperty(value = "document", required = true) 9 | @NotNull 10 | Document document, 11 | 12 | @JsonProperty(value = "fill", required = true) 13 | @NotNull 14 | BackgroundFill fill, 15 | 16 | @JsonProperty(value = "intensity", required = true) 17 | @IntRange(from = 0, to = 100) 18 | int intensity, 19 | 20 | @JsonProperty(value = "is_inverted") 21 | boolean isInverted, 22 | 23 | @JsonProperty(value = "is_moving") 24 | boolean isMoving 25 | ) implements BackgroundType { 26 | 27 | @Override 28 | public String type() { 29 | return "pattern"; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/BackgroundTypeWallpaper.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.checkerframework.common.value.qual.IntRange; 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | public record BackgroundTypeWallpaper( 8 | @JsonProperty(value = "document", required = true) 9 | @NotNull 10 | Document document, 11 | 12 | @JsonProperty(value = "dark_theme_dimming", required = true) 13 | @IntRange(from = 0, to = 100) 14 | int darkThemeDimming, 15 | 16 | @JsonProperty(value = "is_blurred") 17 | boolean isBlurred, 18 | 19 | @JsonProperty(value = "is_moving") 20 | boolean isMoving 21 | ) implements BackgroundType { 22 | 23 | @Override 24 | public String type() { 25 | return "wallpaper"; 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/Birthdate.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.teleight.teleightbots.api.ApiResult; 5 | 6 | public record Birthdate( 7 | @JsonProperty(value = "day", required = true) 8 | int day, 9 | 10 | @JsonProperty(value = "month", required = true) 11 | int month, 12 | 13 | @JsonProperty(value = "year") 14 | int year 15 | ) implements ApiResult { 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/BotCommand.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.teleight.teleightbots.api.ApiResult; 5 | 6 | public record BotCommand( 7 | @JsonProperty(value = "command", required = true) 8 | String command, 9 | 10 | @JsonProperty(value = "description", required = true) 11 | String description 12 | ) implements ApiResult { 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/BotCommandScopeAllChatAdministrators.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | public record BotCommandScopeAllChatAdministrators() implements BotCommandScope { 6 | 7 | @Override 8 | public @NotNull String type() { 9 | return "all_chat_administrators"; 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/BotCommandScopeAllGroupChats.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | public record BotCommandScopeAllGroupChats() implements BotCommandScope { 6 | 7 | @Override 8 | public @NotNull String type() { 9 | return "all_group_chats"; 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/BotCommandScopeAllPrivateChats.java: -------------------------------------------------------------------------------- 1 | 2 | package org.teleight.teleightbots.api.objects; 3 | 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | public record BotCommandScopeAllPrivateChats() implements BotCommandScope { 7 | 8 | @Override 9 | public @NotNull String type() { 10 | return "all_private_chats"; 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/BotCommandScopeChat.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | public record BotCommandScopeChat( 7 | @JsonProperty(value = "chat_id", required = true) 8 | @NotNull 9 | String chatId 10 | ) implements BotCommandScope { 11 | 12 | @Override 13 | public @NotNull String type() { 14 | return "chat"; 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/BotCommandScopeChatAdministrators.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | public record BotCommandScopeChatAdministrators( 7 | @JsonProperty(value = "chat_id", required = true) 8 | @NotNull 9 | String chatId 10 | ) implements BotCommandScope { 11 | 12 | @Override 13 | public @NotNull String type() { 14 | return "chat_administrators"; 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/BotCommandScopeChatMember.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | public record BotCommandScopeChatMember( 7 | @JsonProperty(value = "chat_id", required = true) 8 | @NotNull 9 | String chatId, 10 | 11 | @JsonProperty(value = "user_id", required = true) 12 | int userId 13 | ) implements BotCommandScope { 14 | 15 | @Override 16 | public @NotNull String type() { 17 | return "chat_member"; 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/BotCommandScopeDefault.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | public record BotCommandScopeDefault() implements BotCommandScope { 6 | 7 | @Override 8 | public @NotNull String type() { 9 | return "default"; 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/BotDescription.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.teleight.teleightbots.api.ApiResult; 5 | 6 | public record BotDescription( 7 | @JsonProperty(value = "description", required = true) 8 | String description 9 | ) implements ApiResult { 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/BotName.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.teleight.teleightbots.api.ApiResult; 5 | 6 | public record BotName( 7 | @JsonProperty(value = "name", required = true) 8 | String name 9 | ) implements ApiResult { 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/BotShortDescription.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.teleight.teleightbots.api.ApiResult; 5 | 6 | public record BotShortDescription( 7 | @JsonProperty(value = "short_description", required = true) 8 | String shortDescription 9 | ) implements ApiResult { 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/BusinessConnection.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | import org.jetbrains.annotations.Nullable; 6 | import org.teleight.teleightbots.api.ApiResult; 7 | 8 | public record BusinessConnection( 9 | @JsonProperty(value = "id", required = true) 10 | @NotNull 11 | String id, 12 | 13 | @JsonProperty(value = "user", required = true) 14 | @NotNull 15 | User user, 16 | 17 | @JsonProperty(value = "user_chat_id", required = true) 18 | @NotNull 19 | Long userChatId, 20 | 21 | @JsonProperty(value = "date", required = true) 22 | int date, 23 | 24 | @JsonProperty(value = "rights") 25 | @Nullable 26 | BusinessBotRights rights, 27 | 28 | @JsonProperty(value = "is_enabled", required = true) 29 | boolean isEnabled 30 | ) implements ApiResult { 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/BusinessIntro.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.Nullable; 5 | import org.teleight.teleightbots.api.ApiResult; 6 | 7 | public record BusinessIntro( 8 | @JsonProperty(value = "title") 9 | @Nullable 10 | String title, 11 | 12 | @JsonProperty(value = "message") 13 | @Nullable 14 | String message, 15 | 16 | @JsonProperty(value = "sticker") 17 | @Nullable 18 | Sticker sticker 19 | ) implements ApiResult { 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/BusinessLocation.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | import org.jetbrains.annotations.Nullable; 6 | import org.teleight.teleightbots.api.ApiResult; 7 | 8 | public record BusinessLocation( 9 | @JsonProperty(value = "address", required = true) 10 | @NotNull 11 | String address, 12 | 13 | @JsonProperty(value = "location") 14 | @Nullable 15 | Location location 16 | ) implements ApiResult { 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/BusinessMessagesDeleted.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | import org.teleight.teleightbots.api.ApiResult; 6 | 7 | public record BusinessMessagesDeleted( 8 | @JsonProperty(value = "business_connection_id", required = true) 9 | @NotNull 10 | String businessConnectionId, 11 | 12 | @JsonProperty(value = "chat", required = true) 13 | @NotNull 14 | Chat chat, 15 | 16 | @JsonProperty(value = "message_ids", required = true) 17 | @NotNull 18 | Integer[] messageIds 19 | ) implements ApiResult { 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/BusinessOpeningHours.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | import org.teleight.teleightbots.api.ApiResult; 6 | 7 | public record BusinessOpeningHours( 8 | @JsonProperty(value = "time_zone_name", required = true) 9 | @NotNull 10 | String timeZoneName, 11 | 12 | @JsonProperty(value = "opening_hours", required = true) 13 | @NotNull 14 | BusinessOpeningHoursInterval[] openingHours 15 | ) implements ApiResult { 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/BusinessOpeningHoursInterval.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.Range; 5 | import org.teleight.teleightbots.api.ApiResult; 6 | 7 | public record BusinessOpeningHoursInterval( 8 | @JsonProperty(value = "opening_minute", required = true) 9 | @Range(from = 0, to = 7 * 24 * 60) 10 | int openingMinute, 11 | 12 | @JsonProperty(value = "closing_minute", required = true) 13 | @Range(from = 0, to = 8 * 24 * 60) 14 | int closingMinute 15 | ) implements ApiResult { 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/CallbackGame.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import org.teleight.teleightbots.api.ApiResult; 4 | 5 | public record CallbackGame() implements ApiResult { 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/ChatBackground.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | import org.teleight.teleightbots.api.ApiResult; 6 | 7 | public record ChatBackground( 8 | @JsonProperty(value = "type", required = true) 9 | @NotNull 10 | BackgroundType type 11 | ) implements ApiResult { 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/ChatBoost.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | import org.teleight.teleightbots.api.ApiResult; 6 | 7 | import java.util.Date; 8 | 9 | public record ChatBoost( 10 | @JsonProperty(value = "boost_id", required = true) 11 | @NotNull 12 | String boostId, 13 | 14 | @JsonProperty(value = "add_date", required = true) 15 | @NotNull 16 | Date addDate, 17 | 18 | @JsonProperty(value = "expiration_date", required = true) 19 | @NotNull 20 | Date expirationDate, 21 | 22 | @JsonProperty(value = "source", required = true) 23 | @NotNull 24 | ChatBoostSource source 25 | ) implements ApiResult { 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/ChatBoostAdded.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.teleight.teleightbots.api.ApiResult; 5 | 6 | public record ChatBoostAdded( 7 | @JsonProperty(value = "boost_count", required = true) 8 | int boostCount 9 | ) implements ApiResult { 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/ChatBoostRemoved.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | import org.teleight.teleightbots.api.ApiResult; 6 | 7 | import java.util.Date; 8 | 9 | public record ChatBoostRemoved( 10 | @JsonProperty(value = "chat", required = true) 11 | @NotNull 12 | Chat chat, 13 | 14 | @JsonProperty(value = "boost_id", required = true) 15 | @NotNull 16 | String boostId, 17 | 18 | @JsonProperty(value = "remove_date", required = true) 19 | @NotNull 20 | Date removeDate, 21 | 22 | @JsonProperty(value = "source", required = true) 23 | @NotNull 24 | ChatBoostSource source 25 | ) implements ApiResult { 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/ChatBoostSourceGiftCode.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | public record ChatBoostSourceGiftCode( 7 | @JsonProperty(value = "user", required = true) 8 | @NotNull 9 | User user 10 | ) implements ChatBoostSource { 11 | 12 | @Override 13 | public String source() { 14 | return "gift_code"; 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/ChatBoostSourceGiveaway.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.Nullable; 5 | 6 | public record ChatBoostSourceGiveaway( 7 | @JsonProperty(value = "giveaway_message_id", required = true) 8 | int giveawayMessageId, 9 | 10 | @JsonProperty(value = "user") 11 | @Nullable 12 | User user, 13 | 14 | @JsonProperty(value = "prize_star_count") 15 | int prizeStarCount, 16 | 17 | @JsonProperty(value = "is_unclaimed") 18 | boolean isUnclaimed 19 | ) implements ChatBoostSource { 20 | 21 | @Override 22 | public String source() { 23 | return "giveaway"; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/ChatBoostSourcePremium.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | public record ChatBoostSourcePremium( 7 | @JsonProperty(value = "user", required = true) 8 | @NotNull 9 | User user 10 | ) implements ChatBoostSource { 11 | 12 | @Override 13 | public String source() { 14 | return "premium"; 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/ChatBoostUpdated.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | import org.teleight.teleightbots.api.ApiResult; 6 | 7 | public record ChatBoostUpdated( 8 | @JsonProperty(value = "chat", required = true) 9 | @NotNull 10 | Chat chat, 11 | 12 | @JsonProperty(value = "boost", required = true) 13 | @NotNull 14 | ChatBoost boost 15 | ) implements ApiResult { 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/ChatJoinRequest.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.Nullable; 5 | import org.teleight.teleightbots.api.ApiResult; 6 | import org.teleight.teleightbots.api.objects.User; 7 | 8 | import java.util.Date; 9 | 10 | public record ChatJoinRequest( 11 | @JsonProperty(value = "chat", required = true) 12 | Chat chat, 13 | 14 | @JsonProperty(value = "from", required = true) 15 | User from, 16 | 17 | @JsonProperty(value = "user_chat_id", required = true) 18 | Long userChatId, 19 | 20 | @JsonProperty(value = "date", required = true) 21 | Date date, 22 | 23 | @JsonProperty(value = "bio") 24 | @Nullable 25 | String bio, 26 | 27 | @JsonProperty(value = "invite_link") 28 | @Nullable 29 | ChatInviteLink inviteLink 30 | ) implements ApiResult { 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/ChatLocation.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.teleight.teleightbots.api.ApiResult; 5 | import org.teleight.teleightbots.api.objects.Location; 6 | 7 | public record ChatLocation( 8 | @JsonProperty(value = "location", required = true) 9 | Location location, 10 | 11 | @JsonProperty(value = "address", required = true) 12 | String address 13 | ) implements ApiResult { 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/ChatMemberBanned.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | 5 | public record ChatMemberBanned( 6 | @JsonProperty(value = "user") 7 | User user, 8 | 9 | @JsonProperty(value = "until_date") 10 | int untilDate 11 | ) implements ChatMember { 12 | 13 | @Override 14 | public String status() { 15 | return "kicked"; 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/ChatMemberLeft.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | 5 | public record ChatMemberLeft( 6 | @JsonProperty(value = "user") 7 | User user 8 | ) implements ChatMember { 9 | 10 | @Override 11 | public String status() { 12 | return "left"; 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/ChatMemberMember.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | import java.util.Date; 7 | 8 | public record ChatMemberMember( 9 | @JsonProperty(value = "user", required = true) 10 | @NotNull 11 | User user, 12 | 13 | @JsonProperty(value = "until_date") 14 | @NotNull 15 | Date untilDate 16 | ) implements ChatMember { 17 | 18 | @Override 19 | public String status() { 20 | return "member"; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/ChatMemberOwner.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.Nullable; 5 | 6 | public record ChatMemberOwner( 7 | @JsonProperty(value = "user") 8 | User user, 9 | 10 | @JsonProperty(value = "is_anonymous") 11 | boolean isAnonymous, 12 | 13 | @JsonProperty(value = "custom_title") 14 | @Nullable 15 | String customTitle 16 | ) implements ChatMember { 17 | 18 | @Override 19 | public String status() { 20 | return "creator"; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/ChatPhoto.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.teleight.teleightbots.api.ApiResult; 5 | 6 | public record ChatPhoto( 7 | @JsonProperty(value = "small_file_id", required = true) 8 | String smallFileId, 9 | 10 | @JsonProperty(value = "small_file_unique_id", required = true) 11 | String smallFileUniqueId, 12 | 13 | @JsonProperty(value = "big_file_id", required = true) 14 | String bigFileId, 15 | 16 | @JsonProperty(value = "big_file_unique_id", required = true) 17 | String bigFileUniqueId 18 | ) implements ApiResult { 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/ChatShared.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | import org.jetbrains.annotations.Nullable; 6 | import org.teleight.teleightbots.api.ApiResult; 7 | 8 | public record ChatShared( 9 | @JsonProperty(value = "request_id", required = true) 10 | int requestId, 11 | 12 | @JsonProperty(value = "chat_id", required = true) 13 | @NotNull 14 | String chatId, 15 | 16 | @JsonProperty(value = "title") 17 | @Nullable 18 | String title, 19 | 20 | @JsonProperty(value = "username") 21 | @Nullable 22 | String username, 23 | 24 | @JsonProperty(value = "photo") 25 | @Nullable 26 | PhotoSize[] photo 27 | ) implements ApiResult { 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/ChosenInlineResult.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.Nullable; 5 | import org.teleight.teleightbots.api.ApiResult; 6 | import org.teleight.teleightbots.api.objects.Location; 7 | import org.teleight.teleightbots.api.objects.User; 8 | 9 | public record ChosenInlineResult( 10 | @JsonProperty(value = "result_id", required = true) 11 | String resultId, 12 | 13 | @JsonProperty(value = "from", required = true) 14 | User from, 15 | 16 | @JsonProperty(value = "location") 17 | @Nullable 18 | Location location, 19 | 20 | @JsonProperty(value = "inline_message_id") 21 | @Nullable 22 | String inlineMessageId, 23 | 24 | @JsonProperty(value = "query", required = true) 25 | String query 26 | ) implements ApiResult { 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/Contact.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.Nullable; 5 | import org.teleight.teleightbots.api.ApiResult; 6 | 7 | public record Contact( 8 | @JsonProperty(value = "phone_number", required = true) 9 | String phoneNumber, 10 | 11 | @JsonProperty(value = "first_name", required = true) 12 | String firstName, 13 | 14 | @JsonProperty(value = "last_name") 15 | @Nullable 16 | String lastName, 17 | 18 | @JsonProperty(value = "user_id") 19 | long userId, 20 | 21 | @JsonProperty(value = "vcard") 22 | @Nullable 23 | String vcard 24 | ) implements ApiResult { 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/Dice.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.teleight.teleightbots.api.ApiResult; 5 | 6 | public record Dice( 7 | @JsonProperty(value = "emoji", required = true) 8 | String emoji, 9 | 10 | @JsonProperty(value = "value", required = true) 11 | int value 12 | ) implements ApiResult { 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/Document.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.Nullable; 5 | import org.teleight.teleightbots.api.ApiResult; 6 | 7 | public record Document( 8 | @JsonProperty(value = "file_id", required = true) 9 | String fileId, 10 | 11 | @JsonProperty(value = "file_unique_id", required = true) 12 | String fileUniqueId, 13 | 14 | @JsonProperty(value = "thumbnail") 15 | @Nullable 16 | PhotoSize thumbnail, 17 | 18 | @JsonProperty(value = "file_name") 19 | @Nullable 20 | String fileName, 21 | 22 | @JsonProperty(value = "mime_type") 23 | @Nullable 24 | String mimeType, 25 | 26 | @JsonProperty(value = "file_size") 27 | @Nullable 28 | Long fileSize 29 | ) implements ApiResult { 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/EncryptedCredentials.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.teleight.teleightbots.api.ApiResult; 5 | 6 | public record EncryptedCredentials( 7 | @JsonProperty(value = "data", required = true) 8 | String data, 9 | 10 | @JsonProperty(value = "hash", required = true) 11 | String hash, 12 | 13 | @JsonProperty(value = "secret", required = true) 14 | String secret 15 | ) implements ApiResult { 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/File.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.Nullable; 5 | import org.teleight.teleightbots.api.ApiResult; 6 | 7 | public record File( 8 | @JsonProperty(value = "file_id", required = true) 9 | String fileId, 10 | 11 | @JsonProperty(value = "file_unique_id", required = true) 12 | String fileUniqueId, 13 | 14 | @JsonProperty(value = "file_size") 15 | @Nullable 16 | Long fileSize, 17 | 18 | /// Use https://api.telegram.org/file/bot/ to get the file. 19 | @JsonProperty(value = "file_path") 20 | @Nullable 21 | String filePath 22 | ) implements ApiResult { 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/ForceReplyKeyboard.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Builder; 5 | import lombok.extern.jackson.Jacksonized; 6 | import org.jetbrains.annotations.Nullable; 7 | 8 | @Builder(builderClassName = "Builder", toBuilder = true, builderMethodName = "ofBuilder") 9 | @Jacksonized 10 | public record ForceReplyKeyboard( 11 | @JsonProperty(value = "force_reply", required = true) 12 | boolean forceReply, 13 | 14 | @JsonProperty(value = "input_field_placeholder") 15 | @Nullable 16 | String inputFieldPlaceholder, 17 | 18 | @JsonProperty(value = "selective") 19 | boolean selective 20 | ) implements ReplyKeyboard { 21 | 22 | public Builder ofBuilder(boolean forceReply) { 23 | return new ForceReplyKeyboard.Builder().forceReply(forceReply); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/ForumTopicClosed.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import org.teleight.teleightbots.api.ApiResult; 4 | 5 | public record ForumTopicClosed() implements ApiResult { 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/ForumTopicCreated.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.Nullable; 5 | import org.teleight.teleightbots.api.ApiResult; 6 | 7 | public record ForumTopicCreated( 8 | @JsonProperty(value = "name", required = true) 9 | String name, 10 | 11 | @JsonProperty(value = "icon_color", required = true) 12 | int description, 13 | 14 | @JsonProperty(value = "icon_custom_emoji_id") 15 | @Nullable 16 | String iconCustomEmojiId 17 | ) implements ApiResult { 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/ForumTopicEdited.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.Nullable; 5 | import org.teleight.teleightbots.api.ApiResult; 6 | 7 | public record ForumTopicEdited( 8 | @JsonProperty(value = "name") 9 | @Nullable 10 | String name, 11 | 12 | @JsonProperty(value = "icon_custom_emoji_id") 13 | @Nullable 14 | String iconCustomEmojiId 15 | ) implements ApiResult { 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/ForumTopicReopened.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import org.teleight.teleightbots.api.ApiResult; 4 | 5 | public record ForumTopicReopened() implements ApiResult { 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/Game.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.Nullable; 5 | import org.teleight.teleightbots.api.ApiResult; 6 | 7 | public record Game( 8 | @JsonProperty(value = "title", required = true) 9 | String title, 10 | 11 | @JsonProperty(value = "description", required = true) 12 | String description, 13 | 14 | @JsonProperty(value = "photo", required = true) 15 | PhotoSize[] photo, 16 | 17 | @JsonProperty(value = "text") 18 | @Nullable 19 | String text, 20 | 21 | @JsonProperty(value = "text_entities") 22 | @Nullable 23 | MessageEntity[] textEntities, 24 | 25 | @JsonProperty(value = "animation") 26 | @Nullable 27 | Animation animation 28 | ) implements ApiResult { 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/GameHighScore.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | import org.teleight.teleightbots.api.ApiResult; 6 | 7 | public record GameHighScore( 8 | @JsonProperty(value = "position", required = true) 9 | int position, 10 | 11 | @JsonProperty(value = "user", required = true) 12 | @NotNull 13 | User user, 14 | 15 | @JsonProperty(value = "score", required = true) 16 | int score 17 | ) implements ApiResult { 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/GeneralForumTopicHidden.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import org.teleight.teleightbots.api.ApiResult; 4 | 5 | public record GeneralForumTopicHidden() implements ApiResult { 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/GeneralForumTopicUnhidden.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import org.teleight.teleightbots.api.ApiResult; 4 | 5 | public record GeneralForumTopicUnhidden() implements ApiResult { 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/Gift.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | import org.teleight.teleightbots.api.ApiResult; 6 | 7 | public record Gift( 8 | @JsonProperty(value = "id", required = true) 9 | @NotNull 10 | String id, 11 | 12 | @JsonProperty(value = "sticker", required = true) 13 | @NotNull 14 | Sticker sticker, 15 | 16 | @JsonProperty(value = "star_count", required = true) 17 | int starCount, 18 | 19 | @JsonProperty(value = "upgrade_star_count") 20 | int upgradeStarCount, 21 | 22 | @JsonProperty(value = "total_count") 23 | int totalCount, 24 | 25 | @JsonProperty(value = "remaining_count") 26 | int remainingCount 27 | ) implements ApiResult { 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/Gifts.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | import org.teleight.teleightbots.api.ApiResult; 6 | 7 | public record Gifts( 8 | @JsonProperty(value = "gifts", required = true) 9 | @NotNull 10 | Gift[] gifts 11 | ) implements ApiResult { 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/GiveawayCompleted.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.Nullable; 5 | import org.teleight.teleightbots.api.ApiResult; 6 | 7 | public record GiveawayCompleted( 8 | @JsonProperty(value = "winner_count", required = true) 9 | int winnerCount, 10 | 11 | @JsonProperty(value = "unclaimed_prize_count") 12 | int unclaimedPrizeCount, 13 | 14 | @JsonProperty(value = "giveaway_message") 15 | @Nullable 16 | Message giveawayMessage, 17 | 18 | @JsonProperty(value = "is_star_giveaway") 19 | boolean isStarGiveaway 20 | ) implements ApiResult { 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/GiveawayCreated.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.teleight.teleightbots.api.ApiResult; 5 | 6 | public record GiveawayCreated( 7 | @JsonProperty(value = "prize_star_count") 8 | int prizeStarCount 9 | ) implements ApiResult { 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/InaccessibleMessage.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | import java.util.Date; 7 | 8 | public record InaccessibleMessage( 9 | @JsonProperty(value = "chat", required = true) 10 | @NotNull 11 | Chat chat, 12 | 13 | @JsonProperty(value = "message_id", required = true) 14 | int messageId, 15 | 16 | @JsonProperty(value = "date", required = true, defaultValue = "0") 17 | Date date 18 | ) implements MaybeInaccessibleMessage { 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/InlineKeyboardMarkup.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Builder; 5 | import lombok.extern.jackson.Jacksonized; 6 | import org.jetbrains.annotations.NotNull; 7 | 8 | @Builder(builderClassName = "Builder", toBuilder = true, builderMethodName = "ofBuilder") 9 | @Jacksonized 10 | public record InlineKeyboardMarkup( 11 | @JsonProperty(value = "inline_keyboard", required = true) 12 | @NotNull 13 | InlineKeyboardButton[][] keyboard 14 | ) implements ReplyKeyboard { 15 | 16 | public Builder ofBuilder(InlineKeyboardButton[][] keyboard) { 17 | return new InlineKeyboardMarkup.Builder().keyboard(keyboard); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/InlineQuery.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.Nullable; 5 | import org.teleight.teleightbots.api.ApiResult; 6 | 7 | public record InlineQuery( 8 | @JsonProperty(value = "id", required = true) 9 | String id, 10 | 11 | @JsonProperty(value = "from", required = true) 12 | User from, 13 | 14 | @JsonProperty(value = "query", required = true) 15 | String query, 16 | 17 | @JsonProperty(value = "offset", required = true) 18 | String offset, 19 | 20 | @JsonProperty(value = "chat_type") 21 | @Nullable 22 | String chatType, 23 | 24 | @JsonProperty(value = "location") 25 | @Nullable 26 | Location location 27 | ) implements ApiResult { 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultCachedSticker.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | import org.jetbrains.annotations.Nullable; 6 | 7 | public record InlineQueryResultCachedSticker( 8 | @JsonProperty(value = "id", required = true) 9 | @NotNull 10 | String id, 11 | 12 | @JsonProperty(value = "sticker_file_id", required = true) 13 | @NotNull 14 | String stickerFileId, 15 | 16 | @JsonProperty(value = "reply_markup") 17 | @Nullable 18 | ReplyKeyboard replyMarkup, 19 | 20 | @JsonProperty(value = "input_message_content") 21 | @Nullable 22 | InputMessageContent inputMessageContent 23 | ) implements InlineQueryResult { 24 | 25 | @Override 26 | public String type() { 27 | return "sticker"; 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/InputContactMessageContent.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.Nullable; 5 | 6 | public record InputContactMessageContent( 7 | @JsonProperty(value = "phone_number", required = true) 8 | String phoneNumber, 9 | 10 | @JsonProperty(value = "first_name", required = true) 11 | String firstName, 12 | 13 | @JsonProperty(value = "last_name") 14 | @Nullable 15 | String lastName, 16 | 17 | @JsonProperty(value = "vcard") 18 | @Nullable 19 | String vcard 20 | ) implements InputMessageContent { 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/InputLocationMessageContent.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.Nullable; 5 | 6 | public record InputLocationMessageContent( 7 | @JsonProperty(value = "latitude", required = true) 8 | float latitude, 9 | 10 | @JsonProperty(value = "longitude", required = true) 11 | float longitude, 12 | 13 | @JsonProperty(value = "horizontal_accuracy") 14 | @Nullable 15 | Float horizontalAccuracy, 16 | 17 | @JsonProperty(value = "live_period") 18 | int livePeriod, 19 | 20 | @JsonProperty(value = "heading") 21 | int heading, 22 | 23 | @JsonProperty(value = "proximity_alert_radius") 24 | int proximityAlertRadius 25 | ) implements InputMessageContent { 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/InputMessageContent.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import org.teleight.teleightbots.api.ApiResult; 4 | 5 | public sealed interface InputMessageContent extends ApiResult permits 6 | InputContactMessageContent, 7 | InputInvoiceMessageContent, 8 | InputLocationMessageContent, 9 | InputTextMessageContent, 10 | InputVenueMessageContent { 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/InputPaidMedia.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import com.fasterxml.jackson.annotation.JsonSubTypes; 5 | import com.fasterxml.jackson.annotation.JsonTypeInfo; 6 | import org.teleight.teleightbots.api.ApiResult; 7 | 8 | @JsonTypeInfo( 9 | use = JsonTypeInfo.Id.NAME, 10 | include = JsonTypeInfo.As.EXISTING_PROPERTY, 11 | property = "type", 12 | defaultImpl = Void.class 13 | ) 14 | @JsonSubTypes({ 15 | @JsonSubTypes.Type(value = InputPaidMediaPhoto.class, name = "photo"), 16 | @JsonSubTypes.Type(value = InputPaidMediaVideo.class, name = "video") 17 | }) 18 | public sealed interface InputPaidMedia extends ApiResult permits 19 | InputPaidMediaPhoto, 20 | InputPaidMediaVideo { 21 | 22 | String TYPE_NAME = "type"; 23 | 24 | @JsonProperty(TYPE_NAME) 25 | String type(); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/InputPaidMediaPhoto.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Builder; 5 | import lombok.extern.jackson.Jacksonized; 6 | import org.jetbrains.annotations.NotNull; 7 | 8 | @Builder(builderClassName = "Builder", toBuilder = true, builderMethodName = "ofBuilder") 9 | @Jacksonized 10 | public record InputPaidMediaPhoto( 11 | @JsonProperty(value = "media", required = true) 12 | @NotNull 13 | InputFile media 14 | ) implements InputPaidMedia { 15 | 16 | public static @NotNull Builder ofBuilder(InputFile media) { 17 | return new InputPaidMediaPhoto.Builder().media(media); 18 | } 19 | 20 | @Override 21 | public String type() { 22 | return "photo"; 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/InputPollOption.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Builder; 5 | import lombok.extern.jackson.Jacksonized; 6 | import org.jetbrains.annotations.NotNull; 7 | import org.jetbrains.annotations.Nullable; 8 | import org.teleight.teleightbots.api.ApiResult; 9 | 10 | @Builder(builderClassName = "Builder", toBuilder = true, builderMethodName = "ofBuilder") 11 | @Jacksonized 12 | public record InputPollOption( 13 | @JsonProperty(value = "text", required = true) 14 | @NotNull 15 | String text, 16 | 17 | @JsonProperty(value = "text_parse_mode") 18 | @Nullable 19 | ParseMode textParseMode, 20 | 21 | @JsonProperty(value = "text_entities") 22 | @Nullable 23 | MessageEntity[] textEntities 24 | ) implements ApiResult { 25 | 26 | public static @NotNull Builder ofBuilder(String text) { 27 | return new InputPollOption.Builder().text(text); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/InputProfilePhoto.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import com.fasterxml.jackson.annotation.JsonSubTypes; 5 | import com.fasterxml.jackson.annotation.JsonTypeInfo; 6 | import org.teleight.teleightbots.api.ApiResult; 7 | 8 | @JsonTypeInfo( 9 | use = JsonTypeInfo.Id.NAME, 10 | include = JsonTypeInfo.As.EXISTING_PROPERTY, 11 | property = "type", 12 | defaultImpl = Void.class 13 | ) 14 | @JsonSubTypes({ 15 | @JsonSubTypes.Type(value = InputProfilePhotoStatic.class, name = "static"), 16 | @JsonSubTypes.Type(value = InputProfilePhotoAnimated.class, name = "animated") 17 | }) 18 | public sealed interface InputProfilePhoto extends ApiResult permits 19 | InputProfilePhotoStatic, 20 | InputProfilePhotoAnimated { 21 | 22 | String TYPE_NAME = "type"; 23 | 24 | @JsonProperty(TYPE_NAME) 25 | String type(); 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/InputProfilePhotoAnimated.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Builder; 5 | import lombok.extern.jackson.Jacksonized; 6 | import org.jetbrains.annotations.NotNull; 7 | 8 | @Builder(builderClassName = "Builder", toBuilder = true, builderMethodName = "ofBuilder") 9 | @Jacksonized 10 | public record InputProfilePhotoAnimated( 11 | @JsonProperty(value = "animation", required = true) 12 | @NotNull 13 | InputFile animation, 14 | 15 | @JsonProperty(value = "main_frame_timestamp") 16 | float mainFrameTimestamp 17 | ) implements InputProfilePhoto { 18 | 19 | public static @NotNull Builder ofBuilder(InputFile animation) { 20 | return new InputProfilePhotoAnimated.Builder().animation(animation); 21 | } 22 | 23 | @Override 24 | public String type() { 25 | return "animated"; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/InputProfilePhotoStatic.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Builder; 5 | import lombok.extern.jackson.Jacksonized; 6 | import org.jetbrains.annotations.NotNull; 7 | 8 | @Builder(builderClassName = "Builder", toBuilder = true, builderMethodName = "ofBuilder") 9 | @Jacksonized 10 | public record InputProfilePhotoStatic( 11 | @JsonProperty(value = "photo", required = true) 12 | @NotNull 13 | InputFile photo 14 | ) implements InputProfilePhoto { 15 | 16 | public static @NotNull Builder ofBuilder(InputFile photo) { 17 | return new InputProfilePhotoStatic.Builder().photo(photo); 18 | } 19 | 20 | @Override 21 | public String type() { 22 | return "static"; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/InputStoryContent.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import com.fasterxml.jackson.annotation.JsonSubTypes; 5 | import com.fasterxml.jackson.annotation.JsonTypeInfo; 6 | import org.teleight.teleightbots.api.ApiResult; 7 | 8 | @JsonTypeInfo( 9 | use = JsonTypeInfo.Id.NAME, 10 | include = JsonTypeInfo.As.EXISTING_PROPERTY, 11 | property = "type", 12 | defaultImpl = Void.class 13 | ) 14 | @JsonSubTypes({ 15 | @JsonSubTypes.Type(value = InputStoryContentPhoto.class, name = "photo"), 16 | @JsonSubTypes.Type(value = InputStoryContentVideo.class, name = "video") 17 | }) 18 | public sealed interface InputStoryContent extends ApiResult permits 19 | InputStoryContentPhoto, 20 | InputStoryContentVideo { 21 | 22 | String TYPE_NAME = "type"; 23 | 24 | @JsonProperty(TYPE_NAME) 25 | String type(); 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/InputStoryContentPhoto.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | public record InputStoryContentPhoto( 7 | @JsonProperty(value = "photo", required = true) 8 | @NotNull 9 | InputFile photo 10 | ) implements InputStoryContent { 11 | 12 | @Override 13 | public String type() { 14 | return "photo"; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/InputStoryContentVideo.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | import org.jetbrains.annotations.Range; 6 | 7 | public record InputStoryContentVideo( 8 | @JsonProperty(value = "video", required = true) 9 | @NotNull 10 | InputFile video, 11 | 12 | @JsonProperty(value = "duration") 13 | @Range(from = 0, to = 60) 14 | float duration, 15 | 16 | @JsonProperty(value = "cover_frame_timestamp") 17 | float coverFrameTimestamp, 18 | 19 | @JsonProperty(value = "is_animation") 20 | boolean isAnimation 21 | ) implements InputStoryContent { 22 | 23 | @Override 24 | public String type() { 25 | return "video"; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/InputTextMessageContent.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.Nullable; 5 | 6 | public record InputTextMessageContent( 7 | @JsonProperty(value = "message_text", required = true) 8 | String messageText, 9 | 10 | @JsonProperty(value = "parse_mode") 11 | @Nullable 12 | ParseMode parseMode, 13 | 14 | @JsonProperty(value = "entities") 15 | @Nullable 16 | MessageEntity[] entities, 17 | 18 | @JsonProperty(value = "link_preview_options") 19 | @Nullable 20 | LinkPreviewOptions linkPreviewOptions 21 | ) implements InputMessageContent { 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/Invoice.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.teleight.teleightbots.api.ApiResult; 5 | 6 | public record Invoice( 7 | @JsonProperty(value = "title", required = true) 8 | String title, 9 | 10 | @JsonProperty(value = "description", required = true) 11 | String description, 12 | 13 | @JsonProperty(value = "start_parameter", required = true) 14 | String startParameter, 15 | 16 | @JsonProperty(value = "currency", required = true) 17 | String currency, 18 | 19 | @JsonProperty(value = "total_amount", required = true) 20 | int totalAmount 21 | ) implements ApiResult { 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/KeyboardButton.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.teleight.teleightbots.api.ApiResult; 5 | 6 | public record KeyboardButton( 7 | @JsonProperty(value = "text", required = true) 8 | String text, 9 | 10 | @JsonProperty(value = "request_users") 11 | KeyboardButtonRequestUsers requestUsers, 12 | 13 | @JsonProperty(value = "request_chat") 14 | KeyboardButtonRequestChat requestChat, 15 | 16 | @JsonProperty(value = "request_contact") 17 | boolean requestContact, 18 | 19 | @JsonProperty(value = "request_location") 20 | boolean requestLocation, 21 | 22 | @JsonProperty(value = "request_poll") 23 | KeyboardButtonPollType requestPoll, 24 | 25 | @JsonProperty(value = "web_app") 26 | WebAppInfo webApp 27 | ) implements ApiResult { 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/KeyboardButtonPollType.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.Nullable; 5 | import org.teleight.teleightbots.api.ApiResult; 6 | 7 | public record KeyboardButtonPollType( 8 | @JsonProperty(value = "type") 9 | @Nullable 10 | String type 11 | ) implements ApiResult { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/KeyboardButtonRequestUsers.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.teleight.teleightbots.api.ApiResult; 5 | 6 | public record KeyboardButtonRequestUsers( 7 | @JsonProperty(value = "request_id", required = true) 8 | int requestId, 9 | 10 | @JsonProperty(value = "user_is_bot") 11 | boolean userIsBot, 12 | 13 | @JsonProperty(value = "user_is_premium") 14 | boolean userIsPremium, 15 | 16 | @JsonProperty(value = "max_quantity") 17 | int maxQuantity, 18 | 19 | @JsonProperty(value = "request_name") 20 | boolean requestName, 21 | 22 | @JsonProperty(value = "request_username") 23 | boolean requestUsername, 24 | 25 | @JsonProperty(value = "request_photo") 26 | boolean requestPhoto 27 | ) implements ApiResult { 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/LabeledPrice.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | 5 | public record LabeledPrice( 6 | @JsonProperty(value = "label", required = true) 7 | String label, 8 | 9 | @JsonProperty(value = "amount", required = true) 10 | int amount 11 | ) { 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/LinkPreviewOptions.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Builder; 5 | import lombok.extern.jackson.Jacksonized; 6 | import org.jetbrains.annotations.Nullable; 7 | import org.teleight.teleightbots.api.ApiResult; 8 | 9 | @Builder(builderClassName = "Builder", toBuilder = true, builderMethodName = "ofBuilder") 10 | @Jacksonized 11 | public record LinkPreviewOptions( 12 | @JsonProperty(value = "is_disabled") 13 | boolean isDisabled, 14 | 15 | @JsonProperty(value = "url") 16 | @Nullable 17 | String url, 18 | 19 | @JsonProperty(value = "prefer_small_media") 20 | boolean preferSmallMedia, 21 | 22 | @JsonProperty(value = "prefer_large_media") 23 | boolean preferLargeMedia, 24 | 25 | @JsonProperty(value = "show_above_text") 26 | boolean showAboveText 27 | ) implements ApiResult { 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/Location.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.Nullable; 5 | import org.teleight.teleightbots.api.ApiResult; 6 | 7 | public record Location( 8 | @JsonProperty(value = "longitude", required = true) 9 | Float longitude, 10 | 11 | @JsonProperty(value = "latitude", required = true) 12 | Float latitude, 13 | 14 | @JsonProperty(value = "horizontal_accuracy") 15 | @Nullable 16 | Float horizontalAccuracy, 17 | 18 | @JsonProperty(value = "live_period") 19 | int livePeriod, 20 | 21 | @JsonProperty(value = "heading") 22 | int heading, 23 | 24 | @JsonProperty(value = "proximity_alert_radius") 25 | int proximityAlertRadius 26 | ) implements ApiResult { 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/LocationAddress.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | import org.jetbrains.annotations.Nullable; 6 | import org.teleight.teleightbots.api.ApiResult; 7 | 8 | public record LocationAddress( 9 | @JsonProperty(value = "country_code", required = true) 10 | @NotNull 11 | String countryCode, 12 | 13 | @JsonProperty(value = "state") 14 | @Nullable 15 | String state, 16 | 17 | @JsonProperty(value = "city") 18 | @Nullable 19 | String city, 20 | 21 | @JsonProperty(value = "street") 22 | @Nullable 23 | String street 24 | ) implements ApiResult { 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/LoginUrl.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | import org.jetbrains.annotations.Nullable; 6 | import org.teleight.teleightbots.api.ApiResult; 7 | 8 | public record LoginUrl( 9 | @JsonProperty(value = "url", required = true) 10 | @NotNull 11 | String url, 12 | 13 | @JsonProperty(value = "forward_text") 14 | @Nullable 15 | String forwardText, 16 | 17 | @JsonProperty(value = "bot_username") 18 | @Nullable 19 | String botUsername, 20 | 21 | @JsonProperty(value = "request_write_access") 22 | boolean requestWriteAccess 23 | ) implements ApiResult { 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/MaskPosition.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.teleight.teleightbots.api.ApiResult; 5 | 6 | public record MaskPosition( 7 | @JsonProperty(value = "point", required = true) 8 | String point, 9 | 10 | @JsonProperty(value = "x_shift", required = true) 11 | Float xShift, 12 | 13 | @JsonProperty(value = "y_shift", required = true) 14 | Float yShift, 15 | 16 | @JsonProperty(value = "scale", required = true) 17 | Float scale 18 | ) implements ApiResult { 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/MaybeInaccessibleMessage.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.teleight.teleightbots.api.ApiResult; 5 | 6 | import java.util.Date; 7 | 8 | public sealed interface MaybeInaccessibleMessage extends ApiResult permits 9 | Message, 10 | InaccessibleMessage { 11 | 12 | int messageId(); 13 | 14 | @NotNull Chat chat(); 15 | 16 | @NotNull Date date(); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/MenuButtonCommands.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | public record MenuButtonCommands() implements MenuButton { 4 | 5 | @Override 6 | public MenuButtonType type() { 7 | return MenuButtonType.COMMANDS; 8 | } 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/MenuButtonDefault.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | public record MenuButtonDefault() implements MenuButton { 4 | 5 | @Override 6 | public MenuButtonType type() { 7 | return MenuButtonType.DEFAULT; 8 | } 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/MenuButtonWebApp.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Builder; 5 | import lombok.extern.jackson.Jacksonized; 6 | import org.jetbrains.annotations.NotNull; 7 | 8 | @Builder(builderClassName = "Builder", toBuilder = true, builderMethodName = "ofBuilder") 9 | @Jacksonized 10 | public record MenuButtonWebApp( 11 | @JsonProperty(value = "text", required = true) 12 | String text, 13 | 14 | @JsonProperty(value = "web_app", required = true) 15 | WebAppInfo webAppInfo 16 | ) implements MenuButton { 17 | 18 | public static @NotNull Builder ofBuilder(String text, WebAppInfo webAppInfo) { 19 | return new MenuButtonWebApp.Builder().text(text).webAppInfo(webAppInfo); 20 | } 21 | 22 | @Override 23 | public MenuButtonType type() { 24 | return MenuButtonType.WEB_APP; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/MessageAutoDeleteTimerChanged.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.teleight.teleightbots.api.ApiResult; 5 | 6 | public record MessageAutoDeleteTimerChanged( 7 | @JsonProperty(value = "message_auto_delete_time", required = true) 8 | int messageAutoDeleteTime 9 | ) implements ApiResult { 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/MessageId.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.teleight.teleightbots.api.ApiResult; 5 | 6 | public record MessageId( 7 | @JsonProperty(value = "message_id", required = true) 8 | int messageId 9 | ) implements ApiResult { 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/MessageOriginChannel.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | import org.jetbrains.annotations.Nullable; 6 | 7 | import java.util.Date; 8 | 9 | public record MessageOriginChannel( 10 | @JsonProperty(value = "date", required = true) 11 | @NotNull 12 | Date date, 13 | 14 | @JsonProperty(value = "chat", required = true) 15 | @NotNull 16 | Chat chat, 17 | 18 | @JsonProperty(value = "message_id", required = true) 19 | int messageId, 20 | 21 | @JsonProperty(value = "author_signature") 22 | @Nullable 23 | String senderSignature 24 | ) implements MessageOrigin { 25 | 26 | @Override 27 | public String type() { 28 | return "channel"; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/MessageOriginChat.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | import java.util.Date; 7 | 8 | public record MessageOriginChat( 9 | @JsonProperty(value = "date", required = true) 10 | @NotNull 11 | Date date, 12 | 13 | @JsonProperty(value = "sender_chat", required = true) 14 | @NotNull 15 | Chat senderChat, 16 | 17 | @JsonProperty(value = "author_signature") 18 | @NotNull 19 | String senderSignature 20 | ) implements MessageOrigin { 21 | 22 | @Override 23 | public String type() { 24 | return "chat"; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/MessageOriginHiddenUser.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | import java.util.Date; 7 | 8 | public record MessageOriginHiddenUser( 9 | @JsonProperty(value = "date", required = true) 10 | @NotNull 11 | Date date, 12 | 13 | @JsonProperty(value = "sender_user_name", required = true) 14 | @NotNull 15 | String senderUserName 16 | ) implements MessageOrigin { 17 | 18 | @Override 19 | public String type() { 20 | return "hidden_user"; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/MessageOriginUser.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | import java.util.Date; 7 | 8 | public record MessageOriginUser( 9 | @JsonProperty(value = "date", required = true) 10 | @NotNull 11 | Date date, 12 | 13 | @JsonProperty(value = "sender_user", required = true) 14 | @NotNull 15 | User senderUser 16 | ) implements MessageOrigin { 17 | 18 | @Override 19 | public String type() { 20 | return "user"; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/MessageReactionCountUpdated.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | import org.teleight.teleightbots.api.ApiResult; 6 | 7 | public record MessageReactionCountUpdated( 8 | @JsonProperty(value = "chat", required = true) 9 | @NotNull 10 | Chat chat, 11 | 12 | @JsonProperty(value = "message_id", required = true) 13 | int messageId, 14 | 15 | @JsonProperty(value = "date", required = true) 16 | int date, 17 | 18 | @JsonProperty(value = "reactions", required = true) 19 | @NotNull 20 | ReactionCount[] reactions 21 | ) implements ApiResult { 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/OrderInfo.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.Nullable; 5 | import org.teleight.teleightbots.api.ApiResult; 6 | 7 | public record OrderInfo( 8 | @JsonProperty(value = "name") 9 | @Nullable 10 | String name, 11 | 12 | @JsonProperty(value = "phone_number") 13 | @Nullable 14 | String phoneNumber, 15 | 16 | @JsonProperty(value = "email") 17 | @Nullable 18 | String email, 19 | 20 | @JsonProperty(value = "shipping_address") 21 | @Nullable 22 | ShippingAddress shippingAddress 23 | ) implements ApiResult { 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/OwnedGift.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import com.fasterxml.jackson.annotation.JsonSubTypes; 5 | import com.fasterxml.jackson.annotation.JsonTypeInfo; 6 | import org.teleight.teleightbots.api.ApiResult; 7 | 8 | @JsonTypeInfo( 9 | use = JsonTypeInfo.Id.NAME, 10 | include = JsonTypeInfo.As.EXISTING_PROPERTY, 11 | property = "type", 12 | defaultImpl = Void.class 13 | ) 14 | @JsonSubTypes({ 15 | @JsonSubTypes.Type(value = OwnedGiftRegular.class, name = "regular"), 16 | @JsonSubTypes.Type(value = OwnedGiftUnique.class, name = "unique") 17 | }) 18 | public sealed interface OwnedGift extends ApiResult permits 19 | OwnedGiftRegular, 20 | OwnedGiftUnique { 21 | 22 | String TYPE_NAME = "type"; 23 | 24 | @JsonProperty(TYPE_NAME) 25 | String type(); 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/OwnedGifts.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | import org.jetbrains.annotations.Nullable; 6 | import org.teleight.teleightbots.api.ApiResult; 7 | 8 | public record OwnedGifts( 9 | @JsonProperty(value = "total_count", required = true) 10 | int totalCount, 11 | 12 | @JsonProperty(value = "gifts", required = true) 13 | @NotNull 14 | OwnedGift[] gifts, 15 | 16 | @JsonProperty(value = "next_offset") 17 | @Nullable 18 | String nextOffset 19 | ) implements ApiResult { 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/PaidMedia.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import com.fasterxml.jackson.annotation.JsonSubTypes; 5 | import com.fasterxml.jackson.annotation.JsonTypeInfo; 6 | import org.teleight.teleightbots.api.ApiResult; 7 | 8 | @JsonTypeInfo( 9 | use = JsonTypeInfo.Id.NAME, 10 | include = JsonTypeInfo.As.EXISTING_PROPERTY, 11 | property = "status", 12 | defaultImpl = Void.class 13 | ) 14 | @JsonSubTypes({ 15 | @JsonSubTypes.Type(value = PaidMediaPreview.class, name = "preview"), 16 | @JsonSubTypes.Type(value = PaidMediaPhoto.class, name = "photo"), 17 | @JsonSubTypes.Type(value = PaidMediaVideo.class, name = "video"), 18 | }) 19 | public sealed interface PaidMedia extends ApiResult permits 20 | PaidMediaPreview, 21 | PaidMediaPhoto, 22 | PaidMediaVideo { 23 | 24 | String TYPE_NAME = "type"; 25 | 26 | @JsonProperty(TYPE_NAME) 27 | String type(); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/PaidMediaInfo.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | import org.teleight.teleightbots.api.ApiResult; 6 | 7 | public record PaidMediaInfo( 8 | @JsonProperty(value = "star_count", required = true) 9 | int startCount, 10 | 11 | @JsonProperty(value = "paid_media", required = true) 12 | @NotNull 13 | PaidMedia[] paidMedia 14 | ) implements ApiResult { 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/PaidMediaPhoto.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | public record PaidMediaPhoto( 7 | @JsonProperty(value = "photo", required = true) 8 | @NotNull 9 | PhotoSize[] photo 10 | ) implements PaidMedia { 11 | 12 | @Override 13 | public String type() { 14 | return "photo"; 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/PaidMediaPreview.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | 5 | public record PaidMediaPreview( 6 | @JsonProperty(value = "width") 7 | int width, 8 | 9 | @JsonProperty(value = "height") 10 | int height, 11 | 12 | @JsonProperty(value = "duration") 13 | int duration 14 | ) implements PaidMedia { 15 | 16 | @Override 17 | public String type() { 18 | return "preview"; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/PaidMediaPurchased.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | public record PaidMediaPurchased( 7 | @JsonProperty(value = "from", required = true) 8 | @NotNull 9 | User from, 10 | 11 | @JsonProperty(value = "paid_media_payload", required = true) 12 | @NotNull 13 | String paidMediaPayload 14 | ) { 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/PaidMediaVideo.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | public record PaidMediaVideo( 7 | @JsonProperty(value = "video", required = true) 8 | @NotNull 9 | Video video 10 | ) implements PaidMedia { 11 | 12 | @Override 13 | public String type() { 14 | return "video"; 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/PaidMessagePriceChanged.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.teleight.teleightbots.api.ApiResult; 5 | 6 | public record PaidMessagePriceChanged( 7 | @JsonProperty(value = "paid_message_star_count", required = true) 8 | int paidMessageStarCount 9 | ) implements ApiResult { 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/ParseMode.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonCreator; 4 | import com.fasterxml.jackson.annotation.JsonValue; 5 | 6 | public enum ParseMode { 7 | 8 | MARKDOWN("Markdown"), 9 | MARKDOWNV2("MarkdownV2"), 10 | HTML("html"); 11 | 12 | private final String fieldValue; 13 | 14 | ParseMode(String fieldValue) { 15 | this.fieldValue = fieldValue; 16 | } 17 | 18 | @JsonValue 19 | public String getFieldValue() { 20 | return fieldValue; 21 | } 22 | 23 | @JsonCreator 24 | public static ParseMode fromValue(String value) { 25 | for (ParseMode parseMode : ParseMode.values()) { 26 | if (parseMode.fieldValue.equalsIgnoreCase(value)) { 27 | return parseMode; 28 | } 29 | } 30 | throw new IllegalArgumentException("Unknown enum type " + value); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/PassportData.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.teleight.teleightbots.api.ApiResult; 5 | 6 | public record PassportData( 7 | @JsonProperty(value = "data", required = true) 8 | EncryptedPassportElement[] data, 9 | 10 | @JsonProperty(value = "credentials", required = true) 11 | EncryptedCredentials credentials 12 | ) implements ApiResult { 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/PassportElementErrorDataField.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | 5 | public record PassportElementErrorDataField( 6 | @JsonProperty(value = "type", required = true) 7 | String type, 8 | 9 | @JsonProperty(value = "field_name", required = true) 10 | String fieldName, 11 | 12 | @JsonProperty(value = "data_hash", required = true) 13 | String dataHash, 14 | 15 | @JsonProperty(value = "message", required = true) 16 | String message 17 | ) implements PassportElementError { 18 | 19 | @Override 20 | public String source() { 21 | return "data"; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/PassportElementErrorFile.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | 5 | public record PassportElementErrorFile( 6 | @JsonProperty(value = "type", required = true) 7 | String type, 8 | 9 | @JsonProperty(value = "file_hash", required = true) 10 | String fileHash, 11 | 12 | @JsonProperty(value = "message", required = true) 13 | String message 14 | ) implements PassportElementError { 15 | 16 | @Override 17 | public String source() { 18 | return "file"; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/PassportElementErrorFiles.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | 5 | public record PassportElementErrorFiles( 6 | @JsonProperty(value = "type", required = true) 7 | String type, 8 | 9 | @JsonProperty(value = "file_hashes", required = true) 10 | String[] fileHashes, 11 | 12 | @JsonProperty(value = "message", required = true) 13 | String message 14 | ) implements PassportElementError { 15 | 16 | @Override 17 | public String source() { 18 | return "files"; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/PassportElementErrorFrontSide.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | 5 | public record PassportElementErrorFrontSide( 6 | @JsonProperty(value = "type", required = true) 7 | String type, 8 | 9 | @JsonProperty(value = "file_hash", required = true) 10 | String fileHash, 11 | 12 | @JsonProperty(value = "message", required = true) 13 | String message 14 | ) implements PassportElementError { 15 | 16 | @Override 17 | public String source() { 18 | return "front_side"; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/PassportElementErrorReverseSide.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | 5 | public record PassportElementErrorReverseSide( 6 | @JsonProperty(value = "type", required = true) 7 | String type, 8 | 9 | @JsonProperty(value = "file_hash", required = true) 10 | String fileHash, 11 | 12 | @JsonProperty(value = "message", required = true) 13 | String message 14 | ) implements PassportElementError { 15 | 16 | @Override 17 | public String source() { 18 | return "reverse_side"; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/PassportElementErrorSelfie.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | 5 | public record PassportElementErrorSelfie( 6 | @JsonProperty(value = "type", required = true) 7 | String type, 8 | 9 | @JsonProperty(value = "file_hash", required = true) 10 | String fileHash, 11 | 12 | @JsonProperty(value = "message", required = true) 13 | String message 14 | ) implements PassportElementError { 15 | 16 | @Override 17 | public String source() { 18 | return "selfie"; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/PassportElementErrorTranslationFile.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | 5 | public record PassportElementErrorTranslationFile( 6 | @JsonProperty(value = "type", required = true) 7 | String type, 8 | 9 | @JsonProperty(value = "file_hash", required = true) 10 | String fileHash, 11 | 12 | @JsonProperty(value = "message", required = true) 13 | String message 14 | ) implements PassportElementError { 15 | 16 | @Override 17 | public String source() { 18 | return "translation_file"; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/PassportElementErrorTranslationFiles.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | 5 | public record PassportElementErrorTranslationFiles( 6 | @JsonProperty(value = "type", required = true) 7 | String type, 8 | 9 | @JsonProperty(value = "file_hashes", required = true) 10 | String[] fileHashes, 11 | 12 | @JsonProperty(value = "message", required = true) 13 | String message 14 | ) implements PassportElementError { 15 | 16 | @Override 17 | public String source() { 18 | return "translation_files"; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/PassportElementErrorUnspecified.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | 5 | public record PassportElementErrorUnspecified( 6 | @JsonProperty(value = "type", required = true) 7 | String type, 8 | 9 | @JsonProperty(value = "element_hash", required = true) 10 | String elementHash, 11 | 12 | @JsonProperty(value = "message", required = true) 13 | String message 14 | ) implements PassportElementError { 15 | 16 | @Override 17 | public String source() { 18 | return "unspecified"; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/PassportFile.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.teleight.teleightbots.api.ApiResult; 5 | 6 | public record PassportFile( 7 | @JsonProperty(value = "file_id", required = true) 8 | String fileId, 9 | 10 | @JsonProperty(value = "file_unique_id", required = true) 11 | String fileUniqueId, 12 | 13 | @JsonProperty(value = "file_size") 14 | int fileSize, 15 | 16 | @JsonProperty(value = "file_date") 17 | int fileDate 18 | ) implements ApiResult { 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/PhotoSize.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.teleight.teleightbots.api.ApiResult; 5 | 6 | public record PhotoSize( 7 | @JsonProperty(value = "file_id", required = true) 8 | String fileId, 9 | 10 | @JsonProperty(value = "file_unique_id", required = true) 11 | String fileUniqueId, 12 | 13 | @JsonProperty(value = "width", required = true) 14 | int width, 15 | 16 | @JsonProperty(value = "height", required = true) 17 | int height, 18 | 19 | @JsonProperty(value = "file_size") 20 | long fileSize 21 | ) implements ApiResult { 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/PollAnswer.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.Nullable; 5 | import org.teleight.teleightbots.api.ApiResult; 6 | 7 | public record PollAnswer( 8 | @JsonProperty(value = "poll_id", required = true) 9 | String pollId, 10 | 11 | @JsonProperty(value = "chat") 12 | @Nullable 13 | Chat chat, 14 | 15 | @JsonProperty(value = "user") 16 | @Nullable 17 | User user, 18 | 19 | @JsonProperty(value = "option_ids", required = true) 20 | Integer[] optionIds 21 | ) implements ApiResult { 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/PollOption.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.Nullable; 5 | import org.teleight.teleightbots.api.ApiResult; 6 | 7 | public record PollOption( 8 | @JsonProperty(value = "text", required = true) 9 | String text, 10 | 11 | @JsonProperty(value = "text_entities") 12 | @Nullable 13 | MessageEntity[] textEntities, 14 | 15 | @JsonProperty(value = "voter_count", required = true) 16 | int voterCount 17 | ) implements ApiResult { 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/PreCheckoutQuery.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.Nullable; 5 | import org.teleight.teleightbots.api.ApiResult; 6 | 7 | public record PreCheckoutQuery( 8 | @JsonProperty(value = "id", required = true) 9 | String id, 10 | 11 | @JsonProperty(value = "from", required = true) 12 | User from, 13 | 14 | @JsonProperty(value = "currency", required = true) 15 | String currency, 16 | 17 | @JsonProperty(value = "total_amount", required = true) 18 | int totalAmount, 19 | 20 | @JsonProperty(value = "invoice_payload", required = true) 21 | String invoicePayload, 22 | 23 | @JsonProperty(value = "shipping_option_id") 24 | @Nullable 25 | String shippingOptionId, 26 | 27 | @JsonProperty(value = "order_info") 28 | @Nullable 29 | OrderInfo orderInfo 30 | ) implements ApiResult { 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/PreparedInlineMessage.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | import org.teleight.teleightbots.api.ApiResult; 6 | 7 | import java.util.Date; 8 | 9 | public record PreparedInlineMessage( 10 | @JsonProperty(value = "id", required = true) 11 | @NotNull 12 | String id, 13 | 14 | @JsonProperty(value = "expiration_date", required = true) 15 | @NotNull 16 | Date expirationDate 17 | ) implements ApiResult { 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/ProximityAlertTriggered.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.teleight.teleightbots.api.ApiResult; 5 | import org.teleight.teleightbots.api.objects.User; 6 | 7 | public record ProximityAlertTriggered( 8 | @JsonProperty(value = "traveler", required = true) 9 | User traveler, 10 | 11 | @JsonProperty(value = "watcher", required = true) 12 | User watcher, 13 | 14 | @JsonProperty(value = "distance", required = true) 15 | int distance 16 | ) implements ApiResult { 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/ReactionCount.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | import org.teleight.teleightbots.api.ApiResult; 6 | 7 | public record ReactionCount( 8 | @JsonProperty(value = "type", required = true) 9 | @NotNull 10 | ReactionType type, 11 | 12 | @JsonProperty(value = "total_count", required = true) 13 | @NotNull 14 | String emoji 15 | ) implements ApiResult { 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/ReactionTypeCustomEmoji.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | public record ReactionTypeCustomEmoji( 7 | @JsonProperty(value = "custom_emoji", required = true) 8 | @NotNull 9 | String customEmoji 10 | ) implements ReactionType { 11 | 12 | @Override 13 | public String type() { 14 | return "custom_emoji"; 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/ReactionTypeEmoji.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | public record ReactionTypeEmoji( 7 | @JsonProperty(value = "emoji", required = true) 8 | @NotNull 9 | String emoji 10 | ) implements ReactionType { 11 | 12 | @Override 13 | public String type() { 14 | return "emoji"; 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/ReactionTypePaid.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | public record ReactionTypePaid() implements ReactionType { 4 | 5 | @Override 6 | public String type() { 7 | return "paid"; 8 | } 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/RefundedPayment.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | import org.jetbrains.annotations.Nullable; 6 | import org.teleight.teleightbots.api.ApiResult; 7 | 8 | public record RefundedPayment( 9 | @JsonProperty(value = "currency", required = true) 10 | @NotNull 11 | String currency, 12 | 13 | @JsonProperty(value = "total_amount", required = true) 14 | int totalAmount, 15 | 16 | @JsonProperty(value = "invoice_payload", required = true) 17 | @NotNull 18 | String invoicePayload, 19 | 20 | @JsonProperty(value = "telegram_payment_charge_id", required = true) 21 | @NotNull 22 | String telegramPaymentChargeId, 23 | 24 | @JsonProperty(value = "provider_payment_charge_id") 25 | @Nullable 26 | String providerPaymentChargeId 27 | ) implements ApiResult { 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/ReplyKeyboard.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import org.teleight.teleightbots.api.ApiResult; 4 | 5 | public sealed interface ReplyKeyboard extends ApiResult permits 6 | ForceReplyKeyboard, 7 | InlineKeyboardMarkup, 8 | ReplyKeyboardRemove, 9 | ReplyKeyboardMarkup { 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/ReplyKeyboardRemove.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Builder; 5 | import lombok.extern.jackson.Jacksonized; 6 | 7 | @Builder(builderClassName = "Builder", toBuilder = true, builderMethodName = "ofBuilder") 8 | @Jacksonized 9 | public record ReplyKeyboardRemove( 10 | @JsonProperty(value = "remove_keyboard", required = true) 11 | boolean removeKeyboard, 12 | 13 | @JsonProperty(value = "selective") 14 | boolean selective 15 | ) implements ReplyKeyboard { 16 | 17 | public Builder ofBuilder(boolean removeKeyboard) { 18 | return new ReplyKeyboardRemove.Builder().removeKeyboard(removeKeyboard); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/ResponseParameters.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.teleight.teleightbots.api.ApiResult; 5 | 6 | public record ResponseParameters( 7 | @JsonProperty(value = "migrate_to_chat_id") 8 | long migrateToChatId, 9 | 10 | @JsonProperty(value = "retry_after") 11 | int retryAfter 12 | ) implements ApiResult { 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/RevenueWithdrawalStateFailed.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | public record RevenueWithdrawalStateFailed() implements RevenueWithdrawalState { 4 | 5 | @Override 6 | public String type() { 7 | return "failed"; 8 | } 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/RevenueWithdrawalStatePending.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | public record RevenueWithdrawalStatePending() implements RevenueWithdrawalState { 4 | 5 | @Override 6 | public String type() { 7 | return "pending"; 8 | } 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/RevenueWithdrawalStateSucceeded.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | import java.util.Date; 7 | 8 | public record RevenueWithdrawalStateSucceeded( 9 | @JsonProperty(value = "date", required = true) 10 | @NotNull 11 | Date date, 12 | 13 | @JsonProperty(value = "url", required = true) 14 | @NotNull 15 | String url 16 | ) implements RevenueWithdrawalState { 17 | 18 | @Override 19 | public String type() { 20 | return "succeeded"; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/SentWebAppMessage.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.Nullable; 5 | import org.teleight.teleightbots.api.ApiResult; 6 | 7 | public record SentWebAppMessage( 8 | @JsonProperty(value = "inline_message_id") 9 | @Nullable 10 | String inlineMessageId 11 | ) implements ApiResult { 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/SharedUser.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.Nullable; 5 | import org.teleight.teleightbots.api.ApiResult; 6 | 7 | public record SharedUser( 8 | @JsonProperty(value = "user_id", required = true) 9 | long userId, 10 | 11 | @JsonProperty(value = "first_name") 12 | @Nullable 13 | String firstName, 14 | 15 | @JsonProperty(value = "last_name") 16 | @Nullable 17 | String lastName, 18 | 19 | @JsonProperty(value = "username") 20 | @Nullable 21 | String username, 22 | 23 | @JsonProperty(value = "photo") 24 | @Nullable 25 | PhotoSize[] photo 26 | ) implements ApiResult { 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/ShippingAddress.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.teleight.teleightbots.api.ApiResult; 5 | 6 | public record ShippingAddress( 7 | @JsonProperty(value = "country_code", required = true) 8 | String countryCode, 9 | 10 | @JsonProperty(value = "state", required = true) 11 | String state, 12 | 13 | @JsonProperty(value = "city", required = true) 14 | String city, 15 | 16 | @JsonProperty(value = "street_line1", required = true) 17 | String streetLine1, 18 | 19 | @JsonProperty(value = "street_line2", required = true) 20 | String streetLine2, 21 | 22 | @JsonProperty(value = "post_code", required = true) 23 | String postCode 24 | ) implements ApiResult { 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/ShippingOption.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | import org.teleight.teleightbots.api.ApiResult; 6 | 7 | public record ShippingOption( 8 | @JsonProperty(value = "id", required = true) 9 | @NotNull 10 | String id, 11 | 12 | @JsonProperty(value = "title", required = true) 13 | @NotNull 14 | String title, 15 | 16 | @JsonProperty(value = "prices", required = true) 17 | @NotNull 18 | LabeledPrice[] prices 19 | ) implements ApiResult { 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/ShippingQuery.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.teleight.teleightbots.api.ApiResult; 5 | import org.teleight.teleightbots.api.objects.User; 6 | 7 | public record ShippingQuery( 8 | @JsonProperty(value = "id", required = true) 9 | String id, 10 | 11 | @JsonProperty(value = "from", required = true) 12 | User from, 13 | 14 | @JsonProperty(value = "invoice_payload", required = true) 15 | String invoicePayload, 16 | 17 | @JsonProperty(value = "shipping_address", required = true) 18 | ShippingAddress shippingAddress 19 | ) implements ApiResult { 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/StarAmount.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.Range; 5 | import org.teleight.teleightbots.api.ApiResult; 6 | 7 | public record StarAmount( 8 | @JsonProperty(value = "amount", required = true) 9 | int amount, 10 | 11 | @JsonProperty(value = "nanostar_amount") 12 | @Range(from = -999999999, to = 999999999) 13 | int nanostarAmount 14 | ) implements ApiResult { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/StarTransactions.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | import org.teleight.teleightbots.api.ApiResult; 6 | 7 | public record StarTransactions( 8 | @JsonProperty(value = "transactions", required = true) 9 | @NotNull 10 | StarTransaction[] transactions 11 | ) implements ApiResult { 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/StickerFormat.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonCreator; 4 | import com.fasterxml.jackson.annotation.JsonValue; 5 | 6 | public enum StickerFormat { 7 | 8 | STATIC("static"), 9 | ANIMATED("animated"), 10 | VIDEO("video"); 11 | 12 | private final String fieldValue; 13 | 14 | StickerFormat(String fieldValue) { 15 | this.fieldValue = fieldValue; 16 | } 17 | 18 | @JsonValue 19 | public String getFieldValue() { 20 | return fieldValue; 21 | } 22 | 23 | @JsonCreator 24 | public static StickerFormat fromValue(String value) { 25 | for (StickerFormat stickerFormat : StickerFormat.values()) { 26 | if (stickerFormat.fieldValue.equalsIgnoreCase(value)) { 27 | return stickerFormat; 28 | } 29 | } 30 | throw new IllegalArgumentException("Unknown enum type " + value); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/StickerSet.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | import org.jetbrains.annotations.Nullable; 6 | import org.teleight.teleightbots.api.ApiResult; 7 | 8 | public record StickerSet( 9 | @JsonProperty(value = "name", required = true) 10 | @NotNull 11 | String name, 12 | 13 | @JsonProperty(value = "title", required = true) 14 | @NotNull 15 | String title, 16 | 17 | @JsonProperty(value = "sticker_type", required = true) 18 | @NotNull 19 | String stickerType, 20 | 21 | @JsonProperty(value = "stickers", required = true) 22 | @NotNull 23 | Sticker[] stickers, 24 | 25 | @JsonProperty(value = "thumbnail") 26 | @Nullable 27 | PhotoSize thumbnail 28 | ) implements ApiResult { 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/StickerType.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonCreator; 4 | import com.fasterxml.jackson.annotation.JsonValue; 5 | 6 | public enum StickerType { 7 | 8 | REGULAR("regular"), 9 | MASK("mask"), 10 | CUSTOM_EMOJI("custom_emoji"); 11 | 12 | private final String fieldValue; 13 | 14 | StickerType(String fieldValue) { 15 | this.fieldValue = fieldValue; 16 | } 17 | 18 | @JsonValue 19 | public String getFieldValue() { 20 | return fieldValue; 21 | } 22 | 23 | @JsonCreator 24 | public static StickerType fromValue(String value) { 25 | for (StickerType stickerFormat : StickerType.values()) { 26 | if (stickerFormat.fieldValue.equalsIgnoreCase(value)) { 27 | return stickerFormat; 28 | } 29 | } 30 | throw new IllegalArgumentException("Unknown enum type " + value); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/Story.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | import org.teleight.teleightbots.api.ApiResult; 6 | 7 | public record Story( 8 | @JsonProperty(value = "chat", required = true) 9 | @NotNull 10 | Chat chat, 11 | 12 | @JsonProperty(value = "id", required = true) 13 | int id 14 | ) implements ApiResult { 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/StoryArea.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | import org.teleight.teleightbots.api.ApiResult; 6 | 7 | public record StoryArea( 8 | @JsonProperty(value = "position", required = true) 9 | @NotNull 10 | StoryAreaPosition position, 11 | 12 | @JsonProperty(value = "type", required = true) 13 | @NotNull 14 | StoryAreaType type 15 | ) implements ApiResult { 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/StoryAreaPosition.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.Range; 5 | import org.teleight.teleightbots.api.ApiResult; 6 | 7 | public record StoryAreaPosition( 8 | @JsonProperty(value = "x_percentage", required = true) 9 | float xPercentage, 10 | 11 | @JsonProperty(value = "y_percentage", required = true) 12 | float yPercentage, 13 | 14 | @JsonProperty(value = "width_percentage", required = true) 15 | float widthPercentage, 16 | 17 | @JsonProperty(value = "height_percentage", required = true) 18 | float heightPercentage, 19 | 20 | @JsonProperty(value = "rotation_angle", required = true) 21 | @Range(from = 0, to = 360) 22 | float rotationAngle, 23 | 24 | @JsonProperty(value = "corner_radius_percentage", required = true) 25 | float cornerRadiusPercentage 26 | ) implements ApiResult { 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/StoryAreaTypeLink.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | public record StoryAreaTypeLink( 7 | @JsonProperty(value = "url", required = true) 8 | @NotNull 9 | String url 10 | ) implements StoryAreaType { 11 | 12 | @Override 13 | public String type() { 14 | return "link"; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/StoryAreaTypeLocation.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.Nullable; 5 | 6 | public record StoryAreaTypeLocation( 7 | @JsonProperty(value = "latitude", required = true) 8 | float latitude, 9 | 10 | @JsonProperty(value = "longitude", required = true) 11 | float longitude, 12 | 13 | @JsonProperty(value = "address") 14 | @Nullable 15 | LocationAddress address 16 | ) implements StoryAreaType { 17 | 18 | @Override 19 | public String type() { 20 | return "location"; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/StoryAreaTypeSuggestedReaction.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | public record StoryAreaTypeSuggestedReaction( 7 | @JsonProperty(value = "reaction_type", required = true) 8 | @NotNull 9 | ReactionType reactionType, 10 | 11 | @JsonProperty(value = "is_dark") 12 | boolean isDark, 13 | 14 | @JsonProperty(value = "is_flipped") 15 | boolean isFlipped 16 | ) implements StoryAreaType { 17 | 18 | @Override 19 | public String type() { 20 | return "suggested_reaction"; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/StoryAreaTypeUniqueGift.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | public record StoryAreaTypeUniqueGift( 7 | @JsonProperty(value = "name", required = true) 8 | @NotNull 9 | String name 10 | ) implements StoryAreaType { 11 | 12 | @Override 13 | public String type() { 14 | return "unique_gift"; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/StoryAreaTypeWeather.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | import java.awt.Color; 7 | 8 | public record StoryAreaTypeWeather( 9 | @JsonProperty(value = "temperature", required = true) 10 | float temperature, 11 | 12 | @JsonProperty(value = "emoji", required = true) 13 | @NotNull 14 | String emoji, 15 | 16 | @JsonProperty(value = "background_color", required = true) 17 | @NotNull 18 | Color backgroundColor 19 | ) implements StoryAreaType { 20 | 21 | @Override 22 | public String type() { 23 | return "weather"; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/SwitchInlineQueryChosenChat.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.Nullable; 5 | import org.teleight.teleightbots.api.ApiResult; 6 | 7 | public record SwitchInlineQueryChosenChat( 8 | @JsonProperty(value = "query") 9 | @Nullable 10 | String query, 11 | 12 | @JsonProperty(value = "allow_user_chats") 13 | boolean allowUserChats, 14 | 15 | @JsonProperty(value = "allow_bot_chats") 16 | boolean allowBotChats, 17 | 18 | @JsonProperty(value = "allow_group_chats") 19 | boolean allowGroupChats, 20 | 21 | @JsonProperty(value = "allow_channel_chats") 22 | boolean allowChannelChats 23 | ) implements ApiResult { 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/TextQuote.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | import org.jetbrains.annotations.Nullable; 6 | import org.teleight.teleightbots.api.ApiResult; 7 | 8 | public record TextQuote( 9 | @JsonProperty(value = "text", required = true) 10 | @NotNull 11 | String text, 12 | 13 | @JsonProperty(value = "entities") 14 | @Nullable 15 | MessageEntity[] entities, 16 | 17 | @JsonProperty(value = "position") 18 | int position, 19 | 20 | @JsonProperty(value = "is_manual") 21 | boolean isManual 22 | ) implements ApiResult { 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/TransactionPartnerAffiliateProgram.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.Nullable; 5 | 6 | public record TransactionPartnerAffiliateProgram( 7 | @JsonProperty(value = "sponsor_user") 8 | @Nullable 9 | User sponsorUser, 10 | 11 | @JsonProperty(value = "commission_per_mille", required = true) 12 | int commissionPerMille 13 | ) implements TransactionPartner { 14 | 15 | @Override 16 | public String type() { 17 | return "affiliate_program"; 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/TransactionPartnerChat.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | import org.jetbrains.annotations.Nullable; 6 | 7 | public record TransactionPartnerChat( 8 | @JsonProperty(value = "chat", required = true) 9 | @NotNull 10 | Chat chat, 11 | 12 | @JsonProperty(value = "gift") 13 | @Nullable 14 | Gift gift 15 | ) implements TransactionPartner { 16 | 17 | @Override 18 | public String type() { 19 | return "chat"; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/TransactionPartnerFragment.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.Nullable; 5 | 6 | public record TransactionPartnerFragment( 7 | @JsonProperty(value = "withdrawal_state") 8 | @Nullable 9 | RevenueWithdrawalState withdrawalState 10 | ) implements TransactionPartner { 11 | 12 | @Override 13 | public String type() { 14 | return "fragment"; 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/TransactionPartnerOther.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | public record TransactionPartnerOther() implements TransactionPartner { 4 | 5 | @Override 6 | public String type() { 7 | return "other"; 8 | } 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/TransactionPartnerTelegramAds.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | public record TransactionPartnerTelegramAds() implements TransactionPartner { 4 | 5 | @Override 6 | public String type() { 7 | return "telegram_ads"; 8 | } 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/TransactionPartnerTelegramApi.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | 5 | public record TransactionPartnerTelegramApi( 6 | @JsonProperty(value = "request_count", required = true) 7 | int requestCount 8 | ) implements TransactionPartner { 9 | 10 | @Override 11 | public String type() { 12 | return "telegram_api"; 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/UniqueGift.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | import org.teleight.teleightbots.api.ApiResult; 6 | 7 | public record UniqueGift( 8 | @JsonProperty(value = "base_name", required = true) 9 | @NotNull 10 | String baseName, 11 | 12 | @JsonProperty(value = "name", required = true) 13 | @NotNull 14 | String name, 15 | 16 | @JsonProperty(value = "number", required = true) 17 | int number, 18 | 19 | @JsonProperty(value = "model", required = true) 20 | @NotNull 21 | UniqueGiftModel model, 22 | 23 | @JsonProperty(value = "symbol", required = true) 24 | @NotNull 25 | UniqueGiftSymbol symbol, 26 | 27 | @JsonProperty(value = "backdrop", required = true) 28 | @NotNull 29 | UniqueGiftBackdrop backdrop 30 | ) implements ApiResult { 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/UniqueGiftBackdrop.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | import org.teleight.teleightbots.api.ApiResult; 6 | 7 | public record UniqueGiftBackdrop( 8 | @JsonProperty(value = "name", required = true) 9 | @NotNull 10 | String name, 11 | 12 | @JsonProperty(value = "colors", required = true) 13 | @NotNull 14 | UniqueGiftBackdropColors colors, 15 | 16 | @JsonProperty(value = "rarity_per_mille", required = true) 17 | int rarityPerMille 18 | ) implements ApiResult { 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/UniqueGiftBackdropColors.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | import org.teleight.teleightbots.api.ApiResult; 6 | 7 | import java.awt.Color; 8 | 9 | public record UniqueGiftBackdropColors( 10 | @JsonProperty(value = "center_color", required = true) 11 | @NotNull 12 | Color centerColor, 13 | 14 | @JsonProperty(value = "edge_color", required = true) 15 | @NotNull 16 | Color edgeColor, 17 | 18 | @JsonProperty(value = "symbol_color", required = true) 19 | @NotNull 20 | Color symbolColor, 21 | 22 | @JsonProperty(value = "text_color", required = true) 23 | @NotNull 24 | Color textColor 25 | ) implements ApiResult { 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/UniqueGiftInfo.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | import org.jetbrains.annotations.Nullable; 6 | import org.teleight.teleightbots.api.ApiResult; 7 | 8 | public record UniqueGiftInfo( 9 | @JsonProperty(value = "gift", required = true) 10 | @NotNull 11 | UniqueGift gift, 12 | 13 | @JsonProperty(value = "origin", required = true) 14 | @NotNull 15 | UniqueGiftOrigin origin, 16 | 17 | @JsonProperty(value = "owned_gift_id") 18 | @Nullable 19 | String ownedGiftId, 20 | 21 | @JsonProperty(value = "transfer_star_count") 22 | @Nullable 23 | Integer transferStarCount 24 | ) implements ApiResult { 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/UniqueGiftModel.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | import org.teleight.teleightbots.api.ApiResult; 6 | 7 | public record UniqueGiftModel( 8 | @JsonProperty(value = "name", required = true) 9 | @NotNull 10 | String name, 11 | 12 | @JsonProperty(value = "sticker", required = true) 13 | @NotNull 14 | Sticker sticker, 15 | 16 | @JsonProperty(value = "rarity_per_mille", required = true) 17 | int rarityPerMille 18 | ) implements ApiResult { 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/UniqueGiftOrigin.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonCreator; 4 | import com.fasterxml.jackson.annotation.JsonValue; 5 | 6 | public enum UniqueGiftOrigin { 7 | 8 | UPGRADE("upgrade"), 9 | TRANSFER("transfer"); 10 | 11 | private final String fieldValue; 12 | 13 | UniqueGiftOrigin(String fieldValue) { 14 | this.fieldValue = fieldValue; 15 | } 16 | 17 | @JsonValue 18 | public String getFieldValue() { 19 | return fieldValue; 20 | } 21 | 22 | @JsonCreator 23 | public static UniqueGiftOrigin fromValue(String value) { 24 | for (UniqueGiftOrigin giftOrigin : UniqueGiftOrigin.values()) { 25 | if (giftOrigin.fieldValue.equalsIgnoreCase(value)) { 26 | return giftOrigin; 27 | } 28 | } 29 | throw new IllegalArgumentException("Unknown enum type " + value); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/UniqueGiftSymbol.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | import org.teleight.teleightbots.api.ApiResult; 6 | 7 | public record UniqueGiftSymbol( 8 | @JsonProperty(value = "name", required = true) 9 | @NotNull 10 | String name, 11 | 12 | @JsonProperty(value = "sticker", required = true) 13 | @NotNull 14 | Sticker sticker, 15 | 16 | @JsonProperty(value = "rarity_per_mille", required = true) 17 | int rarityPerMille 18 | ) implements ApiResult { 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/UserChatBoosts.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | import org.teleight.teleightbots.api.ApiResult; 6 | 7 | public record UserChatBoosts( 8 | @JsonProperty(value = "boosts", required = true) 9 | @NotNull 10 | ChatBoost[] boosts 11 | ) implements ApiResult { 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/UserProfilePhotos.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | import org.teleight.teleightbots.api.ApiResult; 6 | 7 | public record UserProfilePhotos( 8 | @JsonProperty(value = "total_count", required = true) 9 | int totalCount, 10 | 11 | @JsonProperty(value = "photos", required = true) 12 | @NotNull 13 | PhotoSize[][] photos 14 | ) implements ApiResult { 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/UsersShared.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | import org.teleight.teleightbots.api.ApiResult; 6 | 7 | public record UsersShared( 8 | @JsonProperty(value = "request_id", required = true) 9 | int requestId, 10 | 11 | @JsonProperty(value = "users", required = true) 12 | @NotNull 13 | SharedUser[] users 14 | ) implements ApiResult { 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/Venue.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.Nullable; 5 | import org.teleight.teleightbots.api.ApiResult; 6 | 7 | public record Venue( 8 | @JsonProperty(value = "location", required = true) 9 | Location location, 10 | 11 | @JsonProperty(value = "title", required = true) 12 | String title, 13 | 14 | @JsonProperty(value = "address", required = true) 15 | String address, 16 | 17 | @JsonProperty(value = "foursquare_id") 18 | @Nullable 19 | String foursquareId, 20 | 21 | @JsonProperty(value = "foursquare_type") 22 | @Nullable 23 | String foursquareType, 24 | 25 | @JsonProperty(value = "google_place_id") 26 | @Nullable 27 | String googlePlaceId, 28 | 29 | @JsonProperty(value = "google_place_type") 30 | @Nullable 31 | String googlePlaceType 32 | ) implements ApiResult { 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/VideoChatEnded.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.teleight.teleightbots.api.ApiResult; 5 | 6 | public record VideoChatEnded( 7 | @JsonProperty(value = "duration", required = true) 8 | int duration 9 | ) implements ApiResult { 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/VideoChatParticipantsInvited.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.teleight.teleightbots.api.ApiResult; 5 | import org.teleight.teleightbots.api.objects.User; 6 | 7 | public record VideoChatParticipantsInvited( 8 | @JsonProperty(value = "users", required = true) 9 | User[] users 10 | ) implements ApiResult { 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/VideoChatScheduled.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.teleight.teleightbots.api.ApiResult; 5 | 6 | import java.util.Date; 7 | 8 | public record VideoChatScheduled( 9 | @JsonProperty(value = "start_date", required = true) 10 | Date startDate 11 | ) implements ApiResult { 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/VideoChatStarted.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import org.teleight.teleightbots.api.ApiResult; 4 | 5 | public record VideoChatStarted() implements ApiResult { 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/VideoNote.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.Nullable; 5 | import org.teleight.teleightbots.api.ApiResult; 6 | 7 | public record VideoNote( 8 | @JsonProperty(value = "file_id", required = true) 9 | String fileId, 10 | 11 | @JsonProperty(value = "file_unique_id", required = true) 12 | String fileUniqueId, 13 | 14 | @JsonProperty(value = "length", required = true) 15 | int length, 16 | 17 | @JsonProperty(value = "duration", required = true) 18 | int duration, 19 | 20 | @JsonProperty(value = "thumbnail") 21 | @Nullable 22 | PhotoSize thumbnail, 23 | 24 | @JsonProperty(value = "file_size") 25 | @Nullable 26 | Long fileSize 27 | ) implements ApiResult { 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/Voice.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.Nullable; 5 | import org.teleight.teleightbots.api.ApiResult; 6 | 7 | public record Voice( 8 | @JsonProperty(value = "file_id", required = true) 9 | String fileId, 10 | 11 | @JsonProperty(value = "file_unique_id", required = true) 12 | String fileUniqueId, 13 | 14 | @JsonProperty(value = "duration", required = true) 15 | int duration, 16 | 17 | @JsonProperty(value = "mime_type") 18 | @Nullable 19 | String mimeType, 20 | 21 | @JsonProperty(value = "file_size") 22 | @Nullable 23 | Long fileSize 24 | ) implements ApiResult { 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/WebAppData.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.teleight.teleightbots.api.ApiResult; 5 | 6 | public record WebAppData( 7 | @JsonProperty(value = "data", required = true) 8 | String data, 9 | 10 | @JsonProperty(value = "button_text", required = true) 11 | String buttonText 12 | ) implements ApiResult { 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/WebAppInfo.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.NotNull; 5 | import org.teleight.teleightbots.api.ApiResult; 6 | 7 | public record WebAppInfo( 8 | @JsonProperty(value = "url", required = true) 9 | String url 10 | ) implements ApiResult { 11 | 12 | public static @NotNull WebAppInfo ofBuilder(@NotNull String url) { 13 | return new WebAppInfo(url); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/objects/WriteAccessAllowed.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.objects; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import org.jetbrains.annotations.Nullable; 5 | import org.teleight.teleightbots.api.ApiResult; 6 | 7 | public record WriteAccessAllowed( 8 | @JsonProperty(value = "from_request") 9 | boolean fromRequest, 10 | 11 | @JsonProperty(value = "web_app_name") 12 | @Nullable 13 | String webAppName, 14 | 15 | @JsonProperty(value = "from_attachment_menu") 16 | boolean fromAttachmentMenu 17 | ) implements ApiResult { 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/serialization/deserializers/ColorDeserializer.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.serialization.deserializers; 2 | 3 | import com.fasterxml.jackson.core.JsonParser; 4 | import com.fasterxml.jackson.databind.DeserializationContext; 5 | import com.fasterxml.jackson.databind.JsonDeserializer; 6 | 7 | import java.awt.*; 8 | import java.io.IOException; 9 | 10 | public class ColorDeserializer extends JsonDeserializer { 11 | 12 | @Override 13 | public Color deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException { 14 | return new Color(jsonParser.getIntValue()); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/serialization/deserializers/DateDeserializer.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.serialization.deserializers; 2 | 3 | import com.fasterxml.jackson.core.JsonParser; 4 | import com.fasterxml.jackson.databind.DeserializationContext; 5 | import com.fasterxml.jackson.databind.JsonDeserializer; 6 | 7 | import java.io.IOException; 8 | import java.util.Date; 9 | 10 | public class DateDeserializer extends JsonDeserializer { 11 | 12 | @Override 13 | public Date deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException { 14 | return new Date(jsonParser.getLongValue()); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/serialization/deserializers/LivePeriodDeserializer.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.serialization.deserializers; 2 | 3 | import com.fasterxml.jackson.core.JsonParser; 4 | import com.fasterxml.jackson.databind.DeserializationContext; 5 | import com.fasterxml.jackson.databind.JsonDeserializer; 6 | import org.teleight.teleightbots.api.objects.LivePeriod; 7 | 8 | import java.io.IOException; 9 | 10 | public class LivePeriodDeserializer extends JsonDeserializer { 11 | 12 | @Override 13 | public LivePeriod deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException { 14 | return LivePeriod.fromSeconds(jsonParser.getIntValue()); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/serialization/serializers/ColorSerializer.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.serialization.serializers; 2 | 3 | import com.fasterxml.jackson.core.JsonGenerator; 4 | import com.fasterxml.jackson.databind.JsonSerializer; 5 | import com.fasterxml.jackson.databind.SerializerProvider; 6 | 7 | import java.awt.*; 8 | import java.io.IOException; 9 | 10 | public class ColorSerializer extends JsonSerializer { 11 | 12 | @Override 13 | public void serialize(Color color, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { 14 | jsonGenerator.writeNumber(color.getRGB()); 15 | } 16 | 17 | } 18 | 19 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/serialization/serializers/DateSerializer.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.serialization.serializers; 2 | 3 | import com.fasterxml.jackson.core.JsonGenerator; 4 | import com.fasterxml.jackson.databind.JsonSerializer; 5 | import com.fasterxml.jackson.databind.SerializerProvider; 6 | 7 | import java.io.IOException; 8 | import java.util.Date; 9 | 10 | public class DateSerializer extends JsonSerializer { 11 | 12 | @Override 13 | public void serialize(Date date, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { 14 | jsonGenerator.writeNumber(date.getTime()); 15 | } 16 | 17 | } 18 | 19 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/serialization/serializers/InputFileSerializer.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.serialization.serializers; 2 | 3 | import com.fasterxml.jackson.core.JsonGenerator; 4 | import com.fasterxml.jackson.databind.JsonSerializer; 5 | import com.fasterxml.jackson.databind.SerializerProvider; 6 | import org.teleight.teleightbots.api.objects.InputFile; 7 | 8 | import java.io.IOException; 9 | 10 | public class InputFileSerializer extends JsonSerializer { 11 | 12 | @Override 13 | public void serialize(InputFile inputFile, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { 14 | if (inputFile.file() != null) { 15 | jsonGenerator.writeObject("attach://" + inputFile.fileName()); 16 | } else { 17 | jsonGenerator.writeObject(inputFile.id()); 18 | } 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/api/serialization/serializers/LivePeriodSerializer.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.api.serialization.serializers; 2 | 3 | import com.fasterxml.jackson.core.JsonGenerator; 4 | import com.fasterxml.jackson.databind.JsonSerializer; 5 | import com.fasterxml.jackson.databind.SerializerProvider; 6 | import org.teleight.teleightbots.api.objects.LivePeriod; 7 | 8 | import java.io.IOException; 9 | 10 | public class LivePeriodSerializer extends JsonSerializer { 11 | 12 | @Override 13 | public void serialize(LivePeriod color, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { 14 | jsonGenerator.writeNumber(color.getSeconds()); 15 | } 16 | 17 | } 18 | 19 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/commands/ExecutableCommand.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.commands; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.teleight.teleightbots.api.objects.User; 5 | 6 | /** 7 | * Interface for an executable command. 8 | */ 9 | public interface ExecutableCommand { 10 | 11 | /** 12 | * Executes the command. 13 | * 14 | * @param from the User who initiated the command 15 | */ 16 | void execute(@NotNull User from); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/commands/builder/CommandExecutor.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.commands.builder; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.teleight.teleightbots.api.objects.User; 5 | import org.teleight.teleightbots.commands.builder.parser.CommandContext; 6 | 7 | /** 8 | * Functional interface for a command executor. 9 | */ 10 | @FunctionalInterface 11 | public interface CommandExecutor { 12 | 13 | /** 14 | * Executes the command. 15 | * 16 | * @param sender the User who initiated the command 17 | * @param context the CommandContext associated with the command 18 | */ 19 | void execute(@NotNull User sender, @NotNull CommandContext context); 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/commands/builder/CommandSyntax.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.commands.builder; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.jetbrains.annotations.Nullable; 5 | import org.teleight.teleightbots.commands.builder.argument.Argument; 6 | import org.teleight.teleightbots.commands.builder.condition.CommandCondition; 7 | 8 | /** 9 | * Class representing a command syntax. 10 | * Every command can have multiple syntaxes, and this class is a representation of each syntax 11 | * 12 | * @param condition interface that checks if a command can be executed via certain conditions 13 | * @param executor the command executor 14 | * @param args array of command arguments 15 | */ 16 | public record CommandSyntax( 17 | @Nullable 18 | CommandCondition condition, 19 | 20 | @NotNull 21 | CommandExecutor executor, 22 | 23 | @NotNull 24 | Argument[] args) { 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/conversation/ConversationExecutor.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.conversation; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | /** 6 | * Represents an executor for a conversation. 7 | * 8 | *

9 | * Example usage: 10 | *

{@code
11 |  * Conversation testConversation = Conversation.ofBuilder("test", context -> {
12 |  *      String id = context.chat().id();
13 |  *      SendMessage message = SendMessage.ofBuilder(id, "Test conversation").build();
14 |  *      context.bot().execute(message);
15 |  * }).build();
16 |  * }
17 | */ 18 | @FunctionalInterface 19 | public interface ConversationExecutor { 20 | 21 | /** 22 | * Executes the conversation flow. 23 | * 24 | * @param context the context of the currently running conversation 25 | */ 26 | void execute(@NotNull ConversationContext context); 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/event/bot/BotShutdownEvent.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.event.bot; 2 | 3 | import org.teleight.teleightbots.bot.TelegramBot; 4 | import org.teleight.teleightbots.event.trait.Event; 5 | 6 | public record BotShutdownEvent( 7 | TelegramBot bot 8 | ) implements Event { 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/event/bot/MethodSendEvent.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.event.bot; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.teleight.teleightbots.api.ApiMethod; 5 | import org.teleight.teleightbots.bot.TelegramBot; 6 | import org.teleight.teleightbots.event.trait.Event; 7 | 8 | import java.io.Serializable; 9 | 10 | public record MethodSendEvent( 11 | @NotNull TelegramBot bot, 12 | @NotNull ApiMethod method, 13 | @NotNull R result 14 | ) implements Event { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/event/bot/UpdateReceivedEvent.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.event.bot; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.teleight.teleightbots.api.objects.Update; 5 | import org.teleight.teleightbots.bot.TelegramBot; 6 | import org.teleight.teleightbots.event.trait.Event; 7 | 8 | public record UpdateReceivedEvent( 9 | @NotNull TelegramBot bot, 10 | @NotNull Update update, 11 | @NotNull String json 12 | ) implements Event { 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/event/bot/channel/ChannelSendMessageEvent.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.event.bot.channel; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.teleight.teleightbots.api.objects.Chat; 5 | import org.teleight.teleightbots.api.objects.Message; 6 | import org.teleight.teleightbots.api.objects.Update; 7 | import org.teleight.teleightbots.bot.TelegramBot; 8 | import org.teleight.teleightbots.event.trait.Event; 9 | 10 | public record ChannelSendMessageEvent( 11 | @NotNull TelegramBot bot, 12 | @NotNull Update update, 13 | @NotNull Chat chat 14 | ) implements Event { 15 | 16 | public @NotNull Message channelPost(){ 17 | return update.channelPost(); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/event/bot/group/BotJoinGroupEvent.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.event.bot.group; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.teleight.teleightbots.api.objects.Chat; 5 | import org.teleight.teleightbots.api.objects.Update; 6 | import org.teleight.teleightbots.api.objects.User; 7 | import org.teleight.teleightbots.bot.TelegramBot; 8 | import org.teleight.teleightbots.event.trait.GroupBotEvent; 9 | 10 | public record BotJoinGroupEvent( 11 | @NotNull TelegramBot bot, 12 | @NotNull User user, 13 | @NotNull Chat chat, 14 | @NotNull Update update 15 | ) implements GroupBotEvent { 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/event/bot/group/BotQuitGroupEvent.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.event.bot.group; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.teleight.teleightbots.api.objects.Chat; 5 | import org.teleight.teleightbots.api.objects.Update; 6 | import org.teleight.teleightbots.api.objects.User; 7 | import org.teleight.teleightbots.bot.TelegramBot; 8 | import org.teleight.teleightbots.event.trait.GroupBotEvent; 9 | 10 | public record BotQuitGroupEvent( 11 | @NotNull TelegramBot bot, 12 | @NotNull User user, 13 | @NotNull Chat chat, 14 | @NotNull Update update 15 | ) implements GroupBotEvent { 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/event/bot/group/SelfJoinGroupEvent.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.event.bot.group; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.teleight.teleightbots.api.objects.Chat; 5 | import org.teleight.teleightbots.api.objects.Update; 6 | import org.teleight.teleightbots.api.objects.User; 7 | import org.teleight.teleightbots.bot.TelegramBot; 8 | import org.teleight.teleightbots.event.trait.GroupBotEvent; 9 | 10 | public record SelfJoinGroupEvent( 11 | @NotNull TelegramBot bot, 12 | @NotNull User user, 13 | @NotNull Chat chat, 14 | @NotNull Update update 15 | ) implements GroupBotEvent { 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/event/bot/group/SelfQuitGroupEvent.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.event.bot.group; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.teleight.teleightbots.api.objects.Chat; 5 | import org.teleight.teleightbots.api.objects.Update; 6 | import org.teleight.teleightbots.api.objects.User; 7 | import org.teleight.teleightbots.bot.TelegramBot; 8 | import org.teleight.teleightbots.event.trait.GroupBotEvent; 9 | 10 | public record SelfQuitGroupEvent( 11 | @NotNull TelegramBot bot, 12 | @NotNull User user, 13 | @NotNull Chat chat, 14 | @NotNull Update update 15 | ) implements GroupBotEvent { 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/event/trait/CancellableEvent.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.event.trait; 2 | 3 | /** 4 | * Interface for a cancellable event. 5 | */ 6 | public interface CancellableEvent extends Event { 7 | 8 | /** 9 | * Checks if the event is canceled. 10 | * 11 | * @return a boolean indicating whether the event is canceled 12 | */ 13 | boolean isCancelled(); 14 | 15 | /** 16 | * Sets the canceled status of the event. 17 | * 18 | * @param value the new canceled status of the event 19 | */ 20 | void setCancelled(boolean value); 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/event/trait/Event.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.event.trait; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.teleight.teleightbots.api.ApiMethod; 5 | import org.teleight.teleightbots.bot.TelegramBot; 6 | 7 | import java.io.Serializable; 8 | import java.util.concurrent.CompletableFuture; 9 | 10 | /** 11 | * Basic interface for an event. 12 | */ 13 | public interface Event { 14 | 15 | /** 16 | * Gets the Bot instance associated with the event. 17 | * 18 | * @return the Bot instance associated with the event 19 | */ 20 | @NotNull 21 | TelegramBot bot(); 22 | 23 | /** 24 | * Executes an API method. 25 | * 26 | * @param method the API method to be executed 27 | * @return a CompletableFuture that will complete with the result of the API method execution 28 | */ 29 | default @NotNull CompletableFuture execute(@NotNull ApiMethod method) { 30 | return bot().execute(method); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/event/trait/MessageEvent.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.event.trait; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.teleight.teleightbots.api.methods.SendMessage; 5 | import org.teleight.teleightbots.api.objects.Message; 6 | import org.teleight.teleightbots.api.objects.ReplyParameters; 7 | import org.teleight.teleightbots.api.objects.Update; 8 | 9 | import java.util.concurrent.CompletableFuture; 10 | 11 | public interface MessageEvent extends Event { 12 | 13 | Update update(); 14 | 15 | default @NotNull CompletableFuture reply(String text) { 16 | final Update update = update(); 17 | final Message message = update.message(); 18 | if (message == null) { 19 | return CompletableFuture.completedFuture(null); 20 | } 21 | return bot().execute(SendMessage.ofBuilder(message.chat().id(), text) 22 | .replyParameters(ReplyParameters.ofBuilder(message.messageId()).build()) 23 | .build() 24 | ); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/event/user/UserInlineQueryReceivedEvent.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.event.user; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.teleight.teleightbots.api.objects.InlineQuery; 5 | import org.teleight.teleightbots.api.objects.Update; 6 | import org.teleight.teleightbots.api.objects.User; 7 | import org.teleight.teleightbots.bot.TelegramBot; 8 | import org.teleight.teleightbots.event.trait.Event; 9 | 10 | public record UserInlineQueryReceivedEvent( 11 | @NotNull TelegramBot bot, 12 | @NotNull Update update 13 | ) implements Event { 14 | 15 | public @NotNull User user() { 16 | return update().inlineQuery().from(); 17 | } 18 | 19 | public @NotNull InlineQuery inlineQuery() { 20 | return update().inlineQuery(); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/event/user/UserMessageReceivedEvent.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.event.user; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.teleight.teleightbots.api.objects.Message; 5 | import org.teleight.teleightbots.api.objects.Update; 6 | import org.teleight.teleightbots.bot.TelegramBot; 7 | import org.teleight.teleightbots.event.trait.MessageEvent; 8 | 9 | public record UserMessageReceivedEvent( 10 | @NotNull TelegramBot bot, 11 | @NotNull Update update 12 | ) implements MessageEvent { 13 | 14 | @Override 15 | public @NotNull Update update() { 16 | return update; 17 | } 18 | 19 | public Message message(){ 20 | return update.message(); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/event/user/group/UserJoinGroupEvent.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.event.user.group; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.teleight.teleightbots.api.objects.Chat; 5 | import org.teleight.teleightbots.api.objects.Update; 6 | import org.teleight.teleightbots.api.objects.User; 7 | import org.teleight.teleightbots.bot.TelegramBot; 8 | import org.teleight.teleightbots.event.trait.Event; 9 | 10 | public record UserJoinGroupEvent( 11 | @NotNull TelegramBot bot, 12 | @NotNull User user, 13 | @NotNull Chat chat, 14 | @NotNull Update update 15 | ) implements Event { 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/event/user/group/UserQuitGroupEvent.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.event.user.group; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.teleight.teleightbots.api.objects.Chat; 5 | import org.teleight.teleightbots.api.objects.Update; 6 | import org.teleight.teleightbots.api.objects.User; 7 | import org.teleight.teleightbots.bot.TelegramBot; 8 | import org.teleight.teleightbots.event.trait.Event; 9 | 10 | public record UserQuitGroupEvent( 11 | @NotNull TelegramBot bot, 12 | @NotNull User user, 13 | @NotNull Chat chat, 14 | @NotNull Update update 15 | ) implements Event { 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/exception/ExceptionHandler.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.exception; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | /** 6 | * Interface representing an exception handler. 7 | */ 8 | @FunctionalInterface 9 | public interface ExceptionHandler { 10 | 11 | /** 12 | * Handles the provided exception. 13 | * 14 | * @param t the exception to be handled 15 | */ 16 | void handleException(@NotNull Throwable t); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/exception/ExceptionManager.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.exception; 2 | 3 | import org.jetbrains.annotations.Nullable; 4 | import org.teleight.teleightbots.TeleightBots; 5 | 6 | public class ExceptionManager { 7 | 8 | private ExceptionHandler exceptionHandler; 9 | 10 | public void handleException(Throwable e) { 11 | if (e instanceof OutOfMemoryError) { 12 | // OOM should be handled manually 13 | //noinspection CallToPrintStackTrace 14 | e.printStackTrace(); 15 | TeleightBots.stopCleanly(); 16 | return; 17 | } 18 | getExceptionHandler().handleException(e); 19 | } 20 | 21 | public ExceptionHandler getExceptionHandler() { 22 | return exceptionHandler == null ? exceptionHandler = Throwable::printStackTrace : exceptionHandler; 23 | } 24 | 25 | public void setExceptionHandler(@Nullable ExceptionHandler exceptionHandler) { 26 | this.exceptionHandler = exceptionHandler; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/exception/exceptions/RateLimitException.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.exception.exceptions; 2 | 3 | public class RateLimitException extends TelegramRequestException { 4 | 5 | public RateLimitException() { 6 | super(); 7 | } 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/extensions/Extension.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.extensions; 2 | 3 | import org.teleight.teleightbots.bot.TelegramBot; 4 | 5 | /** 6 | * Blueprint for creating different types of extensions for the bot. Each extension has a reference to the bot 7 | */ 8 | public abstract class Extension { 9 | 10 | // A reference to the bot that this extension is associated with. 11 | protected final TelegramBot bot; 12 | 13 | /** 14 | * The constructor for the Extension class. 15 | * 16 | * @param bot The bot that this extension is associated with. 17 | */ 18 | public Extension(TelegramBot bot) { 19 | this.bot = bot; 20 | } 21 | 22 | /** 23 | * Method used when the extension is started. 24 | */ 25 | public abstract void start(); 26 | 27 | /** 28 | * Method used when the extension is shut down. 29 | */ 30 | public abstract void shutdown(); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/extensions/ExtensionClassLoader.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.extensions; 2 | 3 | import java.net.URL; 4 | import java.net.URLClassLoader; 5 | 6 | class ExtensionClassLoader extends URLClassLoader { 7 | 8 | public ExtensionClassLoader(URL[] urls) { 9 | super(urls); 10 | } 11 | 12 | public ExtensionClassLoader(URL[] urls, ClassLoader parent) { 13 | super(urls, parent); 14 | } 15 | 16 | public void addURL(URL url) { 17 | super.addURL(url); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/extensions/annotation/ExtensionInfo.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.extensions.annotation; 2 | 3 | /** 4 | * Annotation used to get metadata about an extension. 5 | */ 6 | public @interface ExtensionInfo { 7 | 8 | /** 9 | * Represents the name of the extension. 10 | * @return The name of the extension. 11 | */ 12 | String name(); 13 | 14 | /** 15 | * Represents the version of the extension. 16 | * @return The version of the extension. 17 | */ 18 | String version(); 19 | 20 | /** 21 | * Represents the parent bot's username of the extension. 22 | *

23 | * The parent bot is the bot where the extension gets its updates from. 24 | *

25 | * @return The parent bot's username of the extension. 26 | */ 27 | String parentBot(); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/extensions/annotation/ExtensionInfoFile.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.extensions.annotation; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | @JsonIgnoreProperties(ignoreUnknown = true) 8 | public record ExtensionInfoFile( 9 | @JsonProperty(value = "name") 10 | String name, 11 | 12 | @JsonProperty(value = "version") 13 | String version, 14 | 15 | @JsonProperty(value = "parentBot") 16 | String parentBot, 17 | 18 | @JsonProperty(value = "mainClass") 19 | String mainClass 20 | ) { 21 | 22 | @NotNull 23 | public static ExtensionInfoFile fromAnnotation(@NotNull ExtensionInfo extensionInfoFile, @NotNull String mainClass) { 24 | return new ExtensionInfoFile(extensionInfoFile.name(), extensionInfoFile.version(), extensionInfoFile.parentBot(), mainClass); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/files/DownloadFileException.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.files; 2 | 3 | /** 4 | * Class representing a download file exception. 5 | *

6 | * It is thrown when a file cannot be downloaded. 7 | */ 8 | public final class DownloadFileException extends RuntimeException { 9 | 10 | /** 11 | * Constructs a DownloadFileException with the specified message. 12 | * 13 | * @param message the detail message, saved for later retrieval by the getMessage() method 14 | */ 15 | public DownloadFileException(String message) { 16 | super(message); 17 | } 18 | 19 | /** 20 | * Constructs a DownloadFileException with the specified message and cause. 21 | * 22 | * @param message the detail message, saved for later retrieval by the getMessage() method 23 | * @param cause the cause of the exception 24 | */ 25 | public DownloadFileException(String message, Throwable cause) { 26 | super(message, cause); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/updateprocessor/events/CallbackQueryEventProcessor.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.updateprocessor.events; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.teleight.teleightbots.api.objects.Update; 5 | import org.teleight.teleightbots.bot.TelegramBot; 6 | import org.teleight.teleightbots.event.keyboard.ButtonPressEvent; 7 | 8 | public final class CallbackQueryEventProcessor implements EventProcessor { 9 | @Override 10 | public void processUpdate(@NotNull TelegramBot bot, @NotNull Update update) { 11 | if (update.callbackQuery() == null) return; 12 | final ButtonPressEvent buttonPressEvent = new ButtonPressEvent(bot, update); 13 | bot.getMenuManager().getEventNode().call(buttonPressEvent); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/updateprocessor/events/EventProcessor.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.updateprocessor.events; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.teleight.teleightbots.api.objects.Update; 5 | import org.teleight.teleightbots.bot.TelegramBot; 6 | 7 | public sealed interface EventProcessor permits 8 | CallbackQueryEventProcessor, 9 | ChannelPostEventProcessor, 10 | InlineQueryEventProcessor, 11 | MessageEventProcessor, 12 | ChatMemberStatusEventProcessor { 13 | 14 | void processUpdate(@NotNull TelegramBot bot, @NotNull Update update); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/org/teleight/teleightbots/updateprocessor/events/InlineQueryEventProcessor.java: -------------------------------------------------------------------------------- 1 | package org.teleight.teleightbots.updateprocessor.events; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.teleight.teleightbots.api.objects.Update; 5 | import org.teleight.teleightbots.bot.TelegramBot; 6 | import org.teleight.teleightbots.event.user.UserInlineQueryReceivedEvent; 7 | 8 | public final class InlineQueryEventProcessor implements EventProcessor { 9 | @Override 10 | public void processUpdate(@NotNull TelegramBot bot, @NotNull Update update) { 11 | if (update.inlineQuery() != null) { 12 | bot.getEventManager().call(new UserInlineQueryReceivedEvent(bot, update)); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/resources/META-INF/services/javax.annotation.processing.Processor: -------------------------------------------------------------------------------- 1 | org.teleight.teleightbots.extensions.annotation.ExtensionAnnotationProcessor --------------------------------------------------------------------------------