1
0
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:
InsanusMokrassar 2019-12-02 14:39:19 +06:00
parent 24498479a8
commit c1b5b3ca19
4 changed files with 7 additions and 88 deletions

View File

@ -5,7 +5,13 @@
* Total rework of serialization for requests. Now all `SimpleRequest` children have:
* `requestSerializer` - field, which must provide serializer of current type
* `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

View File

@ -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.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(
entities: List<MessageEntity>,
partLength: Int = 4096
): 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(
fullEntitiesList(),
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(
fullEntitiesList(),
textLength.endInclusive + 1

View File

@ -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
)

View File

@ -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