mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 08:13:47 +00:00
first part of deprecations removing
This commit is contained in:
parent
24498479a8
commit
c1b5b3ca19
@ -5,7 +5,13 @@
|
|||||||
* Total rework of serialization for requests. Now all `SimpleRequest` children have:
|
* Total rework of serialization for requests. Now all `SimpleRequest` children have:
|
||||||
* `requestSerializer` - field, which must provide serializer of current type
|
* `requestSerializer` - field, which must provide serializer of current type
|
||||||
* `resultDeserializer` - field, which must provide opportunity to deserializer result. Previously it was a function
|
* `resultDeserializer` - field, which must provide opportunity to deserializer result. Previously it was a function
|
||||||
|
* Removed deprecations:
|
||||||
|
* `com.github.insanusmokrassar.TelegramBotAPI.utils.extensions.WebhookPrivateKeyConfig`
|
||||||
|
* `com.github.insanusmokrassar.TelegramBotAPI.utils.extensions.UpdatesFilter`
|
||||||
|
* `com.github.insanusmokrassar.TelegramBotAPI.utils.extensions.createSimpleUpdateFilter`
|
||||||
|
* `com.github.insanusmokrassar.TelegramBotAPI.utils.createMarkdownText`
|
||||||
|
* `com.github.insanusmokrassar.TelegramBotAPI.utils.toMarkdownCaption`
|
||||||
|
* `com.github.insanusmokrassar.TelegramBotAPI.utils.toMarkdownText`
|
||||||
|
|
||||||
## 0.18.0 Raws cleaning
|
## 0.18.0 Raws cleaning
|
||||||
|
|
||||||
|
@ -7,46 +7,16 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.captionLength
|
|||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.TextContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.TextContent
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.textLength
|
import com.github.insanusmokrassar.TelegramBotAPI.types.textLength
|
||||||
|
|
||||||
@Deprecated(
|
|
||||||
"Deprecated because old version have problem with long texts, but new one must return list of strings"
|
|
||||||
)
|
|
||||||
fun createMarkdownText(
|
|
||||||
text: String,
|
|
||||||
messageEntities: List<MessageEntity>
|
|
||||||
): String {
|
|
||||||
return createMarkdownText(
|
|
||||||
convertToFullMessageEntityList(text, messageEntities)
|
|
||||||
).first()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun createMarkdownText(
|
fun createMarkdownText(
|
||||||
entities: List<MessageEntity>,
|
entities: List<MessageEntity>,
|
||||||
partLength: Int = 4096
|
partLength: Int = 4096
|
||||||
): List<String> = createFormattedText(entities, partLength, MarkdownParseMode)
|
): List<String> = createFormattedText(entities, partLength, MarkdownParseMode)
|
||||||
|
|
||||||
@Deprecated(
|
|
||||||
"Deprecated because old version have problem with long texts, but new one must return list of strings",
|
|
||||||
ReplaceWith(
|
|
||||||
"toMarkdownCaptions().firstOrNull()",
|
|
||||||
"com.github.insanusmokrassar.TelegramBotAPI.utils.toMarkdownCaptions"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
fun CaptionedInput.toMarkdownCaption(): String? = toMarkdownCaptions().firstOrNull()
|
|
||||||
|
|
||||||
fun CaptionedInput.toMarkdownCaptions(): List<String> = createMarkdownText(
|
fun CaptionedInput.toMarkdownCaptions(): List<String> = createMarkdownText(
|
||||||
fullEntitiesList(),
|
fullEntitiesList(),
|
||||||
captionLength.endInclusive + 1
|
captionLength.endInclusive + 1
|
||||||
)
|
)
|
||||||
|
|
||||||
@Deprecated(
|
|
||||||
"Deprecated because old version have problem with long texts, but new one must return list of strings",
|
|
||||||
ReplaceWith(
|
|
||||||
"toMarkdownTexts().first()",
|
|
||||||
"com.github.insanusmokrassar.TelegramBotAPI.utils.toMarkdownTexts"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
fun TextContent.toMarkdownText(): String = toMarkdownTexts().first()
|
|
||||||
|
|
||||||
fun TextContent.toMarkdownTexts(): List<String> = createMarkdownText(
|
fun TextContent.toMarkdownTexts(): List<String> = createMarkdownText(
|
||||||
fullEntitiesList(),
|
fullEntitiesList(),
|
||||||
textLength.endInclusive + 1
|
textLength.endInclusive + 1
|
||||||
|
@ -1,45 +0,0 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.utils.extensions
|
|
||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.update.*
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.update.MediaGroupUpdates.MediaGroupUpdate
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.updateshandlers.UpdatesFilter
|
|
||||||
|
|
||||||
@Deprecated(
|
|
||||||
"Replaced in separated package",
|
|
||||||
ReplaceWith(
|
|
||||||
"UpdatesFilter",
|
|
||||||
"com.github.insanusmokrassar.TelegramBotAPI.updateshandlers.UpdatesFilter"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
typealias UpdatesFilter = UpdatesFilter
|
|
||||||
|
|
||||||
@Deprecated(
|
|
||||||
"Replaced in separated package",
|
|
||||||
ReplaceWith(
|
|
||||||
"createSimpleUpdateFilter",
|
|
||||||
"com.github.insanusmokrassar.TelegramBotAPI.updateshandlers.createSimpleUpdateFilter"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
fun createSimpleUpdateFilter(
|
|
||||||
messageCallback: UpdateReceiver<MessageUpdate>? = null,
|
|
||||||
mediaGroupCallback: UpdateReceiver<MediaGroupUpdate>? = null,
|
|
||||||
editedMessageCallback: UpdateReceiver<EditMessageUpdate>? = null,
|
|
||||||
channelPostCallback: UpdateReceiver<ChannelPostUpdate>? = null,
|
|
||||||
editedChannelPostCallback: UpdateReceiver<EditChannelPostUpdate>? = null,
|
|
||||||
chosenInlineResultCallback: UpdateReceiver<ChosenInlineResultUpdate>? = null,
|
|
||||||
inlineQueryCallback: UpdateReceiver<InlineQueryUpdate>? = null,
|
|
||||||
callbackQueryCallback: UpdateReceiver<CallbackQueryUpdate>? = null,
|
|
||||||
shippingQueryCallback: UpdateReceiver<ShippingQueryUpdate>? = null,
|
|
||||||
preCheckoutQueryCallback: UpdateReceiver<PreCheckoutQueryUpdate>? = null
|
|
||||||
): UpdatesFilter = com.github.insanusmokrassar.TelegramBotAPI.updateshandlers.createSimpleUpdateFilter(
|
|
||||||
messageCallback,
|
|
||||||
mediaGroupCallback,
|
|
||||||
editedMessageCallback,
|
|
||||||
channelPostCallback,
|
|
||||||
editedChannelPostCallback,
|
|
||||||
chosenInlineResultCallback,
|
|
||||||
inlineQueryCallback,
|
|
||||||
callbackQueryCallback,
|
|
||||||
shippingQueryCallback,
|
|
||||||
preCheckoutQueryCallback
|
|
||||||
)
|
|
@ -1,12 +0,0 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.utils.extensions
|
|
||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.updateshandlers.webhook.WebhookPrivateKeyConfig
|
|
||||||
|
|
||||||
@Deprecated(
|
|
||||||
"Replaced in separated package",
|
|
||||||
ReplaceWith(
|
|
||||||
"WebhookPrivateKeyConfig",
|
|
||||||
"com.github.insanusmokrassar.TelegramBotAPI.updateshandlers.webhook.WebhookPrivateKeyConfig"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
typealias WebhookPrivateKeyConfig = WebhookPrivateKeyConfig
|
|
Loading…
Reference in New Issue
Block a user