@@ -9,6 +9,7 @@ import telegramium.bots.MessageId
9
9
import telegramium .bots .ChatInviteLink
10
10
import telegramium .bots .ForumTopic
11
11
import telegramium .bots .Message
12
+ import telegramium .bots .Gifts
12
13
import telegramium .bots .BusinessConnection
13
14
import telegramium .bots .ChatFullInfo
14
15
import telegramium .bots .ChatMember
@@ -28,6 +29,7 @@ import telegramium.bots.Update
28
29
import telegramium .bots .UserChatBoosts
29
30
import telegramium .bots .UserProfilePhotos
30
31
import telegramium .bots .WebhookInfo
32
+ import telegramium .bots .PreparedInlineMessage
31
33
import telegramium .bots .Poll
32
34
33
35
trait Methods {
@@ -479,11 +481,19 @@ trait Methods {
479
481
* processes.
480
482
* @param currency
481
483
* Three-letter ISO 4217 currency code, see more on currencies. Pass “XTR” for payments in Telegram Stars.
484
+ * @param businessConnectionId
485
+ * Unique identifier of the business connection on behalf of which the link will be created. For payments in
486
+ * Telegram Stars only.
482
487
* @param providerToken
483
488
* Payment provider token, obtained via @BotFather. Pass an empty string for payments in Telegram Stars.
484
489
* @param prices
485
490
* Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost,
486
491
* delivery tax, bonus, etc.). Must contain exactly one item for payments in Telegram Stars.
492
+ * @param subscriptionPeriod
493
+ * The number of seconds the subscription will be active for before the next payment. The currency must be set to
494
+ * “XTR” (Telegram Stars) if the parameter is used. Currently, it must always be 2592000 (30 days) if specified.
495
+ * Any number of subscriptions can be active for a given bot at the same time, including multiple concurrent
496
+ * subscriptions from the same user.
487
497
* @param maxTipAmount
488
498
* The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double). For
489
499
* example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145. See the exp parameter in currencies.json, it
@@ -525,8 +535,10 @@ trait Methods {
525
535
description : String ,
526
536
payload : String ,
527
537
currency : String ,
538
+ businessConnectionId : Option [String ] = Option .empty,
528
539
providerToken : Option [String ] = Option .empty,
529
540
prices : List [LabeledPrice ] = List .empty,
541
+ subscriptionPeriod : Option [Int ] = Option .empty,
530
542
maxTipAmount : Option [Int ] = Option .empty,
531
543
suggestedTipAmounts : List [Int ] = List .empty,
532
544
providerData : Option [String ] = Option .empty,
@@ -547,8 +559,10 @@ trait Methods {
547
559
description,
548
560
payload,
549
561
currency,
562
+ businessConnectionId,
550
563
providerToken,
551
564
prices,
565
+ subscriptionPeriod,
552
566
maxTipAmount,
553
567
suggestedTipAmounts,
554
568
providerData,
@@ -1049,6 +1063,22 @@ trait Methods {
1049
1063
MethodReq [Either [Boolean , Message ]](" editMessageText" , req.asJson)
1050
1064
}
1051
1065
1066
+ /** Allows the bot to cancel or re-enable extension of a subscription paid in Telegram Stars. Returns True on success.
1067
+ *
1068
+ * @param userId
1069
+ * Identifier of the user whose subscription will be edited
1070
+ * @param telegramPaymentChargeId
1071
+ * Telegram payment identifier for the subscription
1072
+ * @param isCanceled
1073
+ * Pass True to cancel extension of the user subscription; the subscription must be active up to the end of the
1074
+ * current subscription period. Pass False to allow the user to re-enable a subscription that was previously
1075
+ * canceled by the bot.
1076
+ */
1077
+ def editUserStarSubscription (userId : Long , telegramPaymentChargeId : String , isCanceled : Boolean ): Method [Boolean ] = {
1078
+ val req = EditUserStarSubscriptionReq (userId, telegramPaymentChargeId, isCanceled)
1079
+ MethodReq [Boolean ](" editUserStarSubscription" , req.asJson)
1080
+ }
1081
+
1052
1082
/** Use this method to generate a new primary invite link for a chat; any previously generated primary link is
1053
1083
* revoked. The bot must be an administrator in the chat for this to work and must have the appropriate administrator
1054
1084
* rights. Returns the new invite link as String on success.
@@ -1121,6 +1151,13 @@ trait Methods {
1121
1151
MethodReq [List [MessageId ]](" forwardMessages" , req.asJson)
1122
1152
}
1123
1153
1154
+ /** Returns the list of gifts that can be sent by the bot to users. Requires no parameters. Returns a Gifts object.
1155
+ */
1156
+ def getAvailableGifts (): Method [Gifts ] = {
1157
+ val req = GetAvailableGiftsReq
1158
+ MethodReq [Gifts ](" getAvailableGifts" , req.asJson)
1159
+ }
1160
+
1124
1161
/** Use this method to get information about the connection of the bot with a business account. Returns a
1125
1162
* BusinessConnection object on success.
1126
1163
*
@@ -1654,6 +1691,34 @@ trait Methods {
1654
1691
MethodReq [ChatInviteLink ](" revokeChatInviteLink" , req.asJson)
1655
1692
}
1656
1693
1694
+ /** Stores a message that can be sent by a user of a Mini App. Returns a PreparedInlineMessage object.
1695
+ *
1696
+ * @param userId
1697
+ * Unique identifier of the target user that can use the prepared message
1698
+ * @param result
1699
+ * A JSON-serialized object describing the message to be sent
1700
+ * @param allowUserChats
1701
+ * Pass True if the message can be sent to private chats with users
1702
+ * @param allowBotChats
1703
+ * Pass True if the message can be sent to private chats with bots
1704
+ * @param allowGroupChats
1705
+ * Pass True if the message can be sent to group and supergroup chats
1706
+ * @param allowChannelChats
1707
+ * Pass True if the message can be sent to channel chats
1708
+ */
1709
+ def savePreparedInlineMessage (
1710
+ userId : Long ,
1711
+ result : InlineQueryResult ,
1712
+ allowUserChats : Option [Boolean ] = Option .empty,
1713
+ allowBotChats : Option [Boolean ] = Option .empty,
1714
+ allowGroupChats : Option [Boolean ] = Option .empty,
1715
+ allowChannelChats : Option [Boolean ] = Option .empty
1716
+ ): Method [PreparedInlineMessage ] = {
1717
+ val req =
1718
+ SavePreparedInlineMessageReq (userId, result, allowUserChats, allowBotChats, allowGroupChats, allowChannelChats)
1719
+ MethodReq [PreparedInlineMessage ](" savePreparedInlineMessage" , req.asJson)
1720
+ }
1721
+
1657
1722
/** Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). On success, the sent
1658
1723
* Message is returned. Bots can currently send animation files of up to 50 MB in size, this limit may be changed in
1659
1724
* the future.
@@ -2133,6 +2198,34 @@ trait Methods {
2133
2198
MethodReq [Message ](" sendGame" , req.asJson)
2134
2199
}
2135
2200
2201
+ /** Sends a gift to the given user. The gift can't be converted to Telegram Stars by the user. Returns True on
2202
+ * success.
2203
+ *
2204
+ * @param userId
2205
+ * Unique identifier of the target user that will receive the gift
2206
+ * @param giftId
2207
+ * Identifier of the gift
2208
+ * @param text
2209
+ * Text that will be shown along with the gift; 0-255 characters
2210
+ * @param textParseMode
2211
+ * Mode for parsing entities in the text. See formatting options for more details. Entities other than “bold”,
2212
+ * “italic”, “underline”, “strikethrough”, “spoiler”, and “custom_emoji” are ignored.
2213
+ * @param textEntities
2214
+ * A JSON-serialized list of special entities that appear in the gift text. It can be specified instead of
2215
+ * text_parse_mode. Entities other than “bold”, “italic”, “underline”, “strikethrough”, “spoiler”, and
2216
+ * “custom_emoji” are ignored.
2217
+ */
2218
+ def sendGift (
2219
+ userId : Long ,
2220
+ giftId : String ,
2221
+ text : Option [String ] = Option .empty,
2222
+ textParseMode : Option [ParseMode ] = Option .empty,
2223
+ textEntities : List [MessageEntity ] = List .empty
2224
+ ): Method [Boolean ] = {
2225
+ val req = SendGiftReq (userId, giftId, text, textParseMode, textEntities)
2226
+ MethodReq [Boolean ](" sendGift" , req.asJson)
2227
+ }
2228
+
2136
2229
/** Use this method to send invoices. On success, the sent Message is returned.
2137
2230
*
2138
2231
* @param chatId
@@ -3510,6 +3603,25 @@ trait Methods {
3510
3603
MethodReq [Boolean ](" setStickerSetTitle" , req.asJson)
3511
3604
}
3512
3605
3606
+ /** Changes the emoji status for a given user that previously allowed the bot to manage their emoji status via the
3607
+ * Mini App method requestEmojiStatusAccess. Returns True on success.
3608
+ *
3609
+ * @param userId
3610
+ * Unique identifier of the target user
3611
+ * @param emojiStatusCustomEmojiId
3612
+ * Custom emoji identifier of the emoji status to set. Pass an empty string to remove the status.
3613
+ * @param emojiStatusExpirationDate
3614
+ * Expiration date of the emoji status, if any
3615
+ */
3616
+ def setUserEmojiStatus (
3617
+ userId : Long ,
3618
+ emojiStatusCustomEmojiId : Option [String ] = Option .empty,
3619
+ emojiStatusExpirationDate : Option [Int ] = Option .empty
3620
+ ): Method [Boolean ] = {
3621
+ val req = SetUserEmojiStatusReq (userId, emojiStatusCustomEmojiId, emojiStatusExpirationDate)
3622
+ MethodReq [Boolean ](" setUserEmojiStatus" , req.asJson)
3623
+ }
3624
+
3513
3625
/** Use this method to specify a URL and receive incoming updates via an outgoing webhook. Whenever there is an update
3514
3626
* for the bot, we will send an HTTPS POST request to the specified URL, containing a JSON-serialized Update. In case
3515
3627
* of an unsuccessful request, we will give up after a reasonable amount of attempts. Returns True on success. If
0 commit comments