Skip to content

Commit

Permalink
Telegram Bot API September 22, 2023 updates (v6.9)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnspade committed Sep 24, 2023
1 parent df770fd commit bb9b8cf
Show file tree
Hide file tree
Showing 13 changed files with 122 additions and 36 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-6.8%20(August%2018%2C%202023)-blue)](https://core.telegram.org/bots/api#recent-changes)
[![Telegram](https://img.shields.io/badge/Telegram%20Bot%20API-6.9%20(September%2022%2C%202023)-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(
"8.68.0",
"8.69.0",
git.gitCurrentBranch.value,
git.gitDescribedVersion.value,
git.gitUncommittedChanges.value
Expand Down
4 changes: 2 additions & 2 deletions telegramium-core/src/main/scala/telegramium/bots/Chat.scala
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ package telegramium.bots
* @param emojiStatusCustomEmojiId
* Optional. Custom emoji identifier of emoji status of the other party in a private chat. Returned only in getChat.
* @param emojiStatusExpirationDate
* Optional. Expiration date of the emoji status of the other party in a private chat, if any. Returned only in
* getChat.
* Optional. Expiration date of the emoji status of the other party in a private chat in Unix time, if any. Returned
* only in getChat.
* @param bio
* Optional. Bio of the other party in a private chat. Returned only in getChat.
* @param hasPrivateForwards
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ package telegramium.bots
* @param isAnonymous
* True, if the user's presence in the chat is hidden
* @param canManageChat
* True, if the administrator can access the chat event log, chat statistics, message statistics in channels, see
* channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other
* administrator privilege
* True, if the administrator can access the chat event log, chat statistics, boost list in channels, message
* statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode.
* Implied by any other administrator privilege
* @param canDeleteMessages
* True, if the administrator can delete messages of other users
* @param canManageVideoChats
Expand All @@ -23,11 +23,17 @@ package telegramium.bots
* @param canInviteUsers
* True, if the user is allowed to invite new users to the chat
* @param canPostMessages
* Optional. True, if the administrator can post in the channel; channels only
* Optional. True, if the administrator can post messages in the channel; channels only
* @param canEditMessages
* Optional. True, if the administrator can edit messages of other users and can pin messages; channels only
* @param canPinMessages
* Optional. True, if the user is allowed to pin messages; groups and supergroups only
* @param canPostStories
* Optional. True, if the administrator can post stories in the channel; channels only
* @param canEditStories
* Optional. True, if the administrator can edit stories posted by other users; channels only
* @param canDeleteStories
* Optional. True, if the administrator can delete stories posted by other users; channels only
* @param canManageTopics
* Optional. True, if the user is allowed to create, rename, close, and reopen forum topics; supergroups only
*/
Expand All @@ -43,5 +49,8 @@ final case class ChatAdministratorRights(
canPostMessages: Option[Boolean] = Option.empty,
canEditMessages: Option[Boolean] = Option.empty,
canPinMessages: Option[Boolean] = Option.empty,
canPostStories: Option[Boolean] = Option.empty,
canEditStories: Option[Boolean] = Option.empty,
canDeleteStories: Option[Boolean] = Option.empty,
canManageTopics: Option[Boolean] = Option.empty
)
21 changes: 15 additions & 6 deletions telegramium-core/src/main/scala/telegramium/bots/ChatMember.scala
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ final case class ChatMemberOwner(
* @param isAnonymous
* True, if the user's presence in the chat is hidden
* @param canManageChat
* True, if the administrator can access the chat event log, chat statistics, message statistics in channels, see
* channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other
* administrator privilege
* True, if the administrator can access the chat event log, chat statistics, boost list in channels, message
* statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode.
* Implied by any other administrator privilege
* @param canDeleteMessages
* True, if the administrator can delete messages of other users
* @param canManageVideoChats
Expand All @@ -49,11 +49,17 @@ final case class ChatMemberOwner(
* @param canInviteUsers
* True, if the user is allowed to invite new users to the chat
* @param canPostMessages
* Optional. True, if the administrator can post in the channel; channels only
* Optional. True, if the administrator can post messages in the channel; channels only
* @param canEditMessages
* Optional. True, if the administrator can edit messages of other users and can pin messages; channels only
* @param canPinMessages
* Optional. True, if the user is allowed to pin messages; groups and supergroups only
* @param canPostStories
* Optional. True, if the administrator can post stories in the channel; channels only
* @param canEditStories
* Optional. True, if the administrator can edit stories posted by other users; channels only
* @param canDeleteStories
* Optional. True, if the administrator can delete stories posted by other users; channels only
* @param canManageTopics
* Optional. True, if the user is allowed to create, rename, close, and reopen forum topics; supergroups only
* @param customTitle
Expand All @@ -74,6 +80,9 @@ final case class ChatMemberAdministrator(
canPostMessages: Option[Boolean] = Option.empty,
canEditMessages: Option[Boolean] = Option.empty,
canPinMessages: Option[Boolean] = Option.empty,
canPostStories: Option[Boolean] = Option.empty,
canEditStories: Option[Boolean] = Option.empty,
canDeleteStories: Option[Boolean] = Option.empty,
canManageTopics: Option[Boolean] = Option.empty,
customTitle: Option[String] = Option.empty
) extends ChatMember
Expand Down Expand Up @@ -103,7 +112,7 @@ final case class ChatMemberMember(status: String, user: User) extends ChatMember
* @param user
* Information about the user
* @param untilDate
* Date when restrictions will be lifted for this user; unix time. If 0, then the user is banned forever
* Date when restrictions will be lifted for this user; Unix time. If 0, then the user is banned forever
*/
final case class ChatMemberBanned(status: String, user: User, untilDate: Int) extends ChatMember

Expand Down Expand Up @@ -144,7 +153,7 @@ final case class ChatMemberBanned(status: String, user: User, untilDate: Int) ex
* @param canManageTopics
* True, if the user is allowed to create forum topics
* @param untilDate
* Date when restrictions will be lifted for this user; unix time. If 0, then the user is restricted forever
* Date when restrictions will be lifted for this user; Unix time. If 0, then the user is restricted forever
*/
final case class ChatMemberRestricted(
status: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@ package telegramium.bots
* @param connectedWebsite
* Optional. The domain name of the website on which the user has logged in.
* @param writeAccessAllowed
* Optional. Service message: the user allowed the bot added to the attachment menu to write messages
* Optional. Service message: the user allowed the bot to write messages after adding it to the attachment or side
* menu, launching a Web App from a link, or accepting an explicit request from a Web App sent by the method
* requestWriteAccess
* @param passportData
* Optional. Telegram Passport data
* @param proximityAlertTriggered
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
package telegramium.bots

/** This object represents a service message about a user allowing a bot to write messages after adding the bot to the
* attachment menu or launching a Web App from a link.
/** This object represents a service message about a user allowing a bot to write messages after adding it to the
* attachment menu, launching a Web App from a link, or accepting an explicit request from a Web App sent by the method
* requestWriteAccess.
*
* @param fromRequest
* Optional. True, if the access was granted after the user accepted an explicit request from a Web App sent by the
* method requestWriteAccess
* @param webAppName
* Optional. Name of the Web App which was launched from a link
* Optional. Name of the Web App, if the access was granted when the Web App was launched from a link
* @param fromAttachmentMenu
* Optional. True, if the access was granted when the bot was added to the attachment or side menu
*/
final case class WriteAccessAllowed(webAppName: Option[String] = Option.empty)
final case class WriteAccessAllowed(
fromRequest: Option[Boolean] = Option.empty,
webAppName: Option[String] = Option.empty,
fromAttachmentMenu: Option[Boolean] = Option.empty
)
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import telegramium.bots.ChatId
* @param userId
* Unique identifier of the target user
* @param untilDate
* Date when the user will be unbanned, unix time. If user is banned for more than 366 days or less than 30 seconds
* Date when the user will be unbanned; Unix time. If user is banned for more than 366 days or less than 30 seconds
* from the current time they are considered to be banned forever. Applied for supergroups and channels only.
* @param revokeMessages
* Pass True to delete all messages from the chat for the user that is being removed. If False, the user will be able
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1995,7 +1995,7 @@ trait Methods {
* can_send_photos, can_send_videos, can_send_video_notes, and can_send_voice_notes permissions; the can_send_polls
* permission will imply the can_send_messages permission.
* @param untilDate
* Date when restrictions will be lifted for the user, unix time. If user is restricted for more than 366 days or
* Date when restrictions will be lifted for the user; Unix time. If user is restricted for more than 366 days or
* less than 30 seconds from the current time, they are considered to be restricted forever
*/
def restrictChatMember(
Expand Down Expand Up @@ -2105,7 +2105,7 @@ trait Methods {
* @param userId
* Unique identifier of the target user
* @param untilDate
* Date when the user will be unbanned, unix time. If user is banned for more than 366 days or less than 30 seconds
* Date when the user will be unbanned; Unix time. If user is banned for more than 366 days or less than 30 seconds
* from the current time they are considered to be banned forever. Applied for supergroups and channels only.
* @param revokeMessages
* Pass True to delete all messages from the chat for the user that is being removed. If False, the user will be
Expand Down Expand Up @@ -2220,15 +2220,21 @@ trait Methods {
* @param isAnonymous
* Pass True if the administrator's presence in the chat is hidden
* @param canManageChat
* Pass True if the administrator can access the chat event log, chat statistics, message statistics in channels,
* see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other
* administrator privilege
* Pass True if the administrator can access the chat event log, chat statistics, boost list in channels, message
* statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode.
* Implied by any other administrator privilege
* @param canPostMessages
* Pass True if the administrator can create channel posts, channels only
* Pass True if the administrator can post messages in the channel; channels only
* @param canEditMessages
* Pass True if the administrator can edit messages of other users and can pin messages, channels only
* Pass True if the administrator can edit messages of other users and can pin messages; channels only
* @param canDeleteMessages
* Pass True if the administrator can delete messages of other users
* @param canPostStories
* Pass True if the administrator can post stories in the channel; channels only
* @param canEditStories
* Pass True if the administrator can edit stories posted by other users; channels only
* @param canDeleteStories
* Pass True if the administrator can delete stories posted by other users; channels only
* @param canManageVideoChats
* Pass True if the administrator can manage video chats
* @param canRestrictMembers
Expand All @@ -2254,6 +2260,9 @@ trait Methods {
canPostMessages: Option[Boolean] = Option.empty,
canEditMessages: Option[Boolean] = Option.empty,
canDeleteMessages: Option[Boolean] = Option.empty,
canPostStories: Option[Boolean] = Option.empty,
canEditStories: Option[Boolean] = Option.empty,
canDeleteStories: Option[Boolean] = Option.empty,
canManageVideoChats: Option[Boolean] = Option.empty,
canRestrictMembers: Option[Boolean] = Option.empty,
canPromoteMembers: Option[Boolean] = Option.empty,
Expand All @@ -2270,6 +2279,9 @@ trait Methods {
canPostMessages,
canEditMessages,
canDeleteMessages,
canPostStories,
canEditStories,
canDeleteStories,
canManageVideoChats,
canRestrictMembers,
canPromoteMembers,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,21 @@ import telegramium.bots.ChatId
* @param isAnonymous
* Pass True if the administrator's presence in the chat is hidden
* @param canManageChat
* Pass True if the administrator can access the chat event log, chat statistics, message statistics in channels, see
* channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other
* administrator privilege
* Pass True if the administrator can access the chat event log, chat statistics, boost list in channels, message
* statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode.
* Implied by any other administrator privilege
* @param canPostMessages
* Pass True if the administrator can create channel posts, channels only
* Pass True if the administrator can post messages in the channel; channels only
* @param canEditMessages
* Pass True if the administrator can edit messages of other users and can pin messages, channels only
* Pass True if the administrator can edit messages of other users and can pin messages; channels only
* @param canDeleteMessages
* Pass True if the administrator can delete messages of other users
* @param canPostStories
* Pass True if the administrator can post stories in the channel; channels only
* @param canEditStories
* Pass True if the administrator can edit stories posted by other users; channels only
* @param canDeleteStories
* Pass True if the administrator can delete stories posted by other users; channels only
* @param canManageVideoChats
* Pass True if the administrator can manage video chats
* @param canRestrictMembers
Expand All @@ -43,6 +49,9 @@ final case class PromoteChatMemberReq(
canPostMessages: Option[Boolean] = Option.empty,
canEditMessages: Option[Boolean] = Option.empty,
canDeleteMessages: Option[Boolean] = Option.empty,
canPostStories: Option[Boolean] = Option.empty,
canEditStories: Option[Boolean] = Option.empty,
canDeleteStories: Option[Boolean] = Option.empty,
canManageVideoChats: Option[Boolean] = Option.empty,
canRestrictMembers: Option[Boolean] = Option.empty,
canPromoteMembers: Option[Boolean] = Option.empty,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import telegramium.bots.ChatPermissions
* can_send_photos, can_send_videos, can_send_video_notes, and can_send_voice_notes permissions; the can_send_polls
* permission will imply the can_send_messages permission.
* @param untilDate
* Date when restrictions will be lifted for the user, unix time. If user is restricted for more than 366 days or
* Date when restrictions will be lifted for the user; Unix time. If user is restricted for more than 366 days or
* less than 30 seconds from the current time, they are considered to be restricted forever
*/
final case class RestrictChatMemberReq(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2358,6 +2358,9 @@ object CirceImplicits {
"can_post_messages" -> x.canPostMessages.asJson,
"can_edit_messages" -> x.canEditMessages.asJson,
"can_delete_messages" -> x.canDeleteMessages.asJson,
"can_post_stories" -> x.canPostStories.asJson,
"can_edit_stories" -> x.canEditStories.asJson,
"can_delete_stories" -> x.canDeleteStories.asJson,
"can_manage_video_chats" -> x.canManageVideoChats.asJson,
"can_restrict_members" -> x.canRestrictMembers.asJson,
"can_promote_members" -> x.canPromoteMembers.asJson,
Expand All @@ -2380,6 +2383,9 @@ object CirceImplicits {
_canPostMessages <- h.get[Option[Boolean]]("can_post_messages")
_canEditMessages <- h.get[Option[Boolean]]("can_edit_messages")
_canDeleteMessages <- h.get[Option[Boolean]]("can_delete_messages")
_canPostStories <- h.get[Option[Boolean]]("can_post_stories")
_canEditStories <- h.get[Option[Boolean]]("can_edit_stories")
_canDeleteStories <- h.get[Option[Boolean]]("can_delete_stories")
_canManageVideoChats <- h.get[Option[Boolean]]("can_manage_video_chats")
_canRestrictMembers <- h.get[Option[Boolean]]("can_restrict_members")
_canPromoteMembers <- h.get[Option[Boolean]]("can_promote_members")
Expand All @@ -2396,6 +2402,9 @@ object CirceImplicits {
canPostMessages = _canPostMessages,
canEditMessages = _canEditMessages,
canDeleteMessages = _canDeleteMessages,
canPostStories = _canPostStories,
canEditStories = _canEditStories,
canDeleteStories = _canDeleteStories,
canManageVideoChats = _canManageVideoChats,
canRestrictMembers = _canRestrictMembers,
canPromoteMembers = _canPromoteMembers,
Expand Down
Loading

0 comments on commit bb9b8cf

Please sign in to comment.