Skip to content

BOT API v9.0 #424

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 34 commits into
base: master
Choose a base branch
from
Open

BOT API v9.0 #424

wants to merge 34 commits into from

Conversation

mircoianese
Copy link
Collaborator

@mircoianese mircoianese commented Jun 11, 2025

Hello,

This draft PR introduces support for the latest BOT API version (v9.0).

There are quite a few changes, so I'm working on implementing them incrementally.
I'm doing this in Kotlin, which I’m not very experienced with...any suggestions / corrections / explanations are very welcome (thanks!).

Business Accounts

Mini Apps

  • Added the field DeviceStorage, allowing Mini Apps to use persistent local storage on the user's device.
  • Added the field SecureStorage, allowing Mini Apps to use a secure local storage on the user's device for sensitive data.

Gifts

Telegram Premium

  • Added the method giftPremiumSubscription, allowing bots to gift a user a Telegram Premium subscription paid in Telegram Stars.
  • Added the field premium_subscription_duration to the class TransactionPartnerUser for transactions involving a Telegram Premium subscription purchased by the bot.
  • Added the field transaction_type to the class TransactionPartnerUser, simplifying the differentiation and processing of all transaction types.

General

  • Increased the maximum price for paid media to 10000 Telegram Stars.
  • Increased the maximum price for a subscription period to 10000 Telegram Stars.
  • Added the class PaidMessagePriceChanged and the field paid_message_price_changed to the class Message, describing a service message about a price change for paid messages sent to the chat.
  • Added the field paid_star_count to the class Message, containing the number of Telegram Stars that were paid to send the message.

…th the field rights of the type BusinessBotRights in the class BusinessConnection
…messages as read on behalf of a business account.
…first and last name of a managed business account.
…countProfilePhoto, allowing bots to change the profile photo of a managed business account.
…ftSettings, allowing bots to change the privacy settings pertaining to incoming gifts in a managed business account.
…ce, allowing bots to check the current Telegram Star balance of a managed business account.
…fer Telegram Stars from the balance of a managed business account to their own balance for withdrawal.
…he method getBusinessAccountGifts, allowing bots to fetch the list of gifts owned by a managed business account.
…eceived by a managed business account to Telegram Stars.
…received by a managed business account to unique gifts.
…yAreaTypeLocation, StoryAreaTypeSuggestedReaction, StoryAreaTypeLink, StoryAreaTypeWeather and StoryAreaTypeUniqueGift, describing clickable active areas on stories.
…eviously posted on behalf of a managed business account.
…d previously posted on behalf of a managed business account.
…opColors, and UniqueGiftBackdrop to describe the properties of a unique gift.
…f the type AcceptedGiftTypes in the class ChatFullInfo.
…cribing a service message about a regular gift that was sent or received.
… Message, describing a service message about a unique gift that was sent or received.
…r a Telegram Premium subscription paid in Telegram Stars.
…ice_changed to the class Message, describing a service message about a price change for paid messages sent to the chat.
…number of Telegram Stars that were paid to send the message.
@mircoianese mircoianese requested a review from Copilot June 11, 2025 17:36
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR upgrades the Java/Kotlin client to Telegram BOT API v9.0 by adding new business-account endpoints, gift/star models, story components, and mini-app storage fields, along with updating core message/chat classes, bumping the library version, and refreshing docs.

  • Introduce new data models and methods for business accounts, gifts (regular & unique), stars, and stories
  • Extend Message and ChatFullInfo to handle gift-related service messages and accepted gift types
  • Bump version to 9.0.0 and update README for both English and Russian docs

Reviewed Changes

Copilot reviewed 62 out of 62 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
UniqueGiftModel.kt Add model for unique gift metadata
UniqueGiftInfo.kt Add service info wrapper for a unique gift
UniqueGiftBackdropColors.kt Add unique gift backdrop color palette
UniqueGiftBackdrop.kt Add unique gift backdrop model
UniqueGift.kt Add top-level unique gift model
OwnedGifts.kt Add container for a user’s owned gifts
OwnedGiftUnique.kt Add class for a unique owned gift
OwnedGiftRegular.kt Add builder-style class for a regular owned gift
OwnedGift.kt Add base class for owned gifts
GiftInfo.kt Add service info wrapper for a regular gift
AcceptedGiftTypes.kt Add model describing which gift types a chat accepts
BusinessConnection.java Replace deprecated can_reply with new rights field
BusinessBotRights.kt Add rights model for business bots
PaidMessagePriceChanged.kt Add model for paid message price-change service messages
Message.java Extend with gift, unique_gift, paid_message_price_changed, paid_star_count
LocationAddress.kt Add builder for address components in story areas
ChatFullInfo.java Replace deprecated can_send_gift with acceptedGiftTypes
gradle.properties Bump library version to 9.0.0
README_RU.md Update Russian README to v9.0
README.md Update English README to v9.0
Comments suppressed due to low confidence (1)

library/src/main/java/com/pengrad/telegrambot/model/gift/owned/OwnedGiftRegular.kt:7

  • There are no unit tests covering the builder methods and JSON serialization of OwnedGiftRegular. Consider adding tests to validate that each apply-style setter and the overall serialization/deserialization behave as expected.
class OwnedGiftRegular private constructor(

Repository owner deleted a comment from Copilot AI Jun 11, 2025
@mircoianese mircoianese marked this pull request as ready for review June 11, 2025 17:43
@mircoianese mircoianese requested review from pengrad and anfanik June 11, 2025 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant