Skip to content

Commit 2c4f034

Browse files
committed
Added the method giftPremiumSubscription, allowing bots to gift a user a Telegram Premium subscription paid in Telegram Stars.
1 parent 86c31a1 commit 2c4f034

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package com.pengrad.telegrambot.request
2+
3+
import com.pengrad.telegrambot.model.MessageEntity
4+
import com.pengrad.telegrambot.request.business.TransferGift
5+
import com.pengrad.telegrambot.response.BaseResponse
6+
import com.pengrad.telegrambot.utility.kotlin.optionalRequestParameter
7+
import com.pengrad.telegrambot.utility.kotlin.requestParameter
8+
9+
@Suppress("unused")
10+
class GiftTelegramSubscription private constructor(
11+
userId: Long,
12+
monthCount: Int,
13+
starCount: Int,
14+
text: String?,
15+
textParseMode: String?,
16+
textEntities: Array<MessageEntity>?
17+
): KBaseRequest<GiftTelegramSubscription, BaseResponse>(BaseResponse::class) {
18+
19+
constructor(userId: Long, monthCount: Int, starCount: Int) : this(
20+
userId = userId,
21+
monthCount = monthCount,
22+
starCount = starCount,
23+
text = null,
24+
textParseMode = null,
25+
textEntities = null
26+
)
27+
28+
val userId: Long by requestParameter(userId, customParameterName = "user_id")
29+
val monthCount: Int by requestParameter(monthCount, customParameterName = "month_count")
30+
val starCount: Int by requestParameter(starCount, customParameterName = "star_count")
31+
32+
var text: String? by optionalRequestParameter(text, customParameterName = "text")
33+
fun text(text: String) = applySelf { this.text = text }
34+
35+
var textParseMode: String? by optionalRequestParameter(textParseMode, customParameterName = "text_parse_mode")
36+
fun textParseMode(textParseMode: String) = applySelf { this.textParseMode = textParseMode }
37+
38+
var textEntities: Array<MessageEntity>? by optionalRequestParameter(textEntities, customParameterName = "text_entities")
39+
fun textEntities(textEntities: Array<MessageEntity>) = applySelf { this.textEntities = textEntities }
40+
41+
}

0 commit comments

Comments
 (0)