mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2025-11-16 20:10:18 +00:00
Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8c7261fda9 | |||
| 82acc8cb1f | |||
| 4ec1532597 | |||
| 13bfe681d8 | |||
| 5bbbcdb529 | |||
| 7f9d6ce626 | |||
| 71b944f9cc | |||
| d9d68749f1 | |||
| 561aad2274 | |||
| 6a3e95c488 | |||
| a09b3809e2 | |||
| 427b5775a2 | |||
| d222987fc7 | |||
| d211afa26a | |||
| 9952b6c6ae | |||
| 840c6b02a4 | |||
| a6f91d5600 | |||
| 8ec0c8804b | |||
| 2d08c447bc | |||
|
|
5164903d05 |
19
CHANGELOG.md
19
CHANGELOG.md
@@ -1,5 +1,24 @@
|
||||
# TelegramBotAPI changelog
|
||||
|
||||
## 23.1.2
|
||||
|
||||
* `Version`:
|
||||
* `Kotlin`: `2.1.0` -> `2.1.10`
|
||||
* `Serialization`: `1.7.3` -> `1.8.0`
|
||||
* `MicroUtils`: `0.24.4` -> `0.24.5`
|
||||
* `KSLog`: `1.4.0` -> `1.4.1`
|
||||
|
||||
## 23.1.1
|
||||
|
||||
* `Version`:
|
||||
* `MicroUtils`: `0.24.0` -> `0.24.4`
|
||||
* `Core`:
|
||||
* Replace `removeFirst` with `removeAt(0)` in `createTextSources`
|
||||
|
||||
## 23.1.0
|
||||
|
||||
**THIS UPDATE CONTAINS ADDING SUPPORT OF [Telegram Bots API 8.2](https://core.telegram.org/bots/api-changelog#january-1-2025)**
|
||||
|
||||
## 23.0.0
|
||||
|
||||
* `Version`:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# TelegramBotAPI [](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi) [](https://core.telegram.org/bots/api-changelog#december-4-2024)
|
||||
# TelegramBotAPI [](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi) [](https://core.telegram.org/bots/api-changelog#january-1-2025)
|
||||
|
||||
| Docs | [](https://tgbotapi.inmo.dev/index.html) [](https://docs.inmo.dev/tgbotapi/index.html) |
|
||||
|:----------------------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
|
||||
|
||||
@@ -55,7 +55,7 @@ Object callback = {
|
||||
|
||||
sourceLink {
|
||||
localDirectory.set(file("../"))
|
||||
remoteUrl.set(new URL("https://github.com/InsanusMokrassar/ktgbotapi/tree/master"))
|
||||
remoteUrl.set(new URL("https://github.com/InsanusMokrassar/ktgbotapi"))
|
||||
remoteLineSuffix.set("#L")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,4 +6,4 @@ kotlin.incremental=true
|
||||
kotlin.incremental.js=true
|
||||
|
||||
library_group=dev.inmo
|
||||
library_version=23.0.0
|
||||
library_version=23.1.2
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[versions]
|
||||
|
||||
kotlin = "2.1.0"
|
||||
kotlin-serialization = "1.7.3"
|
||||
kotlin = "2.1.10"
|
||||
kotlin-serialization = "1.8.0"
|
||||
kotlin-coroutines = "1.10.1"
|
||||
|
||||
javax-activation = "1.1.1"
|
||||
@@ -10,18 +10,18 @@ korlibs = "5.4.0"
|
||||
uuid = "0.8.4"
|
||||
ktor = "3.0.3"
|
||||
|
||||
ksp = "2.1.0-1.0.29"
|
||||
ksp = "2.1.10-1.0.29"
|
||||
kotlin-poet = "1.18.1"
|
||||
|
||||
microutils = "0.24.0"
|
||||
kslog = "1.4.0"
|
||||
microutils = "0.24.5"
|
||||
kslog = "1.4.1"
|
||||
|
||||
versions = "0.51.0"
|
||||
|
||||
github-release-plugin = "2.5.2"
|
||||
dokka = "2.0.0"
|
||||
|
||||
validator = "0.16.3"
|
||||
validator = "0.17.0"
|
||||
|
||||
[libraries]
|
||||
|
||||
|
||||
@@ -96,7 +96,6 @@ public synthetic class dev/inmo/tgbotapi/extensions/api/EditLiveLocationInfo$$se
|
||||
public final fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public final fun serialize (Lkotlinx/serialization/encoding/Encoder;Ldev/inmo/tgbotapi/extensions/api/EditLiveLocationInfo;)V
|
||||
public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
|
||||
public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer;
|
||||
}
|
||||
|
||||
public final class dev/inmo/tgbotapi/extensions/api/EditLiveLocationInfo$Companion {
|
||||
@@ -1090,14 +1089,22 @@ public final class dev/inmo/tgbotapi/extensions/api/gifts/GetAvailableGiftsKt {
|
||||
}
|
||||
|
||||
public final class dev/inmo/tgbotapi/extensions/api/gifts/SendGiftKt {
|
||||
public static final fun sendGift (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/User;Ldev/inmo/tgbotapi/types/gifts/Gift;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static final fun sendGift (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/User;Ldev/inmo/tgbotapi/types/gifts/Gift;Ljava/util/List;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static final fun sendGift-1FWvrZc (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLjava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static final fun sendGift-4iNBclM (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLdev/inmo/tgbotapi/types/gifts/Gift;Ljava/util/List;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static final fun sendGift-GROm3fU (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/User;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static final fun sendGift-WnQQACc (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLjava/lang/String;Ljava/util/List;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static final fun sendGift-xkmhVIQ (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/User;Ljava/lang/String;Ljava/util/List;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static final fun sendGift-ySMgKnk (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLdev/inmo/tgbotapi/types/gifts/Gift;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static final fun sendGift (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/User;Ldev/inmo/tgbotapi/types/gifts/Gift;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static final fun sendGift (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/User;Ldev/inmo/tgbotapi/types/gifts/Gift;Ljava/util/List;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static synthetic fun sendGift$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/User;Ldev/inmo/tgbotapi/types/gifts/Gift;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
|
||||
public static synthetic fun sendGift$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/User;Ldev/inmo/tgbotapi/types/gifts/Gift;Ljava/util/List;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
|
||||
public static final fun sendGift-0SDnvgk (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/User;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static synthetic fun sendGift-0SDnvgk$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/User;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
|
||||
public static final fun sendGift-1FWvrZc (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLjava/lang/String;Ljava/util/List;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static synthetic fun sendGift-1FWvrZc$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLjava/lang/String;Ljava/util/List;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
|
||||
public static final fun sendGift-CrS58cM (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLjava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static synthetic fun sendGift-CrS58cM$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLjava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
|
||||
public static final fun sendGift-GROm3fU (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/User;Ljava/lang/String;Ljava/util/List;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static synthetic fun sendGift-GROm3fU$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/User;Ljava/lang/String;Ljava/util/List;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
|
||||
public static final fun sendGift-VjR9mJc (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLdev/inmo/tgbotapi/types/gifts/Gift;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static synthetic fun sendGift-VjR9mJc$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLdev/inmo/tgbotapi/types/gifts/Gift;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
|
||||
public static final fun sendGift-ySMgKnk (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLdev/inmo/tgbotapi/types/gifts/Gift;Ljava/util/List;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static synthetic fun sendGift-ySMgKnk$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLdev/inmo/tgbotapi/types/gifts/Gift;Ljava/util/List;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
|
||||
}
|
||||
|
||||
public final class dev/inmo/tgbotapi/extensions/api/inline/SavePreparedInlineMessageKt {
|
||||
@@ -2311,6 +2318,20 @@ public final class dev/inmo/tgbotapi/extensions/api/utils/UpdatesHandlingKt {
|
||||
public static synthetic fun updateHandlerWithMediaGroupsAdaptation$default (Lkotlinx/coroutines/CoroutineScope;Lkotlin/jvm/functions/Function2;JILjava/lang/Object;)Lkotlin/jvm/functions/Function2;
|
||||
}
|
||||
|
||||
public final class dev/inmo/tgbotapi/extensions/api/verifications/VerifyChatKt {
|
||||
public static final fun verifyChat (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/ChatIdentifier;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static final fun verifyChat (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/Chat;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static synthetic fun verifyChat$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/ChatIdentifier;Ljava/lang/String;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
|
||||
public static synthetic fun verifyChat$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/Chat;Ljava/lang/String;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
|
||||
}
|
||||
|
||||
public final class dev/inmo/tgbotapi/extensions/api/verifications/VerifyUserKt {
|
||||
public static final fun verifyUser (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/Chat;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static synthetic fun verifyUser$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/Chat;Ljava/lang/String;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
|
||||
public static final fun verifyUser-nc95W0g (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLjava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static synthetic fun verifyUser-nc95W0g$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLjava/lang/String;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
|
||||
}
|
||||
|
||||
public final class dev/inmo/tgbotapi/extensions/api/webhook/DeleteWebhookKt {
|
||||
public static final fun deleteWebhook (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
}
|
||||
|
||||
@@ -13,13 +13,15 @@ public suspend fun TelegramBot.sendGift(
|
||||
userId: UserId,
|
||||
giftId: GiftId,
|
||||
text: String,
|
||||
parseMode: ParseMode?
|
||||
parseMode: ParseMode?,
|
||||
upgradableToUnique: Boolean = false
|
||||
): Boolean = execute(
|
||||
SendGift(
|
||||
userId,
|
||||
giftId,
|
||||
text,
|
||||
parseMode
|
||||
userId = userId,
|
||||
giftId = giftId,
|
||||
text = text,
|
||||
parseMode = parseMode,
|
||||
upgradableToUnique = upgradableToUnique
|
||||
)
|
||||
)
|
||||
|
||||
@@ -27,11 +29,13 @@ public suspend fun TelegramBot.sendGift(
|
||||
userId: UserId,
|
||||
giftId: GiftId,
|
||||
textSources: TextSourcesList,
|
||||
upgradableToUnique: Boolean = false,
|
||||
): Boolean = execute(
|
||||
SendGift(
|
||||
userId,
|
||||
giftId,
|
||||
textSources
|
||||
userId = userId,
|
||||
giftId = giftId,
|
||||
textSources = textSources,
|
||||
upgradableToUnique = upgradableToUnique
|
||||
)
|
||||
)
|
||||
|
||||
@@ -39,44 +43,52 @@ public suspend fun TelegramBot.sendGift(
|
||||
user: User,
|
||||
giftId: GiftId,
|
||||
text: String,
|
||||
parseMode: ParseMode?
|
||||
parseMode: ParseMode?,
|
||||
upgradableToUnique: Boolean = false
|
||||
): Boolean = sendGift(
|
||||
user.id,
|
||||
giftId,
|
||||
text,
|
||||
parseMode
|
||||
userId = user.id,
|
||||
giftId = giftId,
|
||||
text = text,
|
||||
parseMode = parseMode,
|
||||
upgradableToUnique = upgradableToUnique
|
||||
)
|
||||
|
||||
public suspend fun TelegramBot.sendGift(
|
||||
user: User,
|
||||
giftId: GiftId,
|
||||
textSources: TextSourcesList,
|
||||
upgradableToUnique: Boolean = false,
|
||||
): Boolean = sendGift(
|
||||
user.id,
|
||||
giftId,
|
||||
textSources
|
||||
userId = user.id,
|
||||
giftId = giftId,
|
||||
textSources = textSources,
|
||||
upgradableToUnique = upgradableToUnique
|
||||
)
|
||||
|
||||
public suspend fun TelegramBot.sendGift(
|
||||
user: UserId,
|
||||
gift: Gift,
|
||||
text: String,
|
||||
parseMode: ParseMode?
|
||||
parseMode: ParseMode?,
|
||||
upgradableToUnique: Boolean = false
|
||||
): Boolean = sendGift(
|
||||
user,
|
||||
gift.id,
|
||||
text,
|
||||
parseMode
|
||||
userId = user,
|
||||
giftId = gift.id,
|
||||
text = text,
|
||||
parseMode = parseMode,
|
||||
upgradableToUnique = upgradableToUnique
|
||||
)
|
||||
|
||||
public suspend fun TelegramBot.sendGift(
|
||||
user: UserId,
|
||||
gift: Gift,
|
||||
textSources: TextSourcesList,
|
||||
upgradableToUnique: Boolean = false,
|
||||
): Boolean = sendGift(
|
||||
user,
|
||||
gift.id,
|
||||
textSources
|
||||
userId = user,
|
||||
giftId = gift.id,
|
||||
textSources = textSources,
|
||||
upgradableToUnique = upgradableToUnique
|
||||
)
|
||||
|
||||
|
||||
@@ -84,20 +96,24 @@ public suspend fun TelegramBot.sendGift(
|
||||
user: User,
|
||||
gift: Gift,
|
||||
text: String,
|
||||
parseMode: ParseMode?
|
||||
parseMode: ParseMode?,
|
||||
upgradableToUnique: Boolean = false
|
||||
): Boolean = sendGift(
|
||||
user.id,
|
||||
gift.id,
|
||||
text,
|
||||
parseMode
|
||||
userId = user.id,
|
||||
giftId = gift.id,
|
||||
text = text,
|
||||
parseMode = parseMode,
|
||||
upgradableToUnique = upgradableToUnique
|
||||
)
|
||||
|
||||
public suspend fun TelegramBot.sendGift(
|
||||
user: User,
|
||||
gift: Gift,
|
||||
textSources: TextSourcesList,
|
||||
upgradableToUnique: Boolean = false,
|
||||
): Boolean = sendGift(
|
||||
user.id,
|
||||
gift.id,
|
||||
textSources
|
||||
userId = user.id,
|
||||
giftId = gift.id,
|
||||
textSources = textSources,
|
||||
upgradableToUnique = upgradableToUnique
|
||||
)
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.verifications
|
||||
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.verifications.VerifyChat
|
||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.chat.*
|
||||
import dev.inmo.tgbotapi.types.chatIdField
|
||||
import dev.inmo.tgbotapi.types.customDescriptionField
|
||||
import kotlinx.serialization.SerialName
|
||||
|
||||
public suspend fun TelegramBot.verifyChat(
|
||||
chatId: ChatIdentifier,
|
||||
description: String? = null
|
||||
): Boolean = execute(
|
||||
VerifyChat(
|
||||
chatId = chatId,
|
||||
description = description
|
||||
)
|
||||
)
|
||||
|
||||
/**
|
||||
* This method may call [verifyUser] in case when [chat] is [PrivateChat]
|
||||
*/
|
||||
public suspend fun TelegramBot.verifyChat(
|
||||
chat: Chat,
|
||||
description: String? = null
|
||||
): Boolean = when (chat) {
|
||||
is PrivateChat -> verifyUser(
|
||||
chat = chat,
|
||||
description = description
|
||||
)
|
||||
is UnknownExtendedChat,
|
||||
is UnknownChatType,
|
||||
is BusinessChat,
|
||||
is PublicChat -> verifyChat(
|
||||
chatId = chat.id,
|
||||
description = description
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.verifications
|
||||
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.verifications.VerifyChat
|
||||
import dev.inmo.tgbotapi.requests.verifications.VerifyUser
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.chat.Chat
|
||||
import kotlinx.serialization.SerialName
|
||||
|
||||
public suspend fun TelegramBot.verifyUser(
|
||||
userId: UserId,
|
||||
description: String? = null
|
||||
): Boolean = execute(
|
||||
VerifyUser(
|
||||
userId = userId,
|
||||
description = description
|
||||
)
|
||||
)
|
||||
|
||||
public suspend fun TelegramBot.verifyUser(
|
||||
chat: Chat,
|
||||
description: String? = null
|
||||
): Boolean = verifyUser(
|
||||
userId = chat.id.toChatId(),
|
||||
description = description
|
||||
)
|
||||
File diff suppressed because it is too large
Load Diff
@@ -28,6 +28,8 @@ data class SendGift internal constructor(
|
||||
override val parseMode: ParseMode?,
|
||||
@SerialName(textEntitiesField)
|
||||
private val rawEntities: List<RawMessageEntity>? = null,
|
||||
@SerialName(payToUpgradeField)
|
||||
val upgradableToUnique: Boolean = false
|
||||
) : SimpleRequest<Boolean>, TextedOutput {
|
||||
override val textSources: TextSourcesList? by lazy {
|
||||
rawEntities ?.asTextSources(text)
|
||||
@@ -46,12 +48,28 @@ data class SendGift internal constructor(
|
||||
userId: UserId,
|
||||
giftId: GiftId,
|
||||
text: String,
|
||||
parseMode: ParseMode?
|
||||
) : this(userId, giftId, text, parseMode, null)
|
||||
parseMode: ParseMode?,
|
||||
upgradableToUnique: Boolean = false
|
||||
) : this(
|
||||
userId = userId,
|
||||
giftId = giftId,
|
||||
text = text,
|
||||
parseMode = parseMode,
|
||||
rawEntities = null,
|
||||
upgradableToUnique = upgradableToUnique
|
||||
)
|
||||
|
||||
constructor(
|
||||
userId: UserId,
|
||||
giftId: GiftId,
|
||||
textSources: TextSourcesList,
|
||||
) : this(userId, giftId, textSources.makeSourceString(), null, textSources.toRawMessageEntities())
|
||||
upgradableToUnique: Boolean = false,
|
||||
) : this(
|
||||
userId = userId,
|
||||
giftId = giftId,
|
||||
text = textSources.makeSourceString(),
|
||||
parseMode = null,
|
||||
rawEntities = textSources.toRawMessageEntities(),
|
||||
upgradableToUnique = upgradableToUnique
|
||||
)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package dev.inmo.tgbotapi.requests.verifications
|
||||
|
||||
import dev.inmo.tgbotapi.abstracts.types.ChatRequest
|
||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import kotlinx.serialization.DeserializationStrategy
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.SerializationStrategy
|
||||
import kotlinx.serialization.builtins.serializer
|
||||
|
||||
|
||||
@Serializable
|
||||
data class RemoveChatVerification(
|
||||
@SerialName(chatIdField)
|
||||
override val chatId: ChatIdentifier,
|
||||
): ChatRequest, SimpleRequest<Boolean> {
|
||||
override fun method(): String = "removeChatVerification"
|
||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||
get() = Boolean.serializer()
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package dev.inmo.tgbotapi.requests.verifications
|
||||
|
||||
import dev.inmo.tgbotapi.abstracts.types.ChatRequest
|
||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import kotlinx.serialization.DeserializationStrategy
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.SerializationStrategy
|
||||
import kotlinx.serialization.builtins.serializer
|
||||
|
||||
|
||||
@Serializable
|
||||
data class RemoveUserVerification(
|
||||
@SerialName(userIdField)
|
||||
val userId: UserId,
|
||||
): SimpleRequest<Boolean> {
|
||||
override fun method(): String = "removeUserVerification"
|
||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||
get() = Boolean.serializer()
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package dev.inmo.tgbotapi.requests.verifications
|
||||
|
||||
import dev.inmo.tgbotapi.abstracts.types.ChatRequest
|
||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.chatIdField
|
||||
import dev.inmo.tgbotapi.types.customDescriptionField
|
||||
import dev.inmo.tgbotapi.types.descriptionField
|
||||
import kotlinx.serialization.DeserializationStrategy
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.SerializationStrategy
|
||||
import kotlinx.serialization.builtins.serializer
|
||||
|
||||
|
||||
@Serializable
|
||||
data class VerifyChat(
|
||||
@SerialName(chatIdField)
|
||||
override val chatId: ChatIdentifier,
|
||||
@SerialName(customDescriptionField)
|
||||
val description: String? = null
|
||||
): ChatRequest, SimpleRequest<Boolean> {
|
||||
override fun method(): String = "verifyChat"
|
||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||
get() = Boolean.serializer()
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package dev.inmo.tgbotapi.requests.verifications
|
||||
|
||||
import dev.inmo.tgbotapi.abstracts.types.ChatRequest
|
||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import kotlinx.serialization.DeserializationStrategy
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.SerializationStrategy
|
||||
import kotlinx.serialization.builtins.serializer
|
||||
|
||||
|
||||
@Serializable
|
||||
data class VerifyUser(
|
||||
@SerialName(userIdField)
|
||||
val userId: UserId,
|
||||
@SerialName(customDescriptionField)
|
||||
val description: String? = null
|
||||
): SimpleRequest<Boolean> {
|
||||
override fun method(): String = "verifyUser"
|
||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||
get() = Boolean.serializer()
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
||||
@@ -427,6 +427,7 @@ const val emojiField = "emoji"
|
||||
const val emojisField = "emojis"
|
||||
const val titleField = "title"
|
||||
const val descriptionField = "description"
|
||||
const val customDescriptionField = "custom_description"
|
||||
const val shortDescriptionField = "short_description"
|
||||
const val performerField = "performer"
|
||||
const val durationField = "duration"
|
||||
@@ -654,6 +655,8 @@ const val giveawayMessageField = "giveaway_message"
|
||||
const val wasRefundedField = "was_refunded"
|
||||
const val isManualField = "is_manual"
|
||||
const val starCountField = "star_count"
|
||||
const val upgradeStarCountField = "upgrade_star_count"
|
||||
const val payToUpgradeField = "pay_for_upgrade"
|
||||
const val paidMediaField = "paid_media"
|
||||
|
||||
const val businessConnectionIdField = "business_connection_id"
|
||||
|
||||
@@ -19,8 +19,6 @@ class InlineQueryResultArticle(
|
||||
override val replyMarkup: InlineKeyboardMarkup? = null,
|
||||
@SerialName(urlField)
|
||||
override val url: String? = null,
|
||||
@SerialName(hideUrlField)
|
||||
val hideUrl: Boolean? = null,
|
||||
@SerialName(descriptionField)
|
||||
override val description: String? = null,
|
||||
@SerialName(thumbnailUrlField)
|
||||
@@ -36,4 +34,31 @@ class InlineQueryResultArticle(
|
||||
WithInputMessageContentInlineQueryResult,
|
||||
UrlInlineQueryResult {
|
||||
override val type: String = "article"
|
||||
@Deprecated("Field hide_url has been deprecated in Bot API 8.2. Use empty url instead")
|
||||
val hideUrl: Boolean
|
||||
get() = url != null && url.isEmpty()
|
||||
|
||||
@Deprecated("Field hide_url has been deprecated in Bot API 8.2. Use empty url instead")
|
||||
constructor(
|
||||
id: InlineQueryId,
|
||||
title: String,
|
||||
inputMessageContent: InputMessageContent,
|
||||
replyMarkup: InlineKeyboardMarkup? = null,
|
||||
url: String? = null,
|
||||
hideUrl: Boolean?,
|
||||
description: String? = null,
|
||||
thumbnailUrl: String? = null,
|
||||
thumbnailWidth: Int? = null,
|
||||
thumbnailHeight: Int? = null
|
||||
) : this(
|
||||
id = id,
|
||||
title = title,
|
||||
inputMessageContent = inputMessageContent,
|
||||
replyMarkup = replyMarkup,
|
||||
url = url,
|
||||
description = description,
|
||||
thumbnailUrl = thumbnailUrl,
|
||||
thumbnailWidth = thumbnailWidth,
|
||||
thumbnailHeight = thumbnailHeight
|
||||
)
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ sealed interface Gift {
|
||||
val sticker: Sticker
|
||||
val starCount: Int
|
||||
val totalCount: Int?
|
||||
val upgradeStarCount: Int?
|
||||
val remainingCount: Int?
|
||||
|
||||
@Serializable
|
||||
@@ -24,7 +25,9 @@ sealed interface Gift {
|
||||
@SerialName(stickerField)
|
||||
override val sticker: Sticker,
|
||||
@SerialName(starCountField)
|
||||
override val starCount: Int
|
||||
override val starCount: Int,
|
||||
@SerialName(upgradeStarCountField)
|
||||
override val upgradeStarCount: Int? = null
|
||||
) : Gift {
|
||||
override val totalCount: Int?
|
||||
get() = null
|
||||
@@ -44,6 +47,8 @@ sealed interface Gift {
|
||||
override val totalCount: Int,
|
||||
@SerialName(remainingCountField)
|
||||
override val remainingCount: Int,
|
||||
@SerialName(upgradeStarCountField)
|
||||
override val upgradeStarCount: Int? = null,
|
||||
) : Gift
|
||||
|
||||
companion object : KSerializer<Gift> {
|
||||
@@ -54,6 +59,7 @@ sealed interface Gift {
|
||||
val star_count: Int,
|
||||
val total_count: Int? = null,
|
||||
val remaining_count: Int? = null,
|
||||
val upgrade_star_count: Int? = null,
|
||||
)
|
||||
|
||||
override val descriptor: SerialDescriptor
|
||||
@@ -64,29 +70,33 @@ sealed interface Gift {
|
||||
|
||||
return if (surrogate.total_count != null && surrogate.remaining_count != null) {
|
||||
Limited(
|
||||
surrogate.id,
|
||||
surrogate.sticker,
|
||||
surrogate.star_count,
|
||||
surrogate.total_count,
|
||||
surrogate.remaining_count
|
||||
id = surrogate.id,
|
||||
sticker = surrogate.sticker,
|
||||
starCount = surrogate.star_count,
|
||||
totalCount = surrogate.total_count,
|
||||
remainingCount = surrogate.remaining_count,
|
||||
upgradeStarCount = surrogate.upgrade_star_count,
|
||||
)
|
||||
} else {
|
||||
Unlimited(
|
||||
surrogate.id,
|
||||
surrogate.sticker,
|
||||
surrogate.star_count,
|
||||
id = surrogate.id,
|
||||
sticker = surrogate.sticker,
|
||||
starCount = surrogate.star_count,
|
||||
upgradeStarCount = surrogate.upgrade_star_count,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override fun serialize(encoder: Encoder, value: Gift) {
|
||||
val surrogate = GiftSurrogate(
|
||||
value.id,
|
||||
value.sticker,
|
||||
value.starCount,
|
||||
value.totalCount,
|
||||
value.remainingCount
|
||||
id = value.id,
|
||||
sticker = value.sticker,
|
||||
star_count = value.starCount,
|
||||
total_count = value.totalCount,
|
||||
remaining_count = value.remainingCount,
|
||||
upgrade_star_count = value.upgradeStarCount
|
||||
)
|
||||
GiftSurrogate.serializer().serialize(encoder, surrogate)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ private fun createTextSources(
|
||||
val resultList = mutableListOf<Pair<Int, TextSource>>()
|
||||
|
||||
while (mutableEntities.isNotEmpty()) {
|
||||
var parent = mutableEntities.removeFirst()
|
||||
var parent = mutableEntities.removeAt(0)
|
||||
val subentities = mutableListOf<RawMessageEntity>()
|
||||
val toAddCutted = mutableListOf<RawMessageEntity>()
|
||||
while (mutableEntities.isNotEmpty()) {
|
||||
|
||||
@@ -2743,7 +2743,6 @@ public synthetic class dev/inmo/tgbotapi/extensions/utils/SlotMachineResult$$ser
|
||||
public final fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public final fun serialize (Lkotlinx/serialization/encoding/Encoder;Ldev/inmo/tgbotapi/extensions/utils/SlotMachineResult;)V
|
||||
public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
|
||||
public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer;
|
||||
}
|
||||
|
||||
public final class dev/inmo/tgbotapi/extensions/utils/SlotMachineResult$Companion {
|
||||
@@ -3024,7 +3023,6 @@ public synthetic class dev/inmo/tgbotapi/extensions/utils/extensions/venue/Fours
|
||||
public final fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public final fun serialize (Lkotlinx/serialization/encoding/Encoder;Ldev/inmo/tgbotapi/extensions/utils/extensions/venue/Foursquare;)V
|
||||
public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
|
||||
public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer;
|
||||
}
|
||||
|
||||
public final class dev/inmo/tgbotapi/extensions/utils/extensions/venue/Foursquare$Companion {
|
||||
@@ -3064,7 +3062,6 @@ public synthetic class dev/inmo/tgbotapi/extensions/utils/extensions/venue/Googl
|
||||
public final fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
|
||||
public final fun serialize (Lkotlinx/serialization/encoding/Encoder;Ldev/inmo/tgbotapi/extensions/utils/extensions/venue/GooglePlace;)V
|
||||
public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
|
||||
public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer;
|
||||
}
|
||||
|
||||
public final class dev/inmo/tgbotapi/extensions/utils/extensions/venue/GooglePlace$Companion {
|
||||
|
||||
Reference in New Issue
Block a user