1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-12-23 00:57:13 +00:00

add PollContent

This commit is contained in:
InsanusMokrassar 2019-04-16 16:04:02 +08:00
parent 457cadf265
commit e2267c1cb4
3 changed files with 29 additions and 0 deletions

View File

@ -5,6 +5,7 @@
* Type `PollOption` and `AnonymousPollOption` added
* Type `Poll` added
* Type `PollUpdate` added and implemented in `RawUpdate`. Now `PollUpdate` can be retrieved from `RawUpdate`
* type `PollContent` added - now it can be a value of `ContentMessage#content`
## 0.12.0 Webhooks

View File

@ -17,6 +17,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.message.payments.Success
import com.github.insanusmokrassar.TelegramBotAPI.types.message.payments.abstracts.PaymentInfo
import com.github.insanusmokrassar.TelegramBotAPI.types.payments.Invoice
import com.github.insanusmokrassar.TelegramBotAPI.types.payments.SuccessfulPayment
import com.github.insanusmokrassar.TelegramBotAPI.types.polls.Poll
import kotlinx.serialization.*
import kotlin.reflect.KClass
@ -59,6 +60,7 @@ data class RawMessage(
private val contact: Contact? = null,
private val location: Location? = null,
private val venue: Venue? = null,
private val poll: Poll? = null,
private val new_chat_members: List<User>? = null,
private val left_chat_member: User? = null,
private val new_chat_title: String? = null,
@ -122,6 +124,7 @@ data class RawMessage(
contact != null -> ContactContent(contact)
location != null -> LocationContent(location)
venue != null -> VenueContent(venue)
poll != null -> PollContent(poll)
else -> null
}
}

View File

@ -0,0 +1,25 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.message.content
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.Request
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.SendMessage
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.MessageEntity
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.*
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MessageContent
import com.github.insanusmokrassar.TelegramBotAPI.types.polls.Poll
import com.github.insanusmokrassar.TelegramBotAPI.utils.toHtmlTexts
import com.github.insanusmokrassar.TelegramBotAPI.utils.toMarkdownTexts
data class PollContent(
val poll: Poll
) : MessageContent {
override fun createResend(
chatId: ChatIdentifier,
disableNotification: Boolean,
replyToMessageId: MessageIdentifier?,
replyMarkup: KeyboardMarkup?
): Request<RawMessage> = TODO()
}