mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-25 03:28:44 +00:00
ResendableContent#createResends
This commit is contained in:
parent
4c0472a139
commit
d79d163750
@ -19,6 +19,8 @@
|
|||||||
must be regular text
|
must be regular text
|
||||||
* Change signature of `createMarkdownText`: now it will return list of strings
|
* Change signature of `createMarkdownText`: now it will return list of strings
|
||||||
* Deprecate old signatures of `createMarkdownText`, `toMarkdownCaption`, `toMarkdownText`
|
* Deprecate old signatures of `createMarkdownText`, `toMarkdownCaption`, `toMarkdownText`
|
||||||
|
* Add `ResendableContent#createResends` which create adapted list of resends for content
|
||||||
|
* Add `TextContent` own `createResends` realisation
|
||||||
|
|
||||||
### 0.8.5
|
### 0.8.5
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
|||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage
|
||||||
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.toMarkdownText
|
import com.github.insanusmokrassar.TelegramBotAPI.utils.toMarkdownText
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.utils.toMarkdownTexts
|
||||||
|
|
||||||
data class TextContent(
|
data class TextContent(
|
||||||
val text: String,
|
val text: String,
|
||||||
@ -29,4 +30,21 @@ data class TextContent(
|
|||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
replyMarkup
|
replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
|
override fun createResends(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
disableNotification: Boolean,
|
||||||
|
replyToMessageId: MessageIdentifier?,
|
||||||
|
replyMarkup: KeyboardMarkup?
|
||||||
|
): List<Request<RawMessage>> = toMarkdownTexts().map {
|
||||||
|
SendMessage(
|
||||||
|
chatId,
|
||||||
|
it,
|
||||||
|
MarkdownParseMode,
|
||||||
|
false,
|
||||||
|
disableNotification,
|
||||||
|
replyToMessageId,
|
||||||
|
replyMarkup
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,4 +13,11 @@ interface ResendableContent {
|
|||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
): Request<RawMessage>
|
): Request<RawMessage>
|
||||||
|
|
||||||
|
fun createResends(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
): List<Request<RawMessage>> = listOf(createResend(chatId, disableNotification, replyToMessageId, replyMarkup))
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user