Skip to content

Commit a5b40a9

Browse files
committed
Telegram Bot API May 6, 2024 updates (v7.3)
1 parent 02f8795 commit a5b40a9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+842
-367
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# F[Tg] - Telegramium
22

3-
[![Telegram](https://img.shields.io/badge/Telegram%20Bot%20API-7.2%20(March%2031%2C%202024)-blue)](https://core.telegram.org/bots/api#recent-changes)
3+
[![Telegram](https://img.shields.io/badge/Telegram%20Bot%20API-7.3%20(May%206%2C%202024)-blue)](https://core.telegram.org/bots/api#recent-changes)
44
[![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)
55
[![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)
66

build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
enablePlugins(GitPlugin)
22

33
ThisBuild / version := Version.mkVersion(
4-
"8.72.0",
4+
"8.73.0",
55
git.gitCurrentBranch.value,
66
git.gitDescribedVersion.value,
77
git.gitUncommittedChanges.value
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package telegramium.bots
2+
3+
sealed trait BackgroundFill {}
4+
5+
/** The background is a gradient fill.
6+
*
7+
* @param topColor
8+
* Top color of the gradient in the RGB24 format
9+
* @param bottomColor
10+
* Bottom color of the gradient in the RGB24 format
11+
* @param rotationAngle
12+
* Clockwise rotation angle of the background fill in degrees; 0-359
13+
*/
14+
final case class BackgroundFillGradient(topColor: Int, bottomColor: Int, rotationAngle: Int) extends BackgroundFill
15+
16+
/** The background is a freeform gradient that rotates after every message in the chat.
17+
*
18+
* @param colors
19+
* A list of the 3 or 4 base colors that are used to generate the freeform gradient in the RGB24 format
20+
*/
21+
final case class BackgroundFillFreeformGradient(colors: List[Int] = List.empty) extends BackgroundFill
22+
23+
/** The background is filled using the selected color.
24+
*
25+
* @param color
26+
* The color of the background fill in the RGB24 format
27+
*/
28+
final case class BackgroundFillSolid(color: Int) extends BackgroundFill
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
package telegramium.bots
2+
3+
sealed trait BackgroundType {}
4+
5+
/** The background is a wallpaper in the JPEG format.
6+
*
7+
* @param document
8+
* Document with the wallpaper
9+
* @param darkThemeDimming
10+
* Dimming of the background in dark themes, as a percentage; 0-100
11+
* @param isBlurred
12+
* Optional. True, if the wallpaper is downscaled to fit in a 450x450 square and then box-blurred with radius 12
13+
* @param isMoving
14+
* Optional. True, if the background moves slightly when the device is tilted
15+
*/
16+
final case class BackgroundTypeWallpaper(
17+
document: Document,
18+
darkThemeDimming: Int,
19+
isBlurred: Option[Boolean] = Option.empty,
20+
isMoving: Option[Boolean] = Option.empty
21+
) extends BackgroundType
22+
23+
/** The background is a PNG or TGV (gzipped subset of SVG with MIME type “application/x-tgwallpattern”) pattern to be
24+
* combined with the background fill chosen by the user.
25+
*
26+
* @param document
27+
* Document with the pattern
28+
* @param fill
29+
* The background fill that is combined with the pattern
30+
* @param intensity
31+
* Intensity of the pattern when it is shown above the filled background; 0-100
32+
* @param isInverted
33+
* Optional. True, if the background fill must be applied only to the pattern itself. All other pixels are black in
34+
* this case. For dark themes only
35+
* @param isMoving
36+
* Optional. True, if the background moves slightly when the device is tilted
37+
*/
38+
final case class BackgroundTypePattern(
39+
document: Document,
40+
fill: BackgroundFill,
41+
intensity: Int,
42+
isInverted: Option[Boolean] = Option.empty,
43+
isMoving: Option[Boolean] = Option.empty
44+
) extends BackgroundType
45+
46+
/** The background is taken directly from a built-in chat theme.
47+
*
48+
* @param themeName
49+
* Name of the chat theme, which is usually an emoji
50+
*/
51+
final case class BackgroundTypeChatTheme(themeName: String) extends BackgroundType
52+
53+
/** The background is automatically filled based on the selected colors.
54+
*
55+
* @param fill
56+
* The background fill
57+
* @param darkThemeDimming
58+
* Dimming of the background in dark themes, as a percentage; 0-100
59+
*/
60+
final case class BackgroundTypeFill(fill: BackgroundFill, darkThemeDimming: Int) extends BackgroundType

telegramium-core/src/main/scala/telegramium/bots/Birthdate.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package telegramium.bots
22

3-
/** @param day
3+
/** Describes the birthdate of a user.
4+
*
5+
* @param day
46
* Day of the user's birth; 1-31
57
* @param month
68
* Month of the user's birth; 1-12

telegramium-core/src/main/scala/telegramium/bots/BusinessIntro.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package telegramium.bots
22

3-
/** @param title
3+
/** Contains information about the start page settings of a Telegram Business account.
4+
*
5+
* @param title
46
* Optional. Title text of the business intro
57
* @param message
68
* Optional. Message text of the business intro

telegramium-core/src/main/scala/telegramium/bots/BusinessLocation.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package telegramium.bots
22

3-
/** @param address
3+
/** Contains information about the location of a Telegram Business account.
4+
*
5+
* @param address
46
* Address of the business
57
* @param location
68
* Optional. Location of the business

telegramium-core/src/main/scala/telegramium/bots/BusinessMessagesDeleted.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ package telegramium.bots
88
* Information about a chat in the business account. The bot may not have access to the chat or the corresponding
99
* user.
1010
* @param messageIds
11-
* A JSON-serialized list of identifiers of deleted messages in the chat of the business account
11+
* The list of identifiers of deleted messages in the chat of the business account
1212
*/
1313
final case class BusinessMessagesDeleted(businessConnectionId: String, chat: Chat, messageIds: List[Int] = List.empty)

telegramium-core/src/main/scala/telegramium/bots/BusinessOpeningHours.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package telegramium.bots
22

3-
/** @param timeZoneName
3+
/** Describes the opening hours of a business.
4+
*
5+
* @param timeZoneName
46
* Unique name of the time zone for which the opening hours are defined
57
* @param openingHours
68
* List of time intervals describing business opening hours
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
package telegramium.bots
22

3-
/** @param openingMinute
3+
/** Describes an interval of time during which a business is open.
4+
*
5+
* @param openingMinute
46
* The minute's sequence number in a week, starting on Monday, marking the start of the time interval during which
5-
* the business is open; 0 - 7 24 60
7+
* the business is open; 0 - 7 * 24 * 60
68
* @param closingMinute
79
* The minute's sequence number in a week, starting on Monday, marking the end of the time interval during which the
8-
* business is open; 0 - 8 24 60
10+
* business is open; 0 - 8 * 24 * 60
911
*/
1012
final case class BusinessOpeningHoursInterval(openingMinute: Int, closingMinute: Int)

telegramium-core/src/main/scala/telegramium/bots/Chat.scala

Lines changed: 2 additions & 128 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ package telegramium.bots
77
* may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit
88
* integer or double-precision float type are safe for storing this identifier.
99
* @param type
10-
* Type of chat, can be either “private”, “group”, “supergroup” or “channel”
10+
* Type of the chat, can be either “private”, “group”, “supergroup” or “channel”
1111
* @param title
1212
* Optional. Title, for supergroups, channels and group chats
1313
* @param username
@@ -18,97 +18,6 @@ package telegramium.bots
1818
* Optional. Last name of the other party in a private chat
1919
* @param isForum
2020
* Optional. True, if the supergroup chat is a forum (has topics enabled)
21-
* @param photo
22-
* Optional. Chat photo. Returned only in getChat.
23-
* @param activeUsernames
24-
* Optional. If non-empty, the list of all active chat usernames; for private chats, supergroups and channels.
25-
* Returned only in getChat.
26-
* @param birthdate
27-
* Optional. For private chats, the date of birth of the user. Returned only in getChat.
28-
* @param businessIntro
29-
* Optional. For private chats with business accounts, the intro of the business. Returned only in getChat.
30-
* @param businessLocation
31-
* Optional. For private chats with business accounts, the location of the business. Returned only in getChat.
32-
* @param businessOpeningHours
33-
* Optional. For private chats with business accounts, the opening hours of the business. Returned only in getChat.
34-
* @param personalChat
35-
* Optional. For private chats, the personal channel of the user. Returned only in getChat.
36-
* @param availableReactions
37-
* Optional. List of available reactions allowed in the chat. If omitted, then all emoji reactions are allowed.
38-
* Returned only in getChat.
39-
* @param accentColorId
40-
* Optional. Identifier of the accent color for the chat name and backgrounds of the chat photo, reply header, and
41-
* link preview. See accent colors for more details. Returned only in getChat. Always returned in getChat.
42-
* @param backgroundCustomEmojiId
43-
* Optional. Custom emoji identifier of emoji chosen by the chat for the reply header and link preview background.
44-
* Returned only in getChat.
45-
* @param profileAccentColorId
46-
* Optional. Identifier of the accent color for the chat's profile background. See profile accent colors for more
47-
* details. Returned only in getChat.
48-
* @param profileBackgroundCustomEmojiId
49-
* Optional. Custom emoji identifier of the emoji chosen by the chat for its profile background. Returned only in
50-
* getChat.
51-
* @param emojiStatusCustomEmojiId
52-
* Optional. Custom emoji identifier of the emoji status of the chat or the other party in a private chat. Returned
53-
* only in getChat.
54-
* @param emojiStatusExpirationDate
55-
* Optional. Expiration date of the emoji status of the chat or the other party in a private chat, in Unix time, if
56-
* any. Returned only in getChat.
57-
* @param bio
58-
* Optional. Bio of the other party in a private chat. Returned only in getChat.
59-
* @param hasPrivateForwards
60-
* Optional. True, if privacy settings of the other party in the private chat allows to use tg://user?id=<user_id>
61-
* links only in chats with the user. Returned only in getChat.
62-
* @param hasRestrictedVoiceAndVideoMessages
63-
* Optional. True, if the privacy settings of the other party restrict sending voice and video note messages in the
64-
* private chat. Returned only in getChat.
65-
* @param joinToSendMessages
66-
* Optional. True, if users need to join the supergroup before they can send messages. Returned only in getChat.
67-
* @param joinByRequest
68-
* Optional. True, if all users directly joining the supergroup need to be approved by supergroup administrators.
69-
* Returned only in getChat.
70-
* @param description
71-
* Optional. Description, for groups, supergroups and channel chats. Returned only in getChat.
72-
* @param inviteLink
73-
* Optional. Primary invite link, for groups, supergroups and channel chats. Returned only in getChat.
74-
* @param pinnedMessage
75-
* Optional. The most recent pinned message (by sending date). Returned only in getChat.
76-
* @param permissions
77-
* Optional. Default chat member permissions, for groups and supergroups. Returned only in getChat.
78-
* @param slowModeDelay
79-
* Optional. For supergroups, the minimum allowed delay between consecutive messages sent by each unprivileged user;
80-
* in seconds. Returned only in getChat.
81-
* @param unrestrictBoostCount
82-
* Optional. For supergroups, the minimum number of boosts that a non-administrator user needs to add in order to
83-
* ignore slow mode and chat permissions. Returned only in getChat.
84-
* @param messageAutoDeleteTime
85-
* Optional. The time after which all messages sent to the chat will be automatically deleted; in seconds. Returned
86-
* only in getChat.
87-
* @param hasAggressiveAntiSpamEnabled
88-
* Optional. True, if aggressive anti-spam checks are enabled in the supergroup. The field is only available to chat
89-
* administrators. Returned only in getChat.
90-
* @param hasHiddenMembers
91-
* Optional. True, if non-administrators can only get the list of bots and administrators in the chat. Returned only
92-
* in getChat.
93-
* @param hasProtectedContent
94-
* Optional. True, if messages from the chat can't be forwarded to other chats. Returned only in getChat.
95-
* @param hasVisibleHistory
96-
* Optional. True, if new chat members will have access to old messages; available only to chat administrators.
97-
* Returned only in getChat.
98-
* @param stickerSetName
99-
* Optional. For supergroups, name of group sticker set. Returned only in getChat.
100-
* @param canSetStickerSet
101-
* Optional. True, if the bot can change the group sticker set. Returned only in getChat.
102-
* @param customEmojiStickerSetName
103-
* Optional. For supergroups, the name of the group's custom emoji sticker set. Custom emoji from this set can be
104-
* used by all users and bots in the group. Returned only in getChat.
105-
* @param linkedChatId
106-
* Optional. Unique identifier for the linked chat, i.e. the discussion group identifier for a channel and vice
107-
* versa; for supergroups and channel chats. This identifier may be greater than 32 bits and some programming
108-
* languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed 64
109-
* bit integer or double-precision float type are safe for storing this identifier. Returned only in getChat.
110-
* @param location
111-
* Optional. For supergroups, the location to which the supergroup is connected. Returned only in getChat.
11221
*/
11322
final case class Chat(
11423
id: Long,
@@ -117,40 +26,5 @@ final case class Chat(
11726
username: Option[String] = Option.empty,
11827
firstName: Option[String] = Option.empty,
11928
lastName: Option[String] = Option.empty,
120-
isForum: Option[Boolean] = Option.empty,
121-
photo: Option[ChatPhoto] = Option.empty,
122-
activeUsernames: List[String] = List.empty,
123-
birthdate: Option[Birthdate] = Option.empty,
124-
businessIntro: Option[BusinessIntro] = Option.empty,
125-
businessLocation: Option[BusinessLocation] = Option.empty,
126-
businessOpeningHours: Option[BusinessOpeningHours] = Option.empty,
127-
personalChat: Option[Chat] = Option.empty,
128-
availableReactions: List[ReactionType] = List.empty,
129-
accentColorId: Option[Int] = Option.empty,
130-
backgroundCustomEmojiId: Option[String] = Option.empty,
131-
profileAccentColorId: Option[Int] = Option.empty,
132-
profileBackgroundCustomEmojiId: Option[String] = Option.empty,
133-
emojiStatusCustomEmojiId: Option[String] = Option.empty,
134-
emojiStatusExpirationDate: Option[Int] = Option.empty,
135-
bio: Option[String] = Option.empty,
136-
hasPrivateForwards: Option[Boolean] = Option.empty,
137-
hasRestrictedVoiceAndVideoMessages: Option[Boolean] = Option.empty,
138-
joinToSendMessages: Option[Boolean] = Option.empty,
139-
joinByRequest: Option[Boolean] = Option.empty,
140-
description: Option[String] = Option.empty,
141-
inviteLink: Option[String] = Option.empty,
142-
pinnedMessage: Option[Message] = Option.empty,
143-
permissions: Option[ChatPermissions] = Option.empty,
144-
slowModeDelay: Option[Int] = Option.empty,
145-
unrestrictBoostCount: Option[Int] = Option.empty,
146-
messageAutoDeleteTime: Option[Int] = Option.empty,
147-
hasAggressiveAntiSpamEnabled: Option[Boolean] = Option.empty,
148-
hasHiddenMembers: Option[Boolean] = Option.empty,
149-
hasProtectedContent: Option[Boolean] = Option.empty,
150-
hasVisibleHistory: Option[Boolean] = Option.empty,
151-
stickerSetName: Option[String] = Option.empty,
152-
canSetStickerSet: Option[Boolean] = Option.empty,
153-
customEmojiStickerSetName: Option[String] = Option.empty,
154-
linkedChatId: Option[Long] = Option.empty,
155-
location: Option[ChatLocation] = Option.empty
29+
isForum: Option[Boolean] = Option.empty
15630
)

telegramium-core/src/main/scala/telegramium/bots/ChatAdministratorRights.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ package telegramium.bots
2424
* @param canPostStories
2525
* True, if the administrator can post stories to the chat
2626
* @param canEditStories
27-
* True, if the administrator can edit stories posted by other users
27+
* True, if the administrator can edit stories posted by other users, post stories to the chat page, pin chat
28+
* stories, and access the chat's story archive
2829
* @param canDeleteStories
2930
* True, if the administrator can delete stories posted by other users
3031
* @param canPostMessages
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package telegramium.bots
2+
3+
/** This object represents a chat background.
4+
*
5+
* @param type
6+
* Type of the background
7+
*/
8+
final case class ChatBackground(`type`: BackgroundType)

0 commit comments

Comments
 (0)