mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-26 03:58:44 +00:00
commit
c4f22c2c43
11
CHANGELOG.md
11
CHANGELOG.md
@ -77,6 +77,17 @@ while they can work incorrectly
|
|||||||
* `makeLinkToMessage` have two signatures - for direct creating using username and for abstract creating using
|
* `makeLinkToMessage` have two signatures - for direct creating using username and for abstract creating using
|
||||||
chat id
|
chat id
|
||||||
|
|
||||||
|
### 0.22.2 CashTag and independent updates handling
|
||||||
|
|
||||||
|
* `cashtag` entity type was added
|
||||||
|
* Several `Unknown*` realizations was added:
|
||||||
|
* `UnknownUpdateType`
|
||||||
|
* `UnknownMessageType`
|
||||||
|
* `UnknownChatType`
|
||||||
|
* `UnknownCallbackQueryType`
|
||||||
|
* `UpdatesFilter` now have one additional income callback: `unknownUpdateTypeCallback`
|
||||||
|
* `createSimpleUpdateFilter` can receive one more callback: `unknownCallback` (for `unknownUpdateTypeCallback`)
|
||||||
|
|
||||||
## 0.21.0 TelegramBotAPI 4.5
|
## 0.21.0 TelegramBotAPI 4.5
|
||||||
|
|
||||||
* _**All `MessageEntity`'es now are replaced with `TextPart`**_
|
* _**All `MessageEntity`'es now are replaced with `TextPart`**_
|
||||||
|
@ -17,7 +17,7 @@ plugins {
|
|||||||
id "org.jetbrains.kotlin.plugin.serialization" version "$kotlin_version"
|
id "org.jetbrains.kotlin.plugin.serialization" version "$kotlin_version"
|
||||||
}
|
}
|
||||||
|
|
||||||
project.version = "0.22.1"
|
project.version = "0.22.2"
|
||||||
project.group = "com.github.insanusmokrassar"
|
project.group = "com.github.insanusmokrassar"
|
||||||
|
|
||||||
apply from: "publish.gradle"
|
apply from: "publish.gradle"
|
||||||
|
@ -7,6 +7,3 @@ uuid_version=0.0.7
|
|||||||
ktor_version=1.3.0
|
ktor_version=1.3.0
|
||||||
|
|
||||||
gradle_bintray_plugin_version=1.8.4
|
gradle_bintray_plugin_version=1.8.4
|
||||||
|
|
||||||
project_public_name=Telegram Bot API
|
|
||||||
project_public_description=Library for Object-Oriented and type-safe work with Telegram Bot API
|
|
||||||
|
@ -2,7 +2,6 @@ package com.github.insanusmokrassar.TelegramBotAPI.bot.Ktor
|
|||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.Request
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.Request
|
||||||
import io.ktor.client.HttpClient
|
import io.ktor.client.HttpClient
|
||||||
import io.ktor.client.call.HttpClientCall
|
|
||||||
import io.ktor.client.statement.HttpStatement
|
import io.ktor.client.statement.HttpStatement
|
||||||
|
|
||||||
interface KtorCallFactory {
|
interface KtorCallFactory {
|
||||||
|
@ -3,7 +3,6 @@ package com.github.insanusmokrassar.TelegramBotAPI.bot.Ktor.base
|
|||||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.Ktor.KtorCallFactory
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.Ktor.KtorCallFactory
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.Request
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.Request
|
||||||
import io.ktor.client.HttpClient
|
import io.ktor.client.HttpClient
|
||||||
import io.ktor.client.call.HttpClientCall
|
|
||||||
import io.ktor.client.request.*
|
import io.ktor.client.request.*
|
||||||
import io.ktor.client.statement.HttpStatement
|
import io.ktor.client.statement.HttpStatement
|
||||||
import io.ktor.http.ContentType
|
import io.ktor.http.ContentType
|
||||||
|
@ -3,7 +3,8 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests
|
|||||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.MessageAction
|
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.MessageAction
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.PossiblyForwardedMessage
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
private val AbleToBeForwardedMessageDeserializer = TelegramBotAPIMessageDeserializationStrategyClass<PossiblyForwardedMessage>()
|
private val AbleToBeForwardedMessageDeserializer = TelegramBotAPIMessageDeserializationStrategyClass<PossiblyForwardedMessage>()
|
||||||
|
@ -3,7 +3,8 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.get
|
|||||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember.abstracts.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember.abstracts.AdministratorChatMember
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember.abstracts.AdministratorChatMemberSerializerWithoutDeserialization
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
import kotlinx.serialization.internal.ArrayListSerializer
|
import kotlinx.serialization.internal.ArrayListSerializer
|
||||||
|
@ -3,11 +3,9 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.LiveLocation
|
|||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.*
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategy
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.LocationContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.LocationContent
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.TextContent
|
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
private val commonResultDeserializer = TelegramBotAPIMessageDeserializationStrategyClass<ContentMessage<LocationContent>>()
|
private val commonResultDeserializer = TelegramBotAPIMessageDeserializationStrategyClass<ContentMessage<LocationContent>>()
|
||||||
|
@ -4,8 +4,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditCh
|
|||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditReplyMessage
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditReplyMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategy
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.LocationContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.LocationContent
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
|
@ -4,9 +4,8 @@ import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditCh
|
|||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditReplyMessage
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditReplyMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategy
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaContent
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MessageContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MessageContent
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
|
@ -6,9 +6,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
|||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategy
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.TextContent
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaContent
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.*
|
|||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia.InputMedia
|
import com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia.InputMedia
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaContent
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
|
@ -6,8 +6,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
|||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategy
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.TextContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.TextContent
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
|
@ -4,8 +4,8 @@ import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.Replyi
|
|||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.SendMessageRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.SendMessageRequest
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategy
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.ContactContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.ContactContent
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
|
@ -3,8 +3,8 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.send
|
|||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.*
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategy
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.LocationContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.LocationContent
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
|
@ -6,7 +6,8 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
|||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.TextContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.TextContent
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
|
@ -4,8 +4,8 @@ import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.Replyi
|
|||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.SendMessageRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.SendMessageRequest
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategy
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.PollContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.PollContent
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
|
@ -3,7 +3,8 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.send
|
|||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.*
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.VenueContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.VenueContent
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
|
@ -4,8 +4,8 @@ import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ReplyMar
|
|||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.SendMessageRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.SendMessageRequest
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategy
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.GameContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.GameContent
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
|
@ -7,4 +7,11 @@ interface CallbackQuery {
|
|||||||
val id: CallbackQueryIdentifier
|
val id: CallbackQueryIdentifier
|
||||||
val user: User
|
val user: User
|
||||||
val chatInstance: String
|
val chatInstance: String
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data class UnknownCallbackQueryType(
|
||||||
|
override val id: CallbackQueryIdentifier,
|
||||||
|
override val user: User,
|
||||||
|
override val chatInstance: String,
|
||||||
|
val raw: String
|
||||||
|
) : CallbackQuery
|
||||||
|
@ -22,13 +22,21 @@ internal data class RawCallbackQuery(
|
|||||||
@SerialName("game_short_name")
|
@SerialName("game_short_name")
|
||||||
val gameShortName: String? = null
|
val gameShortName: String? = null
|
||||||
) {
|
) {
|
||||||
val asCallbackQuery: CallbackQuery by lazy {
|
private var inited: CallbackQuery? = null
|
||||||
when {
|
fun asCallbackQuery(raw: String): CallbackQuery {
|
||||||
|
return inited ?: when {
|
||||||
message != null && data != null -> MessageDataCallbackQuery(id, from, chatInstance, message, data)
|
message != null && data != null -> MessageDataCallbackQuery(id, from, chatInstance, message, data)
|
||||||
message != null && gameShortName != null -> MessageGameShortNameCallbackQuery(id, from, chatInstance, message, gameShortName)
|
message != null && gameShortName != null -> MessageGameShortNameCallbackQuery(id, from, chatInstance, message, gameShortName)
|
||||||
inlineMessageId != null && data != null -> InlineMessageIdDataCallbackQuery(id, from, chatInstance, inlineMessageId, data)
|
inlineMessageId != null && data != null -> InlineMessageIdDataCallbackQuery(id, from, chatInstance, inlineMessageId, data)
|
||||||
inlineMessageId != null && gameShortName != null -> InlineMessageIdGameShortNameCallbackQuery(id, from, chatInstance, inlineMessageId, gameShortName)
|
inlineMessageId != null && gameShortName != null -> InlineMessageIdGameShortNameCallbackQuery(id, from, chatInstance, inlineMessageId, gameShortName)
|
||||||
else -> throw IllegalStateException("Strange answer from server, can't create callback query")
|
else -> UnknownCallbackQueryType(
|
||||||
|
id,
|
||||||
|
from,
|
||||||
|
chatInstance,
|
||||||
|
raw
|
||||||
|
)
|
||||||
|
}.also {
|
||||||
|
inited = it
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ internal fun RawMessageEntity.asTextParts(source: String, subParts: List<TextPar
|
|||||||
return when (type) {
|
return when (type) {
|
||||||
"mention" -> MentionTextSource(sourceSubstring, shiftedSubParts)
|
"mention" -> MentionTextSource(sourceSubstring, shiftedSubParts)
|
||||||
"hashtag" -> HashTagTextSource(sourceSubstring, shiftedSubParts)
|
"hashtag" -> HashTagTextSource(sourceSubstring, shiftedSubParts)
|
||||||
"cashtag" -> TODO()
|
"cashtag" -> CashTagTextSource(sourceSubstring, shiftedSubParts)
|
||||||
"bot_command" -> BotCommandTextSource(sourceSubstring, shiftedSubParts)
|
"bot_command" -> BotCommandTextSource(sourceSubstring, shiftedSubParts)
|
||||||
"url" -> URLTextSource(sourceSubstring)
|
"url" -> URLTextSource(sourceSubstring)
|
||||||
"email" -> EMailTextSource(sourceSubstring, shiftedSubParts)
|
"email" -> EMailTextSource(sourceSubstring, shiftedSubParts)
|
||||||
|
@ -0,0 +1,15 @@
|
|||||||
|
package com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.textsources
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.MultilevelTextSource
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.TextPart
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.utils.*
|
||||||
|
|
||||||
|
class CashTagTextSource(
|
||||||
|
source: String,
|
||||||
|
textParts: List<TextPart>
|
||||||
|
) : MultilevelTextSource {
|
||||||
|
override val textParts: List<TextPart> by lazy { source.fullListOfSubSource(textParts) }
|
||||||
|
override val asMarkdownSource: String by lazy { source.cashTagMarkdown() }
|
||||||
|
override val asMarkdownV2Source: String by lazy { cashTagMarkdownV2() }
|
||||||
|
override val asHtmlSource: String by lazy { cashTagHTML() }
|
||||||
|
}
|
@ -1,10 +1,12 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.types.chat
|
package com.github.insanusmokrassar.TelegramBotAPI.types.chat
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.UnknownChatType
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.extended.ExtendedChat
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.extended.ExtendedChat
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.extended.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.extended.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.typeField
|
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
|
import kotlinx.serialization.internal.LongSerializer
|
||||||
import kotlinx.serialization.internal.StringDescriptor
|
import kotlinx.serialization.internal.StringDescriptor
|
||||||
import kotlinx.serialization.json.Json
|
import kotlinx.serialization.json.Json
|
||||||
import kotlinx.serialization.json.JsonObjectSerializer
|
import kotlinx.serialization.json.JsonObjectSerializer
|
||||||
@ -24,7 +26,10 @@ internal object PreviewChatSerializer : KSerializer<Chat> {
|
|||||||
"group" -> formatter.fromJson(GroupChatImpl.serializer(), decodedJson)
|
"group" -> formatter.fromJson(GroupChatImpl.serializer(), decodedJson)
|
||||||
"supergroup" -> formatter.fromJson(SupergroupChatImpl.serializer(), decodedJson)
|
"supergroup" -> formatter.fromJson(SupergroupChatImpl.serializer(), decodedJson)
|
||||||
"channel" -> formatter.fromJson(ChannelChatImpl.serializer(), decodedJson)
|
"channel" -> formatter.fromJson(ChannelChatImpl.serializer(), decodedJson)
|
||||||
else -> throw IllegalArgumentException("Unknown type of chat")
|
else -> UnknownChatType(
|
||||||
|
formatter.fromJson(LongSerializer, decodedJson.getPrimitive(chatIdField)).toChatId(),
|
||||||
|
decodedJson.toString()
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,4 +7,9 @@ import kotlinx.serialization.Serializable
|
|||||||
@Serializable(PreviewChatSerializer::class)
|
@Serializable(PreviewChatSerializer::class)
|
||||||
interface Chat {
|
interface Chat {
|
||||||
val id: ChatId
|
val id: ChatId
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data class UnknownChatType(
|
||||||
|
override val id: ChatId,
|
||||||
|
val raw: String
|
||||||
|
) : Chat
|
||||||
|
@ -10,6 +10,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.games.RawGame
|
|||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.ChatEvents.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.ChatEvents.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.ChatEvents.abstracts.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.ChatEvents.abstracts.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Message
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Message
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.UnknownMessageType
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MessageContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MessageContent
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media.*
|
||||||
@ -184,91 +185,99 @@ internal data class RawMessage(
|
|||||||
|
|
||||||
|
|
||||||
val asMessage: Message by lazy {
|
val asMessage: Message by lazy {
|
||||||
chatEvent ?.let {
|
try {
|
||||||
chatEvent ->
|
chatEvent?.let { chatEvent ->
|
||||||
when (chat) {
|
when (chat) {
|
||||||
is SupergroupChat -> SupergroupEventMessage(
|
is SupergroupChat -> SupergroupEventMessage(
|
||||||
messageId,
|
|
||||||
chat,
|
|
||||||
chatEvent as? SupergroupEvent ?: throwWrongChatEvent(SupergroupEvent::class, chatEvent),
|
|
||||||
date.asDate
|
|
||||||
)
|
|
||||||
is GroupChat -> GroupEventMessage(
|
|
||||||
messageId,
|
|
||||||
chat,
|
|
||||||
chatEvent as? GroupEvent ?: throwWrongChatEvent(GroupChat::class, chatEvent),
|
|
||||||
date.asDate
|
|
||||||
)
|
|
||||||
is ChannelChat -> ChannelEventMessage(
|
|
||||||
messageId,
|
|
||||||
chat,
|
|
||||||
chatEvent as? ChannelEvent ?: throwWrongChatEvent(ChannelEvent::class, chatEvent),
|
|
||||||
date.asDate
|
|
||||||
)
|
|
||||||
else -> throw IllegalStateException("Expected one of the public chats, but was $chat (in extracting of chat event message)")
|
|
||||||
}
|
|
||||||
} ?: content ?.let {
|
|
||||||
content ->
|
|
||||||
media_group_id ?.let {
|
|
||||||
when (from) {
|
|
||||||
null -> ChannelMediaGroupMessage(
|
|
||||||
messageId,
|
messageId,
|
||||||
chat,
|
chat,
|
||||||
date.asDate,
|
chatEvent as? SupergroupEvent ?: throwWrongChatEvent(SupergroupEvent::class, chatEvent),
|
||||||
it,
|
date.asDate
|
||||||
when (content) {
|
|
||||||
is PhotoContent -> content
|
|
||||||
is VideoContent -> content
|
|
||||||
else -> throw IllegalStateException("Unsupported content for media group")
|
|
||||||
},
|
|
||||||
edit_date ?.asDate,
|
|
||||||
forwarded,
|
|
||||||
reply_to_message ?.asMessage,
|
|
||||||
reply_markup
|
|
||||||
)
|
)
|
||||||
else -> CommonMediaGroupMessage(
|
is GroupChat -> GroupEventMessage(
|
||||||
messageId,
|
messageId,
|
||||||
from,
|
|
||||||
chat,
|
chat,
|
||||||
|
chatEvent as? GroupEvent ?: throwWrongChatEvent(GroupChat::class, chatEvent),
|
||||||
|
date.asDate
|
||||||
|
)
|
||||||
|
is ChannelChat -> ChannelEventMessage(
|
||||||
|
messageId,
|
||||||
|
chat,
|
||||||
|
chatEvent as? ChannelEvent ?: throwWrongChatEvent(ChannelEvent::class, chatEvent),
|
||||||
|
date.asDate
|
||||||
|
)
|
||||||
|
else -> throw IllegalStateException("Expected one of the public chats, but was $chat (in extracting of chat event message)")
|
||||||
|
}
|
||||||
|
} ?: content?.let { content ->
|
||||||
|
media_group_id?.let {
|
||||||
|
when (from) {
|
||||||
|
null -> ChannelMediaGroupMessage(
|
||||||
|
messageId,
|
||||||
|
chat,
|
||||||
|
date.asDate,
|
||||||
|
it,
|
||||||
|
when (content) {
|
||||||
|
is PhotoContent -> content
|
||||||
|
is VideoContent -> content
|
||||||
|
else -> throw IllegalStateException("Unsupported content for media group")
|
||||||
|
},
|
||||||
|
edit_date?.asDate,
|
||||||
|
forwarded,
|
||||||
|
reply_to_message?.asMessage,
|
||||||
|
reply_markup
|
||||||
|
)
|
||||||
|
else -> CommonMediaGroupMessage(
|
||||||
|
messageId,
|
||||||
|
from,
|
||||||
|
chat,
|
||||||
|
date.asDate,
|
||||||
|
it,
|
||||||
|
when (content) {
|
||||||
|
is PhotoContent -> content
|
||||||
|
is VideoContent -> content
|
||||||
|
else -> throw IllegalStateException("Unsupported content for media group")
|
||||||
|
},
|
||||||
|
edit_date?.asDate,
|
||||||
|
forwarded,
|
||||||
|
reply_to_message?.asMessage,
|
||||||
|
reply_markup
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} ?: when (chat) {
|
||||||
|
is ChannelChat -> ChannelMessage(
|
||||||
|
messageId,
|
||||||
|
chat,
|
||||||
|
content,
|
||||||
date.asDate,
|
date.asDate,
|
||||||
it,
|
edit_date?.asDate,
|
||||||
when (content) {
|
|
||||||
is PhotoContent -> content
|
|
||||||
is VideoContent -> content
|
|
||||||
else -> throw IllegalStateException("Unsupported content for media group")
|
|
||||||
},
|
|
||||||
edit_date ?.asDate,
|
|
||||||
forwarded,
|
forwarded,
|
||||||
reply_to_message ?.asMessage,
|
reply_to_message?.asMessage,
|
||||||
reply_markup
|
reply_markup,
|
||||||
|
author_signature
|
||||||
|
)
|
||||||
|
else -> CommonMessageImpl(
|
||||||
|
messageId,
|
||||||
|
from
|
||||||
|
?: throw IllegalStateException("Was detected common message, but owner (sender) of the message was not found"),
|
||||||
|
chat,
|
||||||
|
content,
|
||||||
|
date.asDate,
|
||||||
|
edit_date?.asDate,
|
||||||
|
forwarded,
|
||||||
|
reply_to_message?.asMessage,
|
||||||
|
reply_markup,
|
||||||
|
paymentInfo
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} ?: when (chat) {
|
} ?: throw IllegalStateException("Was not found supported type of data")
|
||||||
is ChannelChat -> ChannelMessage(
|
} catch (e: Exception) {
|
||||||
messageId,
|
UnknownMessageType(
|
||||||
chat,
|
messageId,
|
||||||
content,
|
chat,
|
||||||
date.asDate,
|
date.asDate,
|
||||||
edit_date ?.asDate,
|
e
|
||||||
forwarded,
|
)
|
||||||
reply_to_message ?.asMessage,
|
}
|
||||||
reply_markup,
|
|
||||||
author_signature
|
|
||||||
)
|
|
||||||
else -> CommonMessageImpl(
|
|
||||||
messageId,
|
|
||||||
from ?: throw IllegalStateException("Was detected common message, but owner (sender) of the message was not found"),
|
|
||||||
chat,
|
|
||||||
content,
|
|
||||||
date.asDate,
|
|
||||||
edit_date ?.asDate,
|
|
||||||
forwarded,
|
|
||||||
reply_to_message ?.asMessage,
|
|
||||||
reply_markup,
|
|
||||||
paymentInfo
|
|
||||||
)
|
|
||||||
}
|
|
||||||
} ?: throw IllegalStateException("Was not found supported type of data")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun throwWrongChatEvent(expected: KClass<*>, but: ChatEvent): CommonEvent {
|
private fun throwWrongChatEvent(expected: KClass<*>, but: ChatEvent): CommonEvent {
|
||||||
|
@ -13,6 +13,13 @@ interface Message {
|
|||||||
val date: DateTime
|
val date: DateTime
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data class UnknownMessageType(
|
||||||
|
override val messageId: MessageIdentifier,
|
||||||
|
override val chat: Chat,
|
||||||
|
override val date: DateTime,
|
||||||
|
val insideException: Exception
|
||||||
|
) : Message
|
||||||
|
|
||||||
internal class TelegramBotAPIMessageDeserializationStrategyClass<T> : DeserializationStrategy<T> {
|
internal class TelegramBotAPIMessageDeserializationStrategyClass<T> : DeserializationStrategy<T> {
|
||||||
override val descriptor: SerialDescriptor = StringDescriptor.withName("TelegramBotAPIMessageSerializer")
|
override val descriptor: SerialDescriptor = StringDescriptor.withName("TelegramBotAPIMessageSerializer")
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@ import com.github.insanusmokrassar.TelegramBotAPI.requests.send.SendContact
|
|||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Message
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MessageContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MessageContent
|
||||||
|
|
||||||
data class ContactContent(
|
data class ContactContent(
|
||||||
|
@ -7,7 +7,6 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
|||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.games.Game
|
import com.github.insanusmokrassar.TelegramBotAPI.types.games.Game
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Message
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MessageContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MessageContent
|
||||||
|
|
||||||
data class GameContent(
|
data class GameContent(
|
||||||
|
@ -5,7 +5,6 @@ import com.github.insanusmokrassar.TelegramBotAPI.requests.send.SendLocation
|
|||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Message
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MessageContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MessageContent
|
||||||
|
|
||||||
data class LocationContent(
|
data class LocationContent(
|
||||||
|
@ -6,7 +6,6 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
|||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Message
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MessageContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MessageContent
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.polls.Poll
|
import com.github.insanusmokrassar.TelegramBotAPI.types.polls.Poll
|
||||||
|
|
||||||
|
@ -2,14 +2,12 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.message.content
|
|||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.TextPart
|
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.TextPart
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.Request
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.Request
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.SendMessage
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.SendTextMessage
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.SendTextMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Message
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MessageContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MessageContent
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.*
|
import com.github.insanusmokrassar.TelegramBotAPI.utils.*
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@ import com.github.insanusmokrassar.TelegramBotAPI.requests.send.SendVenue
|
|||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Message
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MessageContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MessageContent
|
||||||
|
|
||||||
data class VenueContent(
|
data class VenueContent(
|
||||||
|
@ -5,15 +5,14 @@ import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.TextPart
|
|||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.Request
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.Request
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendAnimation
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendAnimation
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia.InputMedia
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia.InputMediaAnimation
|
import com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia.InputMediaAnimation
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.HTMLParseMode
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.MarkdownV2
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.files.AnimationFile
|
import com.github.insanusmokrassar.TelegramBotAPI.types.files.AnimationFile
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.files.DocumentFile
|
import com.github.insanusmokrassar.TelegramBotAPI.types.files.DocumentFile
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Message
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaContent
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.toHtmlCaptions
|
import com.github.insanusmokrassar.TelegramBotAPI.utils.toHtmlCaptions
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.toMarkdownV2Captions
|
import com.github.insanusmokrassar.TelegramBotAPI.utils.toMarkdownV2Captions
|
||||||
|
@ -5,7 +5,6 @@ import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.TextPart
|
|||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.Request
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.Request
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendAudio
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendAudio
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia.InputMedia
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia.InputMediaAudio
|
import com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia.InputMediaAudio
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.HTMLParseMode
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.HTMLParseMode
|
||||||
@ -13,7 +12,6 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.MarkdownV2
|
|||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.files.AudioFile
|
import com.github.insanusmokrassar.TelegramBotAPI.types.files.AudioFile
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Message
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaContent
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.toHtmlCaptions
|
import com.github.insanusmokrassar.TelegramBotAPI.utils.toHtmlCaptions
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.toMarkdownV2Captions
|
import com.github.insanusmokrassar.TelegramBotAPI.utils.toMarkdownV2Captions
|
||||||
|
@ -5,7 +5,6 @@ import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.TextPart
|
|||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.Request
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.Request
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendDocument
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendDocument
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia.InputMedia
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia.InputMediaDocument
|
import com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia.InputMediaDocument
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.HTMLParseMode
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.HTMLParseMode
|
||||||
@ -13,7 +12,6 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.MarkdownV2
|
|||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.files.DocumentFile
|
import com.github.insanusmokrassar.TelegramBotAPI.types.files.DocumentFile
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Message
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaContent
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.toHtmlCaptions
|
import com.github.insanusmokrassar.TelegramBotAPI.utils.toHtmlCaptions
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.toMarkdownV2Captions
|
import com.github.insanusmokrassar.TelegramBotAPI.utils.toMarkdownV2Captions
|
||||||
|
@ -4,7 +4,8 @@ import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.TextPart
|
|||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.Request
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.Request
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendPhoto
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendPhoto
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia.InputMediaPhoto
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia.MediaGroupMemberInputMedia
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.HTMLParseMode
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.HTMLParseMode
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.MarkdownV2
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.MarkdownV2
|
||||||
@ -12,7 +13,6 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
|||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.files.PhotoSize
|
import com.github.insanusmokrassar.TelegramBotAPI.types.files.PhotoSize
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.files.biggest
|
import com.github.insanusmokrassar.TelegramBotAPI.types.files.biggest
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Message
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaCollectionContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaCollectionContent
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaGroupContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaGroupContent
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.toHtmlCaptions
|
import com.github.insanusmokrassar.TelegramBotAPI.utils.toHtmlCaptions
|
||||||
|
@ -8,9 +8,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
|||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.files.Sticker
|
import com.github.insanusmokrassar.TelegramBotAPI.types.files.Sticker
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Message
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaContent
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.toMarkdownV2Captions
|
|
||||||
|
|
||||||
data class StickerContent(
|
data class StickerContent(
|
||||||
override val media: Sticker
|
override val media: Sticker
|
||||||
|
@ -4,14 +4,14 @@ import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.TextPart
|
|||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.Request
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.Request
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendVideo
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendVideo
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia.InputMediaVideo
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia.MediaGroupMemberInputMedia
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.HTMLParseMode
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.HTMLParseMode
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.MarkdownV2
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.MarkdownV2
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.files.VideoFile
|
import com.github.insanusmokrassar.TelegramBotAPI.types.files.VideoFile
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Message
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaGroupContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaGroupContent
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.toHtmlCaptions
|
import com.github.insanusmokrassar.TelegramBotAPI.utils.toHtmlCaptions
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.toMarkdownV2Captions
|
import com.github.insanusmokrassar.TelegramBotAPI.utils.toMarkdownV2Captions
|
||||||
|
@ -9,9 +9,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
|
|||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.files.VideoNoteFile
|
import com.github.insanusmokrassar.TelegramBotAPI.types.files.VideoNoteFile
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Message
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaContent
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.toMarkdownV2Captions
|
|
||||||
|
|
||||||
data class VideoNoteContent(
|
data class VideoNoteContent(
|
||||||
override val media: VideoNoteFile
|
override val media: VideoNoteFile
|
||||||
|
@ -5,7 +5,6 @@ import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.TextPart
|
|||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.Request
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.Request
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendVoice
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendVoice
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia.InputMedia
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia.InputMediaAudio
|
import com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia.InputMediaAudio
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.HTMLParseMode
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.HTMLParseMode
|
||||||
@ -13,7 +12,6 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.MarkdownV2
|
|||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.files.VoiceFile
|
import com.github.insanusmokrassar.TelegramBotAPI.types.files.VoiceFile
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Message
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaContent
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.toHtmlCaptions
|
import com.github.insanusmokrassar.TelegramBotAPI.utils.toHtmlCaptions
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.toMarkdownV2Captions
|
import com.github.insanusmokrassar.TelegramBotAPI.utils.toMarkdownV2Captions
|
||||||
|
@ -9,10 +9,12 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Telegr
|
|||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.payments.PreCheckoutQuery
|
import com.github.insanusmokrassar.TelegramBotAPI.types.payments.PreCheckoutQuery
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.payments.ShippingQuery
|
import com.github.insanusmokrassar.TelegramBotAPI.types.payments.ShippingQuery
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.polls.Poll
|
import com.github.insanusmokrassar.TelegramBotAPI.types.polls.Poll
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.UnknownUpdateType
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.Update
|
import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.Update
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.updateIdField
|
import com.github.insanusmokrassar.TelegramBotAPI.types.updateIdField
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
import kotlinx.serialization.json.JsonElement
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
internal data class RawUpdate constructor(
|
internal data class RawUpdate constructor(
|
||||||
@ -33,8 +35,12 @@ internal data class RawUpdate constructor(
|
|||||||
private val pre_checkout_query: PreCheckoutQuery? = null,
|
private val pre_checkout_query: PreCheckoutQuery? = null,
|
||||||
private val poll: Poll? = null
|
private val poll: Poll? = null
|
||||||
) {
|
) {
|
||||||
val asUpdate: Update by lazy {
|
private var initedUpdate: Update? = null
|
||||||
when {
|
/**
|
||||||
|
* @return One of children of [Update] interface or null in case of unknown type of update
|
||||||
|
*/
|
||||||
|
fun asUpdate(raw: JsonElement): Update {
|
||||||
|
return initedUpdate ?: when {
|
||||||
edited_message != null -> EditMessageUpdate(updateId, edited_message)
|
edited_message != null -> EditMessageUpdate(updateId, edited_message)
|
||||||
message != null -> MessageUpdate(updateId, message)
|
message != null -> MessageUpdate(updateId, message)
|
||||||
edited_channel_post != null -> EditChannelPostUpdate(updateId, edited_channel_post)
|
edited_channel_post != null -> EditChannelPostUpdate(updateId, edited_channel_post)
|
||||||
@ -42,11 +48,19 @@ internal data class RawUpdate constructor(
|
|||||||
|
|
||||||
chosen_inline_result != null -> ChosenInlineResultUpdate(updateId, chosen_inline_result.asChosenInlineResult)
|
chosen_inline_result != null -> ChosenInlineResultUpdate(updateId, chosen_inline_result.asChosenInlineResult)
|
||||||
inline_query != null -> InlineQueryUpdate(updateId, inline_query.asInlineQuery)
|
inline_query != null -> InlineQueryUpdate(updateId, inline_query.asInlineQuery)
|
||||||
callback_query != null -> CallbackQueryUpdate(updateId, callback_query.asCallbackQuery)
|
callback_query != null -> CallbackQueryUpdate(
|
||||||
|
updateId,
|
||||||
|
callback_query.asCallbackQuery(raw.jsonObject["callback_query"].toString())
|
||||||
|
)
|
||||||
shipping_query != null -> ShippingQueryUpdate(updateId, shipping_query)
|
shipping_query != null -> ShippingQueryUpdate(updateId, shipping_query)
|
||||||
pre_checkout_query != null -> PreCheckoutQueryUpdate(updateId, pre_checkout_query)
|
pre_checkout_query != null -> PreCheckoutQueryUpdate(updateId, pre_checkout_query)
|
||||||
poll != null -> PollUpdate(updateId, poll)
|
poll != null -> PollUpdate(updateId, poll)
|
||||||
else -> throw IllegalArgumentException("Unsupported type of update")
|
else -> UnknownUpdateType(
|
||||||
|
updateId,
|
||||||
|
raw.toString()
|
||||||
|
)
|
||||||
|
}.also {
|
||||||
|
initedUpdate = it
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,12 +4,19 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.UpdateIdentifier
|
|||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.update.RawUpdate
|
import com.github.insanusmokrassar.TelegramBotAPI.types.update.RawUpdate
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
import kotlinx.serialization.internal.StringDescriptor
|
import kotlinx.serialization.internal.StringDescriptor
|
||||||
|
import kotlinx.serialization.json.Json
|
||||||
|
import kotlinx.serialization.json.JsonElementSerializer
|
||||||
|
|
||||||
interface Update {
|
interface Update {
|
||||||
val updateId: UpdateIdentifier
|
val updateId: UpdateIdentifier
|
||||||
val data: Any
|
val data: Any
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data class UnknownUpdateType(
|
||||||
|
override val updateId: UpdateIdentifier,
|
||||||
|
override val data: String
|
||||||
|
) : Update
|
||||||
|
|
||||||
internal object UpdateSerializerWithoutDeserialization : KSerializer<Update> {
|
internal object UpdateSerializerWithoutDeserialization : KSerializer<Update> {
|
||||||
override val descriptor: SerialDescriptor = StringDescriptor.withName("UpdateSerializerWithoutDeserialization")
|
override val descriptor: SerialDescriptor = StringDescriptor.withName("UpdateSerializerWithoutDeserialization")
|
||||||
|
|
||||||
@ -24,6 +31,12 @@ internal object UpdateDeserializationStrategy : DeserializationStrategy<Update>
|
|||||||
override fun patch(decoder: Decoder, old: Update): Update = throw UpdateNotSupportedException(descriptor.name)
|
override fun patch(decoder: Decoder, old: Update): Update = throw UpdateNotSupportedException(descriptor.name)
|
||||||
|
|
||||||
override fun deserialize(decoder: Decoder): Update {
|
override fun deserialize(decoder: Decoder): Update {
|
||||||
return RawUpdate.serializer().deserialize(decoder).asUpdate
|
val asJson = JsonElementSerializer.deserialize(decoder)
|
||||||
|
return Json.nonstrict.fromJson(
|
||||||
|
RawUpdate.serializer(),
|
||||||
|
asJson
|
||||||
|
).asUpdate(
|
||||||
|
asJson
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package com.github.insanusmokrassar.TelegramBotAPI.updateshandlers
|
|||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.update.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.update.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.update.MediaGroupUpdates.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.update.MediaGroupUpdates.*
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.UnknownUpdateType
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.Update
|
import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.Update
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.extensions.UpdateReceiver
|
import com.github.insanusmokrassar.TelegramBotAPI.utils.extensions.UpdateReceiver
|
||||||
|
|
||||||
@ -20,7 +21,8 @@ data class UpdatesFilter(
|
|||||||
private val callbackQueryCallback: UpdateReceiver<CallbackQueryUpdate>? = null,
|
private val callbackQueryCallback: UpdateReceiver<CallbackQueryUpdate>? = null,
|
||||||
private val shippingQueryCallback: UpdateReceiver<ShippingQueryUpdate>? = null,
|
private val shippingQueryCallback: UpdateReceiver<ShippingQueryUpdate>? = null,
|
||||||
private val preCheckoutQueryCallback: UpdateReceiver<PreCheckoutQueryUpdate>? = null,
|
private val preCheckoutQueryCallback: UpdateReceiver<PreCheckoutQueryUpdate>? = null,
|
||||||
private val pollUpdateCallback: UpdateReceiver<PollUpdate>? = null
|
private val pollUpdateCallback: UpdateReceiver<PollUpdate>? = null,
|
||||||
|
private val unknownUpdateTypeCallback: UpdateReceiver<UnknownUpdateType>? = null
|
||||||
) {
|
) {
|
||||||
val asUpdateReceiver: UpdateReceiver<Update> = this::invoke
|
val asUpdateReceiver: UpdateReceiver<Update> = this::invoke
|
||||||
val allowedUpdates = listOfNotNull(
|
val allowedUpdates = listOfNotNull(
|
||||||
@ -72,6 +74,7 @@ data class UpdatesFilter(
|
|||||||
is ShippingQueryUpdate -> shippingQueryCallback ?.invoke(update)
|
is ShippingQueryUpdate -> shippingQueryCallback ?.invoke(update)
|
||||||
is PreCheckoutQueryUpdate -> preCheckoutQueryCallback ?.invoke(update)
|
is PreCheckoutQueryUpdate -> preCheckoutQueryCallback ?.invoke(update)
|
||||||
is PollUpdate -> pollUpdateCallback ?.invoke(update)
|
is PollUpdate -> pollUpdateCallback ?.invoke(update)
|
||||||
|
is UnknownUpdateType -> unknownUpdateTypeCallback ?.invoke(update)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -87,7 +90,8 @@ fun createSimpleUpdateFilter(
|
|||||||
callbackQueryCallback: UpdateReceiver<CallbackQueryUpdate>? = null,
|
callbackQueryCallback: UpdateReceiver<CallbackQueryUpdate>? = null,
|
||||||
shippingQueryCallback: UpdateReceiver<ShippingQueryUpdate>? = null,
|
shippingQueryCallback: UpdateReceiver<ShippingQueryUpdate>? = null,
|
||||||
preCheckoutQueryCallback: UpdateReceiver<PreCheckoutQueryUpdate>? = null,
|
preCheckoutQueryCallback: UpdateReceiver<PreCheckoutQueryUpdate>? = null,
|
||||||
pollCallback: UpdateReceiver<PollUpdate>? = null
|
pollCallback: UpdateReceiver<PollUpdate>? = null,
|
||||||
|
unknownCallback: UpdateReceiver<UnknownUpdateType>? = null
|
||||||
): UpdatesFilter = UpdatesFilter(
|
): UpdatesFilter = UpdatesFilter(
|
||||||
messageCallback = messageCallback,
|
messageCallback = messageCallback,
|
||||||
messageMediaGroupCallback = mediaGroupCallback,
|
messageMediaGroupCallback = mediaGroupCallback,
|
||||||
@ -102,5 +106,6 @@ fun createSimpleUpdateFilter(
|
|||||||
callbackQueryCallback = callbackQueryCallback,
|
callbackQueryCallback = callbackQueryCallback,
|
||||||
shippingQueryCallback = shippingQueryCallback,
|
shippingQueryCallback = shippingQueryCallback,
|
||||||
preCheckoutQueryCallback = preCheckoutQueryCallback,
|
preCheckoutQueryCallback = preCheckoutQueryCallback,
|
||||||
pollUpdateCallback = pollCallback
|
pollUpdateCallback = pollCallback,
|
||||||
|
unknownUpdateTypeCallback = unknownCallback
|
||||||
)
|
)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.utils
|
package com.github.insanusmokrassar.TelegramBotAPI.utils
|
||||||
|
|
||||||
import kotlin.Experimental.*
|
import kotlin.Experimental.Level
|
||||||
|
|
||||||
@Experimental(Level.WARNING)
|
@Experimental(Level.WARNING)
|
||||||
annotation class PreviewFeature
|
annotation class PreviewFeature
|
||||||
|
@ -3,7 +3,7 @@ package com.github.insanusmokrassar.TelegramBotAPI.utils
|
|||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PrivateChat
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PrivateChat
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.UsernameChat
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.UsernameChat
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.extended.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.extended.ExtendedChat
|
||||||
|
|
||||||
private const val internalLinkBeginning = "https://t.me"
|
private const val internalLinkBeginning = "https://t.me"
|
||||||
|
|
||||||
|
@ -107,6 +107,10 @@ internal fun MultilevelTextSource.boldMarkdownV2(): String = markdownV2Default(m
|
|||||||
internal fun MultilevelTextSource.boldHTML(): String = htmlDefault(htmlBoldControl)
|
internal fun MultilevelTextSource.boldHTML(): String = htmlDefault(htmlBoldControl)
|
||||||
|
|
||||||
|
|
||||||
|
internal fun MultilevelTextSource.cashTagMarkdownV2(): String = textParts.joinSubSourcesMarkdownV2()
|
||||||
|
internal fun MultilevelTextSource.cashTagHTML(): String = textParts.joinSubSourcesHtml()
|
||||||
|
|
||||||
|
|
||||||
internal fun MultilevelTextSource.italicMarkdownV2(): String = markdownV2Default(markdownItalicControl)
|
internal fun MultilevelTextSource.italicMarkdownV2(): String = markdownV2Default(markdownItalicControl)
|
||||||
internal fun MultilevelTextSource.italicHTML(): String = htmlDefault(htmlItalicControl)
|
internal fun MultilevelTextSource.italicHTML(): String = htmlDefault(htmlItalicControl)
|
||||||
|
|
||||||
|
@ -145,6 +145,11 @@ fun String.regularMarkdownV2(): String = escapeMarkdownV2Common()
|
|||||||
fun String.regularHtml(): String = toHtml()
|
fun String.regularHtml(): String = toHtml()
|
||||||
|
|
||||||
|
|
||||||
|
fun String.cashTagMarkdown(): String = toMarkdown()
|
||||||
|
fun String.cashTagMarkdownV2(): String = escapeMarkdownV2Common()
|
||||||
|
fun String.cashTagHtml(): String = toHtml()
|
||||||
|
|
||||||
|
|
||||||
infix fun String.bold(parseMode: ParseMode): String = when (parseMode) {
|
infix fun String.bold(parseMode: ParseMode): String = when (parseMode) {
|
||||||
is HTML -> boldHTML()
|
is HTML -> boldHTML()
|
||||||
is Markdown -> boldMarkdown()
|
is Markdown -> boldMarkdown()
|
||||||
@ -230,3 +235,9 @@ infix fun String.regular(parseMode: ParseMode): String = when (parseMode) {
|
|||||||
is Markdown -> regularMarkdown()
|
is Markdown -> regularMarkdown()
|
||||||
is MarkdownV2 -> regularMarkdownV2()
|
is MarkdownV2 -> regularMarkdownV2()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
infix fun String.cashtag(parseMode: ParseMode): String = when (parseMode) {
|
||||||
|
is HTML -> cashTagHtml()
|
||||||
|
is Markdown -> cashTagMarkdown()
|
||||||
|
is MarkdownV2 -> cashTagMarkdownV2()
|
||||||
|
}
|
||||||
|
@ -73,12 +73,12 @@ suspend fun RequestsExecutor.setWebhook(
|
|||||||
module {
|
module {
|
||||||
routing {
|
routing {
|
||||||
post(listenRoute) {
|
post(listenRoute) {
|
||||||
val deserialized = call.receiveText()
|
val asJson = Json.nonstrict.parseJson(call.receiveText())
|
||||||
val update = Json.nonstrict.parse(
|
val update = Json.nonstrict.fromJson(
|
||||||
RawUpdate.serializer(),
|
RawUpdate.serializer(),
|
||||||
deserialized
|
asJson
|
||||||
)
|
)
|
||||||
updatesChannel.send(update.asUpdate)
|
updatesChannel.send(update.asUpdate(asJson))
|
||||||
call.respond("Ok")
|
call.respond("Ok")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user