mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 16:23:48 +00:00
start add stories
This commit is contained in:
parent
4b5baaff8c
commit
a65971be00
@ -31,6 +31,7 @@ import dev.inmo.tgbotapi.types.payments.SuccessfulPayment
|
|||||||
import dev.inmo.tgbotapi.types.polls.Poll
|
import dev.inmo.tgbotapi.types.polls.Poll
|
||||||
import dev.inmo.tgbotapi.types.request.ChatShared
|
import dev.inmo.tgbotapi.types.request.ChatShared
|
||||||
import dev.inmo.tgbotapi.types.request.UserShared
|
import dev.inmo.tgbotapi.types.request.UserShared
|
||||||
|
import dev.inmo.tgbotapi.types.stories.Story
|
||||||
import dev.inmo.tgbotapi.types.venue.Venue
|
import dev.inmo.tgbotapi.types.venue.Venue
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
@ -65,6 +66,7 @@ internal data class RawMessage(
|
|||||||
private val caption: String? = null,
|
private val caption: String? = null,
|
||||||
private val caption_entities: RawMessageEntities? = null,
|
private val caption_entities: RawMessageEntities? = null,
|
||||||
private val has_media_spoiler: Boolean? = null,
|
private val has_media_spoiler: Boolean? = null,
|
||||||
|
private val story: Story? = null,
|
||||||
private val audio: AudioFile? = null,
|
private val audio: AudioFile? = null,
|
||||||
private val document: DocumentFile? = null,
|
private val document: DocumentFile? = null,
|
||||||
private val animation: AnimationFile? = null,
|
private val animation: AnimationFile? = null,
|
||||||
@ -134,6 +136,11 @@ internal data class RawMessage(
|
|||||||
} ?: emptyList()
|
} ?: emptyList()
|
||||||
|
|
||||||
when {
|
when {
|
||||||
|
story != null -> StoryContent(
|
||||||
|
from ?: error("For story content field 'from' is required and should contains User info"),
|
||||||
|
messageId,
|
||||||
|
story
|
||||||
|
)
|
||||||
text != null -> TextContent(text, (entities ?: emptyList()).asTextSources(text))
|
text != null -> TextContent(text, (entities ?: emptyList()).asTextSources(text))
|
||||||
audio != null -> AudioContent(
|
audio != null -> AudioContent(
|
||||||
audio,
|
audio,
|
||||||
|
@ -0,0 +1,38 @@
|
|||||||
|
package dev.inmo.tgbotapi.types.message.content
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.requests.ForwardMessage
|
||||||
|
import dev.inmo.tgbotapi.requests.abstracts.Request
|
||||||
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
|
import dev.inmo.tgbotapi.types.MessageId
|
||||||
|
import dev.inmo.tgbotapi.types.MessageThreadId
|
||||||
|
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||||
|
import dev.inmo.tgbotapi.types.chat.Chat
|
||||||
|
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||||
|
import dev.inmo.tgbotapi.types.stories.Story
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class StoryContent(
|
||||||
|
private val from: Chat,
|
||||||
|
private val messageId: MessageId,
|
||||||
|
val story: Story
|
||||||
|
) : MessageContent {
|
||||||
|
override fun createResend(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
messageThreadId: MessageThreadId?,
|
||||||
|
disableNotification: Boolean,
|
||||||
|
protectContent: Boolean,
|
||||||
|
replyToMessageId: MessageId?,
|
||||||
|
allowSendingWithoutReply: Boolean?,
|
||||||
|
replyMarkup: KeyboardMarkup?
|
||||||
|
): Request<out Message> {
|
||||||
|
return ForwardMessage(
|
||||||
|
from.id,
|
||||||
|
toChatId = chatId,
|
||||||
|
messageId = messageId,
|
||||||
|
threadId = messageThreadId,
|
||||||
|
disableNotification = disableNotification,
|
||||||
|
protectContent = protectContent
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
package dev.inmo.tgbotapi.types.stories
|
||||||
|
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
class Story
|
Loading…
Reference in New Issue
Block a user