mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-12-25 18:17:13 +00:00
StopPoll and deprecations of By*MessageId
This commit is contained in:
parent
d7bbb6dd85
commit
3bb1cb1552
@ -7,6 +7,11 @@
|
||||
* 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`
|
||||
* Request `SendPoll` added and `PollContent#createResend` now use it
|
||||
* `ByInlineMessageId` is deprecated (use `InlineMessageAction` instead)
|
||||
* `ByMessageId` is deprecated (use `MessageAction` instead)
|
||||
* Most part of requests which are working with identifiers of messages now implement `MessageAction` directly or
|
||||
by their parents
|
||||
* `StopPoll` implemented
|
||||
|
||||
## 0.12.0 Webhooks
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineMessageIdentifier
|
||||
|
||||
interface ByInlineMessageId {
|
||||
val inlineMessageId: InlineMessageIdentifier
|
||||
}
|
||||
@Deprecated(
|
||||
"Deprecated for the reason of creating of more obvious type interface",
|
||||
ReplaceWith("InlineMessageAction", "com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.InlineMessageAction")
|
||||
)
|
||||
typealias ByInlineMessageId = InlineMessageAction
|
@ -1,7 +1,8 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
||||
@Deprecated(
|
||||
"Deprecated for the reason of creating of more obvious type interface",
|
||||
ReplaceWith("MessageAction", "com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.MessageAction")
|
||||
|
||||
interface ByMessageId : ChatRequest {
|
||||
val messageId: MessageIdentifier
|
||||
}
|
||||
)
|
||||
typealias ByMessageId = MessageAction
|
@ -0,0 +1,7 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineMessageIdentifier
|
||||
|
||||
interface InlineMessageAction {
|
||||
val inlineMessageId: InlineMessageIdentifier
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
||||
|
||||
interface MessageAction: ChatRequest {
|
||||
val messageId: MessageIdentifier
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.MessageAction
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
import kotlinx.serialization.*
|
||||
@ -8,10 +9,10 @@ import kotlinx.serialization.internal.BooleanSerializer
|
||||
@Serializable
|
||||
data class DeleteMessage(
|
||||
@SerialName(chatIdField)
|
||||
val chatId: ChatIdentifier,
|
||||
override val chatId: ChatIdentifier,
|
||||
@SerialName(messageIdField)
|
||||
val messageId: MessageIdentifier
|
||||
) : SimpleRequest<Boolean> {
|
||||
override val messageId: MessageIdentifier
|
||||
) : SimpleRequest<Boolean>, MessageAction {
|
||||
override fun method(): String = "deleteMessage"
|
||||
|
||||
override fun resultSerializer(): KSerializer<Boolean> = BooleanSerializer
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.MessageAction
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage
|
||||
@ -12,10 +13,14 @@ data class ForwardMessage(
|
||||
@SerialName(chatIdField)
|
||||
val toChatId: ChatIdentifier,
|
||||
@SerialName(messageIdField)
|
||||
val messageId: MessageIdentifier,
|
||||
override val messageId: MessageIdentifier,
|
||||
@SerialName(disableNotificationField)
|
||||
val disableNotification: Boolean = false
|
||||
): SimpleRequest<RawMessage> {
|
||||
): SimpleRequest<RawMessage>, MessageAction {
|
||||
@Transient
|
||||
override val chatId: ChatIdentifier
|
||||
get() = fromChatId
|
||||
|
||||
override fun method(): String = "forwardMessage"
|
||||
|
||||
override fun resultSerializer(): KSerializer<RawMessage> = RawMessage.serializer()
|
||||
|
@ -0,0 +1,24 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.SendChatMessageRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.SendMessageRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.polls.Poll
|
||||
import kotlinx.serialization.*
|
||||
|
||||
@Serializable
|
||||
data class StopPoll(
|
||||
@SerialName(chatIdField)
|
||||
override val chatId: ChatIdentifier,
|
||||
@SerialName(messageIdField)
|
||||
override val messageId: MessageIdentifier,
|
||||
@SerialName(replyMarkupField)
|
||||
override val replyMarkup: InlineKeyboardMarkup?
|
||||
) : MessageAction, SimpleRequest<Poll>, ReplyMarkup {
|
||||
override fun method(): String = "stopPoll"
|
||||
override fun resultSerializer(): KSerializer<Poll> = Poll.serializer()
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.DisableNotification
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
import kotlinx.serialization.*
|
||||
@ -12,10 +11,10 @@ data class PinChatMessage (
|
||||
@SerialName(chatIdField)
|
||||
override val chatId: ChatIdentifier,
|
||||
@SerialName(messageIdField)
|
||||
val messageId: MessageIdentifier,
|
||||
override val messageId: MessageIdentifier,
|
||||
@SerialName(disableNotificationField)
|
||||
override val disableNotification: Boolean = false
|
||||
): ChatRequest, SimpleRequest<Boolean>, DisableNotification {
|
||||
): ChatRequest, SimpleRequest<Boolean>, MessageAction, DisableNotification {
|
||||
override fun method(): String = "pinChatMessage"
|
||||
override fun resultSerializer(): KSerializer<Boolean> = BooleanSerializer
|
||||
}
|
||||
|
@ -1,11 +1,9 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.MessageAction
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage
|
||||
|
||||
interface EditChatMessage : SimpleRequest<RawMessage> {
|
||||
val chatId: ChatIdentifier
|
||||
val messageId: MessageIdentifier
|
||||
}
|
||||
interface EditChatMessage : SimpleRequest<RawMessage>, MessageAction
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.games
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ByMessageId
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.MessageAction
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.games.abstracts.GetGameHighScores
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
import kotlinx.serialization.SerialName
|
||||
@ -14,4 +14,4 @@ data class GetGameHighScoresByChat (
|
||||
override val chatId: ChatId,
|
||||
@SerialName(messageIdField)
|
||||
override val messageId: MessageIdentifier
|
||||
) : GetGameHighScores, ByMessageId
|
||||
) : GetGameHighScores, MessageAction
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.games
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ByInlineMessageId
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.InlineMessageAction
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.games.abstracts.GetGameHighScores
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
import kotlinx.serialization.SerialName
|
||||
@ -12,4 +13,4 @@ data class GetGameHighScoresByInlineMessageId (
|
||||
override val userId: UserId,
|
||||
@SerialName(inlineMessageIdField)
|
||||
override val inlineMessageId: InlineMessageIdentifier
|
||||
) : GetGameHighScores, ByInlineMessageId
|
||||
) : GetGameHighScores, InlineMessageAction
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.games
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ByMessageId
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.MessageAction
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.games.abstracts.SetGameScore
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
import kotlinx.serialization.SerialName
|
||||
@ -20,4 +20,4 @@ data class SetGameScoreByChatId (
|
||||
override val force: Boolean = false,
|
||||
@SerialName(disableEditMessageField)
|
||||
override val disableEditMessage: Boolean = false
|
||||
) : SetGameScore, ByMessageId
|
||||
) : SetGameScore, MessageAction
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.games
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ByInlineMessageId
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.InlineMessageAction
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.games.abstracts.SetGameScore
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
import kotlinx.serialization.SerialName
|
||||
@ -18,4 +19,4 @@ data class SetGameScoreByInlineMessageId (
|
||||
override val force: Boolean = false,
|
||||
@SerialName(disableEditMessageField)
|
||||
override val disableEditMessage: Boolean = false
|
||||
) : SetGameScore, ByInlineMessageId
|
||||
) : SetGameScore, InlineMessageAction
|
||||
|
@ -1,18 +1,13 @@
|
||||
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.requests.send.SendPoll
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user