mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-25 03:28:44 +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 `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`
|
* Type `PollContent` added - now it can be a value of `ContentMessage#content`
|
||||||
* Request `SendPoll` added and `PollContent#createResend` now use it
|
* 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
|
## 0.12.0 Webhooks
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types
|
package com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types
|
||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineMessageIdentifier
|
@Deprecated(
|
||||||
|
"Deprecated for the reason of creating of more obvious type interface",
|
||||||
interface ByInlineMessageId {
|
ReplaceWith("InlineMessageAction", "com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.InlineMessageAction")
|
||||||
val inlineMessageId: InlineMessageIdentifier
|
)
|
||||||
}
|
typealias ByInlineMessageId = InlineMessageAction
|
@ -1,7 +1,8 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types
|
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
|
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.requests.abstracts.SimpleRequest
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
@ -8,10 +9,10 @@ import kotlinx.serialization.internal.BooleanSerializer
|
|||||||
@Serializable
|
@Serializable
|
||||||
data class DeleteMessage(
|
data class DeleteMessage(
|
||||||
@SerialName(chatIdField)
|
@SerialName(chatIdField)
|
||||||
val chatId: ChatIdentifier,
|
override val chatId: ChatIdentifier,
|
||||||
@SerialName(messageIdField)
|
@SerialName(messageIdField)
|
||||||
val messageId: MessageIdentifier
|
override val messageId: MessageIdentifier
|
||||||
) : SimpleRequest<Boolean> {
|
) : SimpleRequest<Boolean>, MessageAction {
|
||||||
override fun method(): String = "deleteMessage"
|
override fun method(): String = "deleteMessage"
|
||||||
|
|
||||||
override fun resultSerializer(): KSerializer<Boolean> = BooleanSerializer
|
override fun resultSerializer(): KSerializer<Boolean> = BooleanSerializer
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests
|
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.requests.abstracts.SimpleRequest
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage
|
||||||
@ -12,10 +13,14 @@ data class ForwardMessage(
|
|||||||
@SerialName(chatIdField)
|
@SerialName(chatIdField)
|
||||||
val toChatId: ChatIdentifier,
|
val toChatId: ChatIdentifier,
|
||||||
@SerialName(messageIdField)
|
@SerialName(messageIdField)
|
||||||
val messageId: MessageIdentifier,
|
override val messageId: MessageIdentifier,
|
||||||
@SerialName(disableNotificationField)
|
@SerialName(disableNotificationField)
|
||||||
val disableNotification: Boolean = false
|
val disableNotification: Boolean = false
|
||||||
): SimpleRequest<RawMessage> {
|
): SimpleRequest<RawMessage>, MessageAction {
|
||||||
|
@Transient
|
||||||
|
override val chatId: ChatIdentifier
|
||||||
|
get() = fromChatId
|
||||||
|
|
||||||
override fun method(): String = "forwardMessage"
|
override fun method(): String = "forwardMessage"
|
||||||
|
|
||||||
override fun resultSerializer(): KSerializer<RawMessage> = RawMessage.serializer()
|
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
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify
|
||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.DisableNotification
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
@ -12,10 +11,10 @@ data class PinChatMessage (
|
|||||||
@SerialName(chatIdField)
|
@SerialName(chatIdField)
|
||||||
override val chatId: ChatIdentifier,
|
override val chatId: ChatIdentifier,
|
||||||
@SerialName(messageIdField)
|
@SerialName(messageIdField)
|
||||||
val messageId: MessageIdentifier,
|
override val messageId: MessageIdentifier,
|
||||||
@SerialName(disableNotificationField)
|
@SerialName(disableNotificationField)
|
||||||
override val disableNotification: Boolean = false
|
override val disableNotification: Boolean = false
|
||||||
): ChatRequest, SimpleRequest<Boolean>, DisableNotification {
|
): ChatRequest, SimpleRequest<Boolean>, MessageAction, DisableNotification {
|
||||||
override fun method(): String = "pinChatMessage"
|
override fun method(): String = "pinChatMessage"
|
||||||
override fun resultSerializer(): KSerializer<Boolean> = BooleanSerializer
|
override fun resultSerializer(): KSerializer<Boolean> = BooleanSerializer
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts
|
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.requests.abstracts.SimpleRequest
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage
|
||||||
|
|
||||||
interface EditChatMessage : SimpleRequest<RawMessage> {
|
interface EditChatMessage : SimpleRequest<RawMessage>, MessageAction
|
||||||
val chatId: ChatIdentifier
|
|
||||||
val messageId: MessageIdentifier
|
|
||||||
}
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.games
|
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.requests.games.abstracts.GetGameHighScores
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
@ -14,4 +14,4 @@ data class GetGameHighScoresByChat (
|
|||||||
override val chatId: ChatId,
|
override val chatId: ChatId,
|
||||||
@SerialName(messageIdField)
|
@SerialName(messageIdField)
|
||||||
override val messageId: MessageIdentifier
|
override val messageId: MessageIdentifier
|
||||||
) : GetGameHighScores, ByMessageId
|
) : GetGameHighScores, MessageAction
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.games
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.games
|
||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ByInlineMessageId
|
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.requests.games.abstracts.GetGameHighScores
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
@ -12,4 +13,4 @@ data class GetGameHighScoresByInlineMessageId (
|
|||||||
override val userId: UserId,
|
override val userId: UserId,
|
||||||
@SerialName(inlineMessageIdField)
|
@SerialName(inlineMessageIdField)
|
||||||
override val inlineMessageId: InlineMessageIdentifier
|
override val inlineMessageId: InlineMessageIdentifier
|
||||||
) : GetGameHighScores, ByInlineMessageId
|
) : GetGameHighScores, InlineMessageAction
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.games
|
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.requests.games.abstracts.SetGameScore
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
@ -20,4 +20,4 @@ data class SetGameScoreByChatId (
|
|||||||
override val force: Boolean = false,
|
override val force: Boolean = false,
|
||||||
@SerialName(disableEditMessageField)
|
@SerialName(disableEditMessageField)
|
||||||
override val disableEditMessage: Boolean = false
|
override val disableEditMessage: Boolean = false
|
||||||
) : SetGameScore, ByMessageId
|
) : SetGameScore, MessageAction
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.games
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.games
|
||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ByInlineMessageId
|
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.requests.games.abstracts.SetGameScore
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
@ -18,4 +19,4 @@ data class SetGameScoreByInlineMessageId (
|
|||||||
override val force: Boolean = false,
|
override val force: Boolean = false,
|
||||||
@SerialName(disableEditMessageField)
|
@SerialName(disableEditMessageField)
|
||||||
override val disableEditMessage: Boolean = false
|
override val disableEditMessage: Boolean = false
|
||||||
) : SetGameScore, ByInlineMessageId
|
) : SetGameScore, InlineMessageAction
|
||||||
|
@ -1,18 +1,13 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.types.message.content
|
package com.github.insanusmokrassar.TelegramBotAPI.types.message.content
|
||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.Request
|
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.requests.send.SendPoll
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
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.MessageIdentifier
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.*
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
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.types.polls.Poll
|
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(
|
data class PollContent(
|
||||||
val poll: Poll
|
val poll: Poll
|
||||||
|
Loading…
Reference in New Issue
Block a user