mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-25 19:48:43 +00:00
Merge pull request #513 from InsanusMokrassar/0.37.3
0.37.3: hotfix of 0.37.2
This commit is contained in:
commit
8206aefbb6
27
CHANGELOG.md
27
CHANGELOG.md
@ -1,5 +1,32 @@
|
||||
# TelegramBotAPI changelog
|
||||
|
||||
## 0.37.3 Hotfix of 0.37.3
|
||||
|
||||
* `Core`:
|
||||
* Fixes in hierarchy (and creating) of messages from channels
|
||||
|
||||
---
|
||||
|
||||
`0.37.2` changelog:
|
||||
|
||||
* `Common`:
|
||||
* `Version`:
|
||||
* `MicroUtils`: `0.8.2` -> `0.8.7`
|
||||
* `Core`:
|
||||
* New request type: `ChatSenderRequest`
|
||||
* New request `BanChatSenderChat`
|
||||
* New request `UnbanChatSenderChat`
|
||||
* `ExtendedPrivateChat` got new properties: `hasPrivateForwards` and `allowCreateUserIdLink` (same as `hasPrivateForwards`)
|
||||
* All `ContentMessage` got field `forwardable` (old constructors marked as `Deprecated`)
|
||||
* `FromChannelGroupContentMessage` has been divided for two interfaces (and corresponding classes):
|
||||
* `ConnectedFromChannelGroupContentMessage` (and `ConnectedFromChannelGroupContentMessageImpl`) for connected to the group channels messages
|
||||
* `UnconnectedFromChannelGroupContentMessage` (and `UnconnectedFromChannelGroupContentMessageImpl`) for unconnected channels
|
||||
* `API`:
|
||||
* New extensions `TelegramBot#banChatSenderChat`
|
||||
* New extensions `TelegramBot#unbanChatSenderChat`
|
||||
* `Utils`:
|
||||
* Fix of `EntitiesBuilder#linkln`
|
||||
|
||||
## 0.37.2 Telegram Bot API 5.5
|
||||
|
||||
* `Common`:
|
||||
|
@ -17,6 +17,6 @@ micro_utils_version=0.8.7
|
||||
javax_activation_version=1.1.1
|
||||
|
||||
library_group=dev.inmo
|
||||
library_version=0.37.2
|
||||
library_version=0.37.3
|
||||
|
||||
github_release_plugin_version=2.2.12
|
||||
|
@ -7,7 +7,7 @@ import dev.inmo.tgbotapi.types.chat.abstracts.ChannelChat
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.*
|
||||
import dev.inmo.tgbotapi.types.message.content.abstracts.MessageContent
|
||||
|
||||
data class ConnectedChannelContentMessageImpl<T: MessageContent>(
|
||||
data class ChannelContentMessageImpl<T: MessageContent>(
|
||||
override val messageId: MessageIdentifier,
|
||||
override val chat: ChannelChat,
|
||||
override val content: T,
|
||||
@ -19,7 +19,7 @@ data class ConnectedChannelContentMessageImpl<T: MessageContent>(
|
||||
override val replyMarkup: InlineKeyboardMarkup?,
|
||||
override val senderBot: CommonBot?,
|
||||
override val authorSignature: AuthorSignature?
|
||||
) : ConnectedChannelContentMessage<T> {
|
||||
) : ChannelContentMessage<T> {
|
||||
@Deprecated("Use the constructor with forwardable field")
|
||||
constructor(
|
||||
messageId: MessageIdentifier,
|
@ -8,7 +8,7 @@ import dev.inmo.tgbotapi.types.chat.abstracts.GroupChat
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.*
|
||||
import dev.inmo.tgbotapi.types.message.content.abstracts.MessageContent
|
||||
|
||||
data class FromChannelGroupContentMessageImpl<T : MessageContent>(
|
||||
data class ConnectedFromChannelGroupContentMessageImpl<T : MessageContent>(
|
||||
override val chat: GroupChat,
|
||||
override val channel: ChannelChat,
|
||||
override val messageId: MessageIdentifier,
|
||||
@ -21,7 +21,7 @@ data class FromChannelGroupContentMessageImpl<T : MessageContent>(
|
||||
override val content: T,
|
||||
override val senderBot: CommonBot?,
|
||||
override val authorSignature: AuthorSignature?
|
||||
) : FromChannelGroupContentMessage<T> {
|
||||
) : ConnectedFromChannelGroupContentMessage<T> {
|
||||
@Deprecated("Use the constructor with forwardable field")
|
||||
constructor(
|
||||
chat: GroupChat,
|
||||
@ -38,6 +38,24 @@ data class FromChannelGroupContentMessageImpl<T : MessageContent>(
|
||||
) : 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>(
|
||||
override val chat: GroupChat,
|
||||
override val channel: ChannelChat,
|
||||
override val messageId: MessageIdentifier,
|
||||
override val date: DateTime,
|
||||
override val forwardInfo: ForwardInfo?,
|
||||
override val editDate: DateTime?,
|
||||
override val forwardable: Boolean,
|
||||
override val replyTo: Message?,
|
||||
override val replyMarkup: InlineKeyboardMarkup?,
|
||||
override val content: T,
|
||||
override val senderBot: CommonBot?,
|
||||
override val authorSignature: AuthorSignature?
|
||||
) : UnconnectedFromChannelGroupContentMessage<T>
|
||||
|
||||
data class AnonymousGroupContentMessageImpl<T : MessageContent>(
|
||||
override val chat: GroupChat,
|
||||
override val messageId: MessageIdentifier,
|
||||
|
@ -12,8 +12,7 @@ import dev.inmo.tgbotapi.types.location.Location
|
||||
import dev.inmo.tgbotapi.types.message.ChatEvents.*
|
||||
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.*
|
||||
import dev.inmo.tgbotapi.types.message.ChatEvents.voice.*
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.UnknownMessageType
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.*
|
||||
import dev.inmo.tgbotapi.types.message.content.*
|
||||
import dev.inmo.tgbotapi.types.message.content.abstracts.MessageContent
|
||||
import dev.inmo.tgbotapi.types.message.content.media.*
|
||||
@ -273,8 +272,7 @@ internal data class RawMessage(
|
||||
}
|
||||
} ?: when (chat) {
|
||||
is PublicChat -> when (chat) {
|
||||
is ChannelChat -> if (is_automatic_forward == true) {
|
||||
ConnectedChannelContentMessageImpl(
|
||||
is ChannelChat -> ChannelContentMessageImpl(
|
||||
messageId,
|
||||
chat,
|
||||
content,
|
||||
@ -287,23 +285,9 @@ internal data class RawMessage(
|
||||
via_bot,
|
||||
author_signature
|
||||
)
|
||||
} else {
|
||||
UnconnectedChannelContentMessageImpl(
|
||||
messageId,
|
||||
chat,
|
||||
content,
|
||||
date.asDate,
|
||||
edit_date?.asDate,
|
||||
has_protected_content != true,
|
||||
forwarded,
|
||||
reply_to_message?.asMessage,
|
||||
reply_markup,
|
||||
via_bot,
|
||||
author_signature
|
||||
)
|
||||
}
|
||||
is GroupChat -> when (sender_chat) {
|
||||
is ChannelChat -> FromChannelGroupContentMessageImpl(
|
||||
is ChannelChat -> if (is_automatic_forward == true) {
|
||||
ConnectedFromChannelGroupContentMessageImpl(
|
||||
chat,
|
||||
sender_chat,
|
||||
messageId,
|
||||
@ -317,6 +301,22 @@ internal data class RawMessage(
|
||||
via_bot,
|
||||
author_signature
|
||||
)
|
||||
} else {
|
||||
UnconnectedFromChannelGroupContentMessageImpl(
|
||||
chat,
|
||||
sender_chat,
|
||||
messageId,
|
||||
date.asDate,
|
||||
forwarded,
|
||||
edit_date ?.asDate,
|
||||
has_protected_content != true,
|
||||
reply_to_message ?.asMessage,
|
||||
reply_markup,
|
||||
content,
|
||||
via_bot,
|
||||
author_signature
|
||||
)
|
||||
}
|
||||
is GroupChat -> AnonymousGroupContentMessageImpl(
|
||||
chat,
|
||||
messageId,
|
||||
|
@ -1,39 +0,0 @@
|
||||
package dev.inmo.tgbotapi.types.message
|
||||
|
||||
import com.soywiz.klock.DateTime
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.chat.abstracts.ChannelChat
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.*
|
||||
import dev.inmo.tgbotapi.types.message.content.abstracts.MessageContent
|
||||
|
||||
data class UnconnectedChannelContentMessageImpl<T: MessageContent>(
|
||||
override val messageId: MessageIdentifier,
|
||||
override val chat: ChannelChat,
|
||||
override val content: T,
|
||||
override val date: DateTime,
|
||||
override val editDate: DateTime?,
|
||||
override val forwardable: Boolean,
|
||||
override val forwardInfo: ForwardInfo?,
|
||||
override val replyTo: Message?,
|
||||
override val replyMarkup: InlineKeyboardMarkup?,
|
||||
override val senderBot: CommonBot?,
|
||||
override val authorSignature: AuthorSignature?
|
||||
) : UnconnectedChannelContentMessage<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)
|
||||
}
|
||||
|
||||
@Deprecated("Renamed to UnconnectedChannelContentMessage", ReplaceWith("UnconnectedChannelContentMessage", "dev.inmo.tgbotapi.types.message.UnconnectedChannelContentMessageImpl"))
|
||||
typealias ChannelContentMessageImpl<T> = UnconnectedChannelContentMessage<T>
|
@ -4,7 +4,7 @@ import dev.inmo.tgbotapi.types.chat.abstracts.ChannelChat
|
||||
import dev.inmo.tgbotapi.types.message.content.abstracts.MessageContent
|
||||
import dev.inmo.tgbotapi.types.message.content.abstracts.PossiblySentViaBotCommonMessage
|
||||
|
||||
sealed interface ChannelContentMessage<T: MessageContent> : PossiblySentViaBotCommonMessage<T>, SignedMessage, WithSenderChatMessage {
|
||||
interface ChannelContentMessage<T: MessageContent> : PossiblySentViaBotCommonMessage<T>, SignedMessage, WithSenderChatMessage {
|
||||
override val chat: ChannelChat
|
||||
override val senderChat: ChannelChat
|
||||
get() = chat
|
||||
|
@ -1,5 +0,0 @@
|
||||
package dev.inmo.tgbotapi.types.message.abstracts
|
||||
|
||||
import dev.inmo.tgbotapi.types.message.content.abstracts.MessageContent
|
||||
|
||||
interface ConnectedChannelContentMessage<T: MessageContent> : ChannelContentMessage<T>
|
@ -15,6 +15,9 @@ interface FromChannelGroupContentMessage<T : MessageContent> : GroupContentMessa
|
||||
get() = channel
|
||||
}
|
||||
|
||||
interface ConnectedFromChannelGroupContentMessage<T: MessageContent> : FromChannelGroupContentMessage<T>
|
||||
interface UnconnectedFromChannelGroupContentMessage<T: MessageContent> : FromChannelGroupContentMessage<T>
|
||||
|
||||
interface AnonymousGroupContentMessage<T : MessageContent> : GroupContentMessage<T>, SignedMessage, WithSenderChatMessage {
|
||||
override val senderChat: GroupChat
|
||||
get() = chat
|
||||
|
@ -1,5 +0,0 @@
|
||||
package dev.inmo.tgbotapi.types.message.abstracts
|
||||
|
||||
import dev.inmo.tgbotapi.types.message.content.abstracts.MessageContent
|
||||
|
||||
interface UnconnectedChannelContentMessage<T: MessageContent> : ChannelContentMessage<T>
|
@ -915,15 +915,15 @@ inline fun Message.requireAnonymousGroupContentMessageImpl(): AnonymousGroupCont
|
||||
this as AnonymousGroupContentMessageImpl<MessageContent>
|
||||
|
||||
@PreviewFeature
|
||||
inline fun <T> Message.whenChannelContentMessageImpl(block: (UnconnectedChannelContentMessageImpl<MessageContent>) -> T) = asChannelContentMessageImpl() ?.let(block)
|
||||
inline fun <T> Message.whenChannelContentMessageImpl(block: (UnconnectedFromChannelGroupContentMessageImpl<MessageContent>) -> T) = asChannelContentMessageImpl() ?.let(block)
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.asChannelContentMessageImpl(): UnconnectedChannelContentMessageImpl<MessageContent>? =
|
||||
this as? UnconnectedChannelContentMessageImpl<MessageContent>
|
||||
inline fun Message.asChannelContentMessageImpl(): UnconnectedFromChannelGroupContentMessageImpl<MessageContent>? =
|
||||
this as? UnconnectedFromChannelGroupContentMessageImpl<MessageContent>
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.requireChannelContentMessageImpl(): UnconnectedChannelContentMessageImpl<MessageContent> =
|
||||
this as UnconnectedChannelContentMessageImpl<MessageContent>
|
||||
inline fun Message.requireChannelContentMessageImpl(): UnconnectedFromChannelGroupContentMessageImpl<MessageContent> =
|
||||
this as UnconnectedFromChannelGroupContentMessageImpl<MessageContent>
|
||||
|
||||
@PreviewFeature
|
||||
inline fun <T> Message.whenFromChannelGroupContentMessageImpl(block: (FromChannelGroupContentMessageImpl<MessageContent>) -> T) = asFromChannelGroupContentMessageImpl() ?.let(block)
|
||||
@ -1034,26 +1034,26 @@ inline fun Message.requireChannelContentMessage(): ChannelContentMessage<Message
|
||||
this as ChannelContentMessage<MessageContent>
|
||||
|
||||
@PreviewFeature
|
||||
inline fun <T> Message.whenConnectedChannelContentMessage(block: (ConnectedChannelContentMessage<MessageContent>) -> T) = asConnectedChannelContentMessage() ?.let(block)
|
||||
inline fun <T> Message.whenConnectedFromChannelGroupContentMessage(block: (ConnectedFromChannelGroupContentMessage<MessageContent>) -> T) = asConnectedFromChannelGroupContentMessage() ?.let(block)
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.asConnectedChannelContentMessage(): ConnectedChannelContentMessage<MessageContent>? =
|
||||
this as? ConnectedChannelContentMessageImpl<MessageContent>
|
||||
inline fun Message.asConnectedFromChannelGroupContentMessage(): ConnectedFromChannelGroupContentMessage<MessageContent>? =
|
||||
this as? ConnectedFromChannelGroupContentMessageImpl<MessageContent>
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.requireConnectedChannelContentMessage(): ConnectedChannelContentMessage<MessageContent> =
|
||||
this as ConnectedChannelContentMessage<MessageContent>
|
||||
inline fun Message.requireConnectedFromChannelGroupContentMessage(): ConnectedFromChannelGroupContentMessage<MessageContent> =
|
||||
this as ConnectedFromChannelGroupContentMessage<MessageContent>
|
||||
|
||||
@PreviewFeature
|
||||
inline fun <T> Message.whenUnconnectedChannelContentMessage(block: (UnconnectedChannelContentMessage<MessageContent>) -> T) = asUnconnectedChannelContentMessage() ?.let(block)
|
||||
inline fun <T> Message.whenUnconnectedFromChannelGroupContentMessage(block: (UnconnectedFromChannelGroupContentMessage<MessageContent>) -> T) = asUnconnectedFromChannelGroupContentMessage() ?.let(block)
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.asUnconnectedChannelContentMessage(): UnconnectedChannelContentMessage<MessageContent>? =
|
||||
this as? UnconnectedChannelContentMessage<MessageContent>
|
||||
inline fun Message.asUnconnectedFromChannelGroupContentMessage(): UnconnectedFromChannelGroupContentMessage<MessageContent>? =
|
||||
this as? UnconnectedFromChannelGroupContentMessage<MessageContent>
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Message.requireUnconnectedChannelContentMessage(): UnconnectedChannelContentMessage<MessageContent> =
|
||||
this as UnconnectedChannelContentMessage<MessageContent>
|
||||
inline fun Message.requireUnconnectedFromChannelGroupContentMessage(): UnconnectedFromChannelGroupContentMessage<MessageContent> =
|
||||
this as UnconnectedFromChannelGroupContentMessage<MessageContent>
|
||||
|
||||
@PreviewFeature
|
||||
inline fun <T> Message.whenChatEventMessage(block: (ChatEventMessage<ChatEvent>) -> T) = asChatEventMessage() ?.let(block)
|
||||
|
Loading…
Reference in New Issue
Block a user