Skip to content

Commit

Permalink
Telegram Bot API July 1, 2024 updates (v7.6)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnspade committed Jul 1, 2024
1 parent 3a7259c commit c48bfcc
Show file tree
Hide file tree
Showing 25 changed files with 459 additions and 51 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# F[Tg] - Telegramium

[![Telegram](https://img.shields.io/badge/Telegram%20Bot%20API-7.5%20(June%2018%2C%202024)-blue)](https://core.telegram.org/bots/api#recent-changes)
[![Telegram](https://img.shields.io/badge/Telegram%20Bot%20API-7.6%20(July%201%2C%202024)-blue)](https://core.telegram.org/bots/api#recent-changes)
[![Scala Steward badge](https://img.shields.io/badge/Scala_Steward-helping-blue.svg?style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAQCAMAAAARSr4IAAAAVFBMVEUAAACHjojlOy5NWlrKzcYRKjGFjIbp293YycuLa3pYY2LSqql4f3pCUFTgSjNodYRmcXUsPD/NTTbjRS+2jomhgnzNc223cGvZS0HaSD0XLjbaSjElhIr+AAAAAXRSTlMAQObYZgAAAHlJREFUCNdNyosOwyAIhWHAQS1Vt7a77/3fcxxdmv0xwmckutAR1nkm4ggbyEcg/wWmlGLDAA3oL50xi6fk5ffZ3E2E3QfZDCcCN2YtbEWZt+Drc6u6rlqv7Uk0LdKqqr5rk2UCRXOk0vmQKGfc94nOJyQjouF9H/wCc9gECEYfONoAAAAASUVORK5CYII=)](https://scala-steward.org)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.github.apimorphism/telegramium-core_2.13/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.github.apimorphism/telegramium-core_2.13)

Expand Down
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
enablePlugins(GitPlugin)

ThisBuild / version := Version.mkVersion(
"9.75.0",
"9.76.0",
git.gitCurrentBranch.value,
git.gitDescribedVersion.value,
git.gitUncommittedChanges.value
Expand Down
12 changes: 6 additions & 6 deletions telegramium-core/src/main/scala/telegramium/bots/Animation.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ package telegramium.bots
* Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used
* to download or reuse the file.
* @param width
* Video width as defined by sender
* Video width as defined by the sender
* @param height
* Video height as defined by sender
* Video height as defined by the sender
* @param duration
* Duration of the video in seconds as defined by sender
* Duration of the video in seconds as defined by the sender
* @param thumbnail
* Optional. Animation thumbnail as defined by sender
* Optional. Animation thumbnail as defined by the sender
* @param fileName
* Optional. Original animation filename as defined by sender
* Optional. Original animation filename as defined by the sender
* @param mimeType
* Optional. MIME type of the file as defined by sender
* Optional. MIME type of the file as defined by the sender
* @param fileSize
* Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have
* difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer
Expand Down
10 changes: 5 additions & 5 deletions telegramium-core/src/main/scala/telegramium/bots/Audio.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ package telegramium.bots
* Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used
* to download or reuse the file.
* @param duration
* Duration of the audio in seconds as defined by sender
* Duration of the audio in seconds as defined by the sender
* @param performer
* Optional. Performer of the audio as defined by sender or by audio tags
* Optional. Performer of the audio as defined by the sender or by audio tags
* @param title
* Optional. Title of the audio as defined by sender or by audio tags
* Optional. Title of the audio as defined by the sender or by audio tags
* @param fileName
* Optional. Original filename as defined by sender
* Optional. Original filename as defined by the sender
* @param mimeType
* Optional. MIME type of the file as defined by sender
* Optional. MIME type of the file as defined by the sender
* @param fileSize
* Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have
* difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ package telegramium.bots
* Optional. The most recent pinned message (by sending date)
* @param permissions
* Optional. Default chat member permissions, for groups and supergroups
* @param canSendPaidMedia
* Optional. True, if paid media messages can be sent or forwarded to the channel chat. The field is available only
* for channel chats.
* @param slowModeDelay
* Optional. For supergroups, the minimum allowed delay between consecutive messages sent by each unprivileged user;
* in seconds
Expand Down Expand Up @@ -136,6 +139,7 @@ final case class ChatFullInfo(
inviteLink: Option[String] = Option.empty,
pinnedMessage: Option[Message] = Option.empty,
permissions: Option[ChatPermissions] = Option.empty,
canSendPaidMedia: Option[Boolean] = Option.empty,
slowModeDelay: Option[Int] = Option.empty,
unrestrictBoostCount: Option[Int] = Option.empty,
messageAutoDeleteTime: Option[Int] = Option.empty,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ package telegramium.bots
* Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used
* to download or reuse the file.
* @param thumbnail
* Optional. Document thumbnail as defined by sender
* Optional. Document thumbnail as defined by the sender
* @param fileName
* Optional. Original filename as defined by sender
* Optional. Original filename as defined by the sender
* @param mimeType
* Optional. MIME type of the file as defined by sender
* Optional. MIME type of the file as defined by the sender
* @param fileSize
* Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have
* difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ package telegramium.bots
* Optional. Message is an audio file, information about the file
* @param document
* Optional. Message is a general file, information about the file
* @param paidMedia
* Optional. Message contains paid media; information about the paid media
* @param photo
* Optional. Message is a photo, available sizes of the photo
* @param sticker
Expand Down Expand Up @@ -59,6 +61,7 @@ final case class ExternalReplyInfo(
animation: Option[Animation] = Option.empty,
audio: Option[Audio] = Option.empty,
document: Option[Document] = Option.empty,
paidMedia: Option[PaidMediaInfo] = Option.empty,
photo: List[PhotoSize] = List.empty,
sticker: Option[Sticker] = Option.empty,
story: Option[Story] = Option.empty,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package telegramium.bots

sealed trait InputPaidMedia {}

/** The paid media to send is a photo.
*
* @param media
* File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL
* for Telegram to get a file from the Internet, or pass “attach://<file_attach_name>” to upload a new one using
* multipart/form-data under <file_attach_name> name.
*/
final case class InputPaidMediaPhoto(media: String) extends InputPaidMedia

/** The paid media to send is a video.
*
* @param media
* File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL
* for Telegram to get a file from the Internet, or pass “attach://<file_attach_name>” to upload a new one using
* multipart/form-data under <file_attach_name> name.
* @param thumbnail
* Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported
* server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height
* should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused
* and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was
* uploaded using multipart/form-data under <file_attach_name>.
* @param width
* Optional. Video width
* @param height
* Optional. Video height
* @param duration
* Optional. Video duration in seconds
* @param supportsStreaming
* Optional. Pass True if the uploaded video is suitable for streaming
*/
final case class InputPaidMediaVideo(
media: String,
thumbnail: Option[IFile] = Option.empty,
width: Option[Int] = Option.empty,
height: Option[Int] = Option.empty,
duration: Option[Int] = Option.empty,
supportsStreaming: Option[Boolean] = Option.empty
) extends InputPaidMedia
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package telegramium.bots

/** This object contains information about one answer option in a poll to send.
/** This object contains information about one answer option in a poll to be sent.
*
* @param text
* Option text, 1-100 characters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package telegramium.bots
/** This object represents a point on the map.
*
* @param latitude
* Latitude as defined by sender
* Latitude as defined by the sender
* @param longitude
* Longitude as defined by sender
* Longitude as defined by the sender
* @param horizontalAccuracy
* Optional. The radius of uncertainty for the location, measured in meters; 0-1500
* @param livePeriod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ sealed trait MaybeInaccessibleMessage {}
* Optional. Message is an audio file, information about the file
* @param document
* Optional. Message is a general file, information about the file
* @param paidMedia
* Optional. Message contains paid media; information about the paid media
* @param photo
* Optional. Message is a photo, available sizes of the photo
* @param sticker
Expand All @@ -88,7 +90,7 @@ sealed trait MaybeInaccessibleMessage {}
* @param voice
* Optional. Message is a voice message, information about the file
* @param caption
* Optional. Caption for the animation, audio, document, photo, video or voice
* Optional. Caption for the animation, audio, document, paid media, photo, video or voice
* @param captionEntities
* Optional. For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in
* the caption
Expand Down Expand Up @@ -231,6 +233,7 @@ final case class Message(
animation: Option[Animation] = Option.empty,
audio: Option[Audio] = Option.empty,
document: Option[Document] = Option.empty,
paidMedia: Option[PaidMediaInfo] = Option.empty,
photo: List[PhotoSize] = List.empty,
sticker: Option[Sticker] = Option.empty,
story: Option[Story] = Option.empty,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ case object MenuButtonDefault extends MenuButton
* Text on the button
* @param webApp
* Description of the Web App that will be launched when the user presses the button. The Web App will be able to
* send an arbitrary message on behalf of the user using the method answerWebAppQuery.
* send an arbitrary message on behalf of the user using the method answerWebAppQuery. Alternatively, a t.me link to
* a Web App of the bot can be specified in the object instead of the Web App's URL, in which case the Web App will
* be opened as if the user pressed the link.
*/
final case class MenuButtonWebApp(text: String, webApp: WebAppInfo) extends MenuButton

Expand Down
32 changes: 32 additions & 0 deletions telegramium-core/src/main/scala/telegramium/bots/PaidMedia.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package telegramium.bots

sealed trait PaidMedia {}

/** The paid media is a video.
*
* @param video
* The video
*/
final case class PaidMediaVideo(video: Video) extends PaidMedia

/** The paid media is a photo.
*
* @param photo
* The photo
*/
final case class PaidMediaPhoto(photo: List[PhotoSize] = List.empty) extends PaidMedia

/** The paid media isn't available before the payment.
*
* @param width
* Optional. Media width as defined by the sender
* @param height
* Optional. Media height as defined by the sender
* @param duration
* Optional. Duration of the media in seconds as defined by the sender
*/
final case class PaidMediaPreview(
width: Option[Int] = Option.empty,
height: Option[Int] = Option.empty,
duration: Option[Int] = Option.empty
) extends PaidMedia
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package telegramium.bots

/** Describes the paid media added to a message.
*
* @param starCount
* The number of Telegram Stars that must be paid to buy access to the media
* @param paidMedia
* Information about the paid media
*/
final case class PaidMediaInfo(starCount: Int, paidMedia: List[iozhik.OpenEnum[PaidMedia]] = List.empty)
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ package telegramium.bots
* 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal
* point for each currency (2 for the majority of currencies).
* @param invoicePayload
* Bot specified invoice payload
* Bot-specified invoice payload
* @param shippingOptionId
* Optional. Identifier of the shipping option chosen by the user
* @param orderInfo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package telegramium.bots
* @param from
* User who sent the query
* @param invoicePayload
* Bot specified invoice payload
* Bot-specified invoice payload
* @param shippingAddress
* User specified shipping address
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ package telegramium.bots
* 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal
* point for each currency (2 for the majority of currencies).
* @param invoicePayload
* Bot specified invoice payload
* Bot-specified invoice payload
* @param telegramPaymentChargeId
* Telegram payment identifier
* @param providerPaymentChargeId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,18 @@ sealed trait TransactionPartner {}
/** Describes a transaction with an unknown source or recipient. */
case object TransactionPartnerOther extends TransactionPartner

/** Describes a withdrawal transaction to the Telegram Ads platform. */
case object TransactionPartnerTelegramAds extends TransactionPartner

/** Describes a transaction with a user.
*
* @param user
* Information about the user
* @param invoicePayload
* Optional. Bot-specified invoice payload
*/
final case class TransactionPartnerUser(user: User) extends TransactionPartner
final case class TransactionPartnerUser(user: User, invoicePayload: Option[String] = Option.empty)
extends TransactionPartner

/** Describes a withdrawal transaction with Fragment.
*
Expand Down
10 changes: 5 additions & 5 deletions telegramium-core/src/main/scala/telegramium/bots/Video.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ package telegramium.bots
* Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used
* to download or reuse the file.
* @param width
* Video width as defined by sender
* Video width as defined by the sender
* @param height
* Video height as defined by sender
* Video height as defined by the sender
* @param duration
* Duration of the video in seconds as defined by sender
* Duration of the video in seconds as defined by the sender
* @param thumbnail
* Optional. Video thumbnail
* @param fileName
* Optional. Original filename as defined by sender
* Optional. Original filename as defined by the sender
* @param mimeType
* Optional. MIME type of the file as defined by sender
* Optional. MIME type of the file as defined by the sender
* @param fileSize
* Optional. File size in bytes. It can be bigger than 2&#94;31 and some programming languages may have
* difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ package telegramium.bots
* Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used
* to download or reuse the file.
* @param length
* Video width and height (diameter of the video message) as defined by sender
* Video width and height (diameter of the video message) as defined by the sender
* @param duration
* Duration of the video in seconds as defined by sender
* Duration of the video in seconds as defined by the sender
* @param thumbnail
* Optional. Video thumbnail
* @param fileSize
Expand Down
4 changes: 2 additions & 2 deletions telegramium-core/src/main/scala/telegramium/bots/Voice.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ package telegramium.bots
* Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used
* to download or reuse the file.
* @param duration
* Duration of the audio in seconds as defined by sender
* Duration of the audio in seconds as defined by the sender
* @param mimeType
* Optional. MIME type of the file as defined by sender
* Optional. MIME type of the file as defined by the sender
* @param fileSize
* Optional. File size in bytes. It can be bigger than 2&#94;31 and some programming languages may have
* difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer
Expand Down
Loading

0 comments on commit c48bfcc

Please sign in to comment.