mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 08:13:47 +00:00
add TextSource
This commit is contained in:
parent
dd0e3c04bc
commit
6f1f5e640a
@ -14,6 +14,11 @@
|
|||||||
* `TextMentionMessageEntity` now accept `PrivateChat` instead of `User` in main constructor
|
* `TextMentionMessageEntity` now accept `PrivateChat` instead of `User` in main constructor
|
||||||
* `TextMentionMessageEntity` now contains not user, but contains `PrivateChat`
|
* `TextMentionMessageEntity` now contains not user, but contains `PrivateChat`
|
||||||
* Fixeed: `TextMentionMessageEntity#asHtmlSource` previously worked incorrect
|
* Fixeed: `TextMentionMessageEntity#asHtmlSource` previously worked incorrect
|
||||||
|
* Abstraction `TextSource`
|
||||||
|
* `MessageEntity` now extends `TextSource`
|
||||||
|
* `createFormattedText` method now accept `List<TextSource>`
|
||||||
|
* `createHtmlText` method now accept `List<TextSource>`
|
||||||
|
* `createMarkdownText` method now accept `List<TextSource>`
|
||||||
|
|
||||||
## 0.19.0 ImplicitReflection removing
|
## 0.19.0 ImplicitReflection removing
|
||||||
|
|
||||||
|
@ -0,0 +1,6 @@
|
|||||||
|
package com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts
|
||||||
|
|
||||||
|
interface TextSource {
|
||||||
|
val asMarkdownSource: String
|
||||||
|
val asHtmlSource: String
|
||||||
|
}
|
@ -1,10 +1,9 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity
|
package com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity
|
||||||
|
|
||||||
interface MessageEntity {
|
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.TextSource
|
||||||
|
|
||||||
|
interface MessageEntity : TextSource {
|
||||||
val offset: Int
|
val offset: Int
|
||||||
val length: Int
|
val length: Int
|
||||||
val sourceString: String
|
val sourceString: String
|
||||||
|
|
||||||
val asMarkdownSource: String
|
|
||||||
val asHtmlSource: String
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.utils
|
package com.github.insanusmokrassar.TelegramBotAPI.utils
|
||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.CaptionedInput
|
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.CaptionedInput
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.TextSource
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.MessageEntity
|
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.MessageEntity
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.RegularTextMessageEntity
|
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.RegularTextMessageEntity
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.*
|
||||||
@ -37,7 +38,7 @@ fun convertToFullMessageEntityList(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun createFormattedText(
|
fun createFormattedText(
|
||||||
entities: List<MessageEntity>,
|
entities: List<TextSource>,
|
||||||
partLength: Int = 4096,
|
partLength: Int = 4096,
|
||||||
mode: ParseMode = MarkdownParseMode
|
mode: ParseMode = MarkdownParseMode
|
||||||
): List<String> {
|
): List<String> {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.utils
|
package com.github.insanusmokrassar.TelegramBotAPI.utils
|
||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.CaptionedInput
|
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.CaptionedInput
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.TextSource
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.MessageEntity
|
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.MessageEntity
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.HTMLParseMode
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.HTMLParseMode
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.captionLength
|
import com.github.insanusmokrassar.TelegramBotAPI.types.captionLength
|
||||||
@ -8,7 +9,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.TextCont
|
|||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.textLength
|
import com.github.insanusmokrassar.TelegramBotAPI.types.textLength
|
||||||
|
|
||||||
fun createHtmlText(
|
fun createHtmlText(
|
||||||
entities: List<MessageEntity>,
|
entities: List<TextSource>,
|
||||||
partLength: Int = 4096
|
partLength: Int = 4096
|
||||||
): List<String> = createFormattedText(entities, partLength, HTMLParseMode)
|
): List<String> = createFormattedText(entities, partLength, HTMLParseMode)
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.utils
|
package com.github.insanusmokrassar.TelegramBotAPI.utils
|
||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.CaptionedInput
|
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.CaptionedInput
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.TextSource
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.MessageEntity
|
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.MessageEntity
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.MarkdownParseMode
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.MarkdownParseMode
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.captionLength
|
import com.github.insanusmokrassar.TelegramBotAPI.types.captionLength
|
||||||
@ -8,7 +9,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.TextCont
|
|||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.textLength
|
import com.github.insanusmokrassar.TelegramBotAPI.types.textLength
|
||||||
|
|
||||||
fun createMarkdownText(
|
fun createMarkdownText(
|
||||||
entities: List<MessageEntity>,
|
entities: List<TextSource>,
|
||||||
partLength: Int = 4096
|
partLength: Int = 4096
|
||||||
): List<String> = createFormattedText(entities, partLength, MarkdownParseMode)
|
): List<String> = createFormattedText(entities, partLength, MarkdownParseMode)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user