mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 16:23:48 +00:00
updates in CommonMessage implementers and removing of deprecations
This commit is contained in:
parent
4d9be1a995
commit
86885e7698
19
CHANGELOG.md
19
CHANGELOG.md
@ -1,8 +1,14 @@
|
|||||||
# TelegramBotAPI changelog
|
# TelegramBotAPI changelog
|
||||||
|
|
||||||
|
|
||||||
## 0.38.0
|
## 0.38.0
|
||||||
|
|
||||||
|
_This update contains [Telegram Bot API 5.6](https://core.telegram.org/bots/api-changelog#december-30-2021) implementation_
|
||||||
|
|
||||||
|
_This update contains migration onto Kotlin 1.6_
|
||||||
|
|
||||||
|
_This update has changed constructors of all `CommonMessage` implementations_
|
||||||
|
|
||||||
|
|
||||||
* `Common`:
|
* `Common`:
|
||||||
* `Version`:
|
* `Version`:
|
||||||
* `Kotlin`: `1.5.31` -> `1.6.10`
|
* `Kotlin`: `1.5.31` -> `1.6.10`
|
||||||
@ -15,6 +21,17 @@
|
|||||||
* Add `SpoilerTextSource` (as part of `Telegram Bot API 5.6` update)
|
* Add `SpoilerTextSource` (as part of `Telegram Bot API 5.6` update)
|
||||||
* Add support of `protect_content` as a field `protectContent` in all send message requests and parameter in all
|
* Add support of `protect_content` as a field `protectContent` in all send message requests and parameter in all
|
||||||
functions related to that requests (as part of `Telegram Bot API 5.6` update)
|
functions related to that requests (as part of `Telegram Bot API 5.6` update)
|
||||||
|
* **ALL IMPLEMENTERS OF `CommonMessage` HAS CHANGED THEIR CONSTRUCTOR: NOW THEY GET `hasProtectedContent` instead of
|
||||||
|
`forwardable` (inversed) field**
|
||||||
|
* `ChannelContentMessageImpl`
|
||||||
|
* `ChannelMediaGroupMessage`
|
||||||
|
* `CommonMediaGroupMessage`
|
||||||
|
* `GroupContentMessage` implementers
|
||||||
|
* `ConnectedFromChannelGroupContentMessageImpl`
|
||||||
|
* `UnconnectedFromChannelGroupContentMessageImpl`
|
||||||
|
* `AnonymousGroupContentMessageImpl`
|
||||||
|
* `CommonGroupContentMessageImpl`
|
||||||
|
* `PrivateContentMessageImpl`
|
||||||
|
|
||||||
## 0.37.4
|
## 0.37.4
|
||||||
|
|
||||||
|
@ -13,24 +13,10 @@ data class ChannelContentMessageImpl<T: MessageContent>(
|
|||||||
override val content: T,
|
override val content: T,
|
||||||
override val date: DateTime,
|
override val date: DateTime,
|
||||||
override val editDate: DateTime?,
|
override val editDate: DateTime?,
|
||||||
override val forwardable: Boolean,
|
override val hasProtectedContent: Boolean,
|
||||||
override val forwardInfo: ForwardInfo?,
|
override val forwardInfo: ForwardInfo?,
|
||||||
override val replyTo: Message?,
|
override val replyTo: Message?,
|
||||||
override val replyMarkup: InlineKeyboardMarkup?,
|
override val replyMarkup: InlineKeyboardMarkup?,
|
||||||
override val senderBot: CommonBot?,
|
override val senderBot: CommonBot?,
|
||||||
override val authorSignature: AuthorSignature?
|
override val authorSignature: AuthorSignature?
|
||||||
) : ChannelContentMessage<T> {
|
) : ChannelContentMessage<T>
|
||||||
@Deprecated("Use the constructor with forwardable field")
|
|
||||||
constructor(
|
|
||||||
messageId: MessageIdentifier,
|
|
||||||
chat: ChannelChat,
|
|
||||||
content: T,
|
|
||||||
date: DateTime,
|
|
||||||
editDate: DateTime?,
|
|
||||||
forwardInfo: ForwardInfo?,
|
|
||||||
replyTo: Message?,
|
|
||||||
replyMarkup: InlineKeyboardMarkup?,
|
|
||||||
senderBot: CommonBot?,
|
|
||||||
authorSignature: AuthorSignature?
|
|
||||||
) : this(messageId, chat, content, date, editDate, true, forwardInfo, replyTo, replyMarkup, senderBot, authorSignature)
|
|
||||||
}
|
|
||||||
|
@ -16,21 +16,8 @@ data class ChannelMediaGroupMessage<T : MediaGroupContent>(
|
|||||||
override val mediaGroupId: MediaGroupIdentifier,
|
override val mediaGroupId: MediaGroupIdentifier,
|
||||||
override val content: T,
|
override val content: T,
|
||||||
override val editDate: DateTime?,
|
override val editDate: DateTime?,
|
||||||
override val forwardable: Boolean,
|
override val hasProtectedContent: Boolean,
|
||||||
override val forwardInfo: ForwardInfo?,
|
override val forwardInfo: ForwardInfo?,
|
||||||
override val replyTo: Message?,
|
override val replyTo: Message?,
|
||||||
override val replyMarkup: InlineKeyboardMarkup?
|
override val replyMarkup: InlineKeyboardMarkup?
|
||||||
) : MediaGroupMessage<T> {
|
) : MediaGroupMessage<T>
|
||||||
@Deprecated("Use the constructor with forwardable field")
|
|
||||||
constructor(
|
|
||||||
messageId: MessageIdentifier,
|
|
||||||
chat: Chat,
|
|
||||||
date: DateTime,
|
|
||||||
mediaGroupId: MediaGroupIdentifier,
|
|
||||||
content: T,
|
|
||||||
editDate: DateTime?,
|
|
||||||
forwardInfo: ForwardInfo?,
|
|
||||||
replyTo: Message?,
|
|
||||||
replyMarkup: InlineKeyboardMarkup?
|
|
||||||
) : this(messageId, chat, date, mediaGroupId, content, editDate, true, forwardInfo, replyTo, replyMarkup)
|
|
||||||
}
|
|
||||||
|
@ -15,22 +15,8 @@ data class CommonMediaGroupMessage<T : MediaGroupContent>(
|
|||||||
override val mediaGroupId: MediaGroupIdentifier,
|
override val mediaGroupId: MediaGroupIdentifier,
|
||||||
override val content: T,
|
override val content: T,
|
||||||
override val editDate: DateTime?,
|
override val editDate: DateTime?,
|
||||||
override val forwardable: Boolean,
|
override val hasProtectedContent: Boolean,
|
||||||
override val forwardInfo: ForwardInfo?,
|
override val forwardInfo: ForwardInfo?,
|
||||||
override val replyTo: Message?,
|
override val replyTo: Message?,
|
||||||
override val replyMarkup: InlineKeyboardMarkup?
|
override val replyMarkup: InlineKeyboardMarkup?
|
||||||
) : MediaGroupMessage<T>, FromUserMessage {
|
) : MediaGroupMessage<T>, FromUserMessage
|
||||||
@Deprecated("Use the constructor with forwardable field")
|
|
||||||
constructor(
|
|
||||||
messageId: MessageIdentifier,
|
|
||||||
from: User,
|
|
||||||
chat: Chat,
|
|
||||||
date: DateTime,
|
|
||||||
mediaGroupId: MediaGroupIdentifier,
|
|
||||||
content: T,
|
|
||||||
editDate: DateTime?,
|
|
||||||
forwardInfo: ForwardInfo?,
|
|
||||||
replyTo: Message?,
|
|
||||||
replyMarkup: InlineKeyboardMarkup?
|
|
||||||
) : this(messageId, from, chat, date, mediaGroupId, content, editDate, true, forwardInfo, replyTo, replyMarkup)
|
|
||||||
}
|
|
||||||
|
@ -15,31 +15,13 @@ data class ConnectedFromChannelGroupContentMessageImpl<T : MessageContent>(
|
|||||||
override val date: DateTime,
|
override val date: DateTime,
|
||||||
override val forwardInfo: ForwardInfo?,
|
override val forwardInfo: ForwardInfo?,
|
||||||
override val editDate: DateTime?,
|
override val editDate: DateTime?,
|
||||||
override val forwardable: Boolean,
|
override val hasProtectedContent: Boolean,
|
||||||
override val replyTo: Message?,
|
override val replyTo: Message?,
|
||||||
override val replyMarkup: InlineKeyboardMarkup?,
|
override val replyMarkup: InlineKeyboardMarkup?,
|
||||||
override val content: T,
|
override val content: T,
|
||||||
override val senderBot: CommonBot?,
|
override val senderBot: CommonBot?,
|
||||||
override val authorSignature: AuthorSignature?
|
override val authorSignature: AuthorSignature?
|
||||||
) : ConnectedFromChannelGroupContentMessage<T> {
|
) : ConnectedFromChannelGroupContentMessage<T>
|
||||||
@Deprecated("Use the constructor with forwardable field")
|
|
||||||
constructor(
|
|
||||||
chat: GroupChat,
|
|
||||||
channel: ChannelChat,
|
|
||||||
messageId: MessageIdentifier,
|
|
||||||
date: DateTime,
|
|
||||||
forwardInfo: ForwardInfo?,
|
|
||||||
editDate: DateTime?,
|
|
||||||
replyTo: Message?,
|
|
||||||
replyMarkup: InlineKeyboardMarkup?,
|
|
||||||
content: T,
|
|
||||||
senderBot: CommonBot?,
|
|
||||||
authorSignature: AuthorSignature?
|
|
||||||
) : this(chat, channel, messageId, date, forwardInfo, editDate, true, replyTo, replyMarkup, content, senderBot, authorSignature)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated("Renamed", ReplaceWith("ConnectedFromChannelGroupContentMessageImpl", "dev.inmo.tgbotapi.types.message.ConnectedFromChannelGroupContentMessageImpl"))
|
|
||||||
typealias FromChannelGroupContentMessageImpl<T> = ConnectedFromChannelGroupContentMessageImpl<T>
|
|
||||||
|
|
||||||
data class UnconnectedFromChannelGroupContentMessageImpl<T: MessageContent>(
|
data class UnconnectedFromChannelGroupContentMessageImpl<T: MessageContent>(
|
||||||
override val chat: GroupChat,
|
override val chat: GroupChat,
|
||||||
@ -48,7 +30,7 @@ data class UnconnectedFromChannelGroupContentMessageImpl<T: MessageContent>(
|
|||||||
override val date: DateTime,
|
override val date: DateTime,
|
||||||
override val forwardInfo: ForwardInfo?,
|
override val forwardInfo: ForwardInfo?,
|
||||||
override val editDate: DateTime?,
|
override val editDate: DateTime?,
|
||||||
override val forwardable: Boolean,
|
override val hasProtectedContent: Boolean,
|
||||||
override val replyTo: Message?,
|
override val replyTo: Message?,
|
||||||
override val replyMarkup: InlineKeyboardMarkup?,
|
override val replyMarkup: InlineKeyboardMarkup?,
|
||||||
override val content: T,
|
override val content: T,
|
||||||
@ -62,27 +44,13 @@ data class AnonymousGroupContentMessageImpl<T : MessageContent>(
|
|||||||
override val date: DateTime,
|
override val date: DateTime,
|
||||||
override val forwardInfo: ForwardInfo?,
|
override val forwardInfo: ForwardInfo?,
|
||||||
override val editDate: DateTime?,
|
override val editDate: DateTime?,
|
||||||
override val forwardable: Boolean,
|
override val hasProtectedContent: Boolean,
|
||||||
override val replyTo: Message?,
|
override val replyTo: Message?,
|
||||||
override val replyMarkup: InlineKeyboardMarkup?,
|
override val replyMarkup: InlineKeyboardMarkup?,
|
||||||
override val content: T,
|
override val content: T,
|
||||||
override val senderBot: CommonBot?,
|
override val senderBot: CommonBot?,
|
||||||
override val authorSignature: AuthorSignature?
|
override val authorSignature: AuthorSignature?
|
||||||
) : AnonymousGroupContentMessage<T> {
|
) : AnonymousGroupContentMessage<T>
|
||||||
@Deprecated("Use the constructor with forwardable field")
|
|
||||||
constructor(
|
|
||||||
chat: GroupChat,
|
|
||||||
messageId: MessageIdentifier,
|
|
||||||
date: DateTime,
|
|
||||||
forwardInfo: ForwardInfo?,
|
|
||||||
editDate: DateTime?,
|
|
||||||
replyTo: Message?,
|
|
||||||
replyMarkup: InlineKeyboardMarkup?,
|
|
||||||
content: T,
|
|
||||||
senderBot: CommonBot?,
|
|
||||||
authorSignature: AuthorSignature?
|
|
||||||
) : this(chat, messageId, date, forwardInfo, editDate, true, replyTo, replyMarkup, content, senderBot, authorSignature)
|
|
||||||
}
|
|
||||||
|
|
||||||
data class CommonGroupContentMessageImpl<T : MessageContent>(
|
data class CommonGroupContentMessageImpl<T : MessageContent>(
|
||||||
override val chat: GroupChat,
|
override val chat: GroupChat,
|
||||||
@ -91,23 +59,9 @@ data class CommonGroupContentMessageImpl<T : MessageContent>(
|
|||||||
override val date: DateTime,
|
override val date: DateTime,
|
||||||
override val forwardInfo: ForwardInfo?,
|
override val forwardInfo: ForwardInfo?,
|
||||||
override val editDate: DateTime?,
|
override val editDate: DateTime?,
|
||||||
override val forwardable: Boolean,
|
override val hasProtectedContent: Boolean,
|
||||||
override val replyTo: Message?,
|
override val replyTo: Message?,
|
||||||
override val replyMarkup: InlineKeyboardMarkup?,
|
override val replyMarkup: InlineKeyboardMarkup?,
|
||||||
override val content: T,
|
override val content: T,
|
||||||
override val senderBot: CommonBot?
|
override val senderBot: CommonBot?
|
||||||
) : CommonGroupContentMessage<T> {
|
) : CommonGroupContentMessage<T>
|
||||||
@Deprecated("Use the constructor with forwardable field")
|
|
||||||
constructor(
|
|
||||||
chat: GroupChat,
|
|
||||||
messageId: MessageIdentifier,
|
|
||||||
from: User,
|
|
||||||
date: DateTime,
|
|
||||||
forwardInfo: ForwardInfo?,
|
|
||||||
editDate: DateTime?,
|
|
||||||
replyTo: Message?,
|
|
||||||
replyMarkup: InlineKeyboardMarkup?,
|
|
||||||
content: T,
|
|
||||||
senderBot: CommonBot?
|
|
||||||
) : this(chat, messageId, from, date, forwardInfo, editDate, true, replyTo, replyMarkup, content, senderBot)
|
|
||||||
}
|
|
||||||
|
@ -15,23 +15,9 @@ data class PrivateContentMessageImpl<T: MessageContent>(
|
|||||||
override val content: T,
|
override val content: T,
|
||||||
override val date: DateTime,
|
override val date: DateTime,
|
||||||
override val editDate: DateTime?,
|
override val editDate: DateTime?,
|
||||||
override val forwardable: Boolean,
|
override val hasProtectedContent: Boolean,
|
||||||
override val forwardInfo: ForwardInfo?,
|
override val forwardInfo: ForwardInfo?,
|
||||||
override val replyTo: Message?,
|
override val replyTo: Message?,
|
||||||
override val replyMarkup: InlineKeyboardMarkup?,
|
override val replyMarkup: InlineKeyboardMarkup?,
|
||||||
override val senderBot: CommonBot?
|
override val senderBot: CommonBot?
|
||||||
) : PrivateContentMessage<T> {
|
) : PrivateContentMessage<T>
|
||||||
@Deprecated("Use the constructor with forwardable field")
|
|
||||||
constructor(
|
|
||||||
messageId: MessageIdentifier,
|
|
||||||
from: User,
|
|
||||||
chat: Chat,
|
|
||||||
content: T,
|
|
||||||
date: DateTime,
|
|
||||||
editDate: DateTime?,
|
|
||||||
forwardInfo: ForwardInfo?,
|
|
||||||
replyTo: Message?,
|
|
||||||
replyMarkup: InlineKeyboardMarkup?,
|
|
||||||
senderBot: CommonBot?
|
|
||||||
) : this(messageId, from, chat, content, date, editDate, true, forwardInfo, replyTo, replyMarkup, senderBot)
|
|
||||||
}
|
|
@ -254,7 +254,7 @@ internal data class RawMessage(
|
|||||||
it,
|
it,
|
||||||
checkedContent,
|
checkedContent,
|
||||||
edit_date?.asDate,
|
edit_date?.asDate,
|
||||||
has_protected_content != true,
|
has_protected_content == true,
|
||||||
forwarded,
|
forwarded,
|
||||||
reply_to_message?.asMessage,
|
reply_to_message?.asMessage,
|
||||||
reply_markup
|
reply_markup
|
||||||
@ -267,7 +267,7 @@ internal data class RawMessage(
|
|||||||
it,
|
it,
|
||||||
checkedContent,
|
checkedContent,
|
||||||
edit_date?.asDate,
|
edit_date?.asDate,
|
||||||
has_protected_content != true,
|
has_protected_content == true,
|
||||||
forwarded,
|
forwarded,
|
||||||
reply_to_message?.asMessage,
|
reply_to_message?.asMessage,
|
||||||
reply_markup
|
reply_markup
|
||||||
@ -281,7 +281,7 @@ internal data class RawMessage(
|
|||||||
content,
|
content,
|
||||||
date.asDate,
|
date.asDate,
|
||||||
edit_date?.asDate,
|
edit_date?.asDate,
|
||||||
has_protected_content != true,
|
has_protected_content == true,
|
||||||
forwarded,
|
forwarded,
|
||||||
reply_to_message?.asMessage,
|
reply_to_message?.asMessage,
|
||||||
reply_markup,
|
reply_markup,
|
||||||
@ -297,7 +297,7 @@ internal data class RawMessage(
|
|||||||
date.asDate,
|
date.asDate,
|
||||||
forwarded,
|
forwarded,
|
||||||
edit_date ?.asDate,
|
edit_date ?.asDate,
|
||||||
has_protected_content != true,
|
has_protected_content == true,
|
||||||
reply_to_message ?.asMessage,
|
reply_to_message ?.asMessage,
|
||||||
reply_markup,
|
reply_markup,
|
||||||
content,
|
content,
|
||||||
@ -312,7 +312,7 @@ internal data class RawMessage(
|
|||||||
date.asDate,
|
date.asDate,
|
||||||
forwarded,
|
forwarded,
|
||||||
edit_date ?.asDate,
|
edit_date ?.asDate,
|
||||||
has_protected_content != true,
|
has_protected_content == true,
|
||||||
reply_to_message ?.asMessage,
|
reply_to_message ?.asMessage,
|
||||||
reply_markup,
|
reply_markup,
|
||||||
content,
|
content,
|
||||||
@ -326,7 +326,7 @@ internal data class RawMessage(
|
|||||||
date.asDate,
|
date.asDate,
|
||||||
forwarded,
|
forwarded,
|
||||||
edit_date ?.asDate,
|
edit_date ?.asDate,
|
||||||
has_protected_content != true,
|
has_protected_content == true,
|
||||||
reply_to_message ?.asMessage,
|
reply_to_message ?.asMessage,
|
||||||
reply_markup,
|
reply_markup,
|
||||||
content,
|
content,
|
||||||
@ -340,7 +340,7 @@ internal data class RawMessage(
|
|||||||
date.asDate,
|
date.asDate,
|
||||||
forwarded,
|
forwarded,
|
||||||
edit_date ?.asDate,
|
edit_date ?.asDate,
|
||||||
has_protected_content != true,
|
has_protected_content == true,
|
||||||
reply_to_message ?.asMessage,
|
reply_to_message ?.asMessage,
|
||||||
reply_markup,
|
reply_markup,
|
||||||
content,
|
content,
|
||||||
@ -357,7 +357,7 @@ internal data class RawMessage(
|
|||||||
content,
|
content,
|
||||||
date.asDate,
|
date.asDate,
|
||||||
edit_date?.asDate,
|
edit_date?.asDate,
|
||||||
has_protected_content != true,
|
has_protected_content == true,
|
||||||
forwarded,
|
forwarded,
|
||||||
reply_to_message?.asMessage,
|
reply_to_message?.asMessage,
|
||||||
reply_markup,
|
reply_markup,
|
||||||
|
@ -3,9 +3,9 @@ package dev.inmo.tgbotapi.types.message.abstracts
|
|||||||
import dev.inmo.tgbotapi.types.message.content.abstracts.MessageContent
|
import dev.inmo.tgbotapi.types.message.content.abstracts.MessageContent
|
||||||
|
|
||||||
interface ContentMessage<T: MessageContent>: Message {
|
interface ContentMessage<T: MessageContent>: Message {
|
||||||
val forwardable: Boolean
|
val hasProtectedContent: Boolean
|
||||||
val content: T
|
val content: T
|
||||||
|
|
||||||
val hasProtectedContent: Boolean
|
val forwardable: Boolean
|
||||||
get() = !forwardable
|
get() = !hasProtectedContent
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user