mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-12-22 16:47:13 +00:00
content messages renames
This commit is contained in:
parent
4748b6813a
commit
0ca815760b
11
CHANGELOG.md
11
CHANGELOG.md
@ -7,6 +7,17 @@
|
||||
* `Kotlin`: `1.4.21` -> `1.4.30`
|
||||
* `Klock`: `2.0.4` -> `2.0.6`
|
||||
* `MicroUtils`: `0.4.23` -> `0.4.24`
|
||||
* `Core`:
|
||||
* Renames:
|
||||
* `ChannelMessage` -> `ChannelContentMessage`
|
||||
* `PublicMessage` -> `PublicContentMessage`
|
||||
* `GroupMessage` -> `GroupContentMessage`
|
||||
* `FromChannelGroupMessage` -> `FromChannelGroupContentMessage`
|
||||
* `AnonymousGroupMessage` -> `AnonymousGroupContentMessage`
|
||||
* `CommonGroupMessage` -> `CommonGroupContentMessage`
|
||||
* `PrivateMessage` -> `PrivateContentMessage`
|
||||
* `Extensions Utils`:
|
||||
* Renames of extensions in `ClassCasts` according to changes in `Core`
|
||||
|
||||
## 0.32.3
|
||||
|
||||
|
@ -4,11 +4,11 @@ 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.ChannelMessage
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ChannelContentMessage
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||
import dev.inmo.tgbotapi.types.message.content.abstracts.MessageContent
|
||||
|
||||
data class ChannelMessageImpl<T: MessageContent>(
|
||||
data class ChannelContentMessageImpl<T: MessageContent>(
|
||||
override val messageId: MessageIdentifier,
|
||||
override val chat: ChannelChat,
|
||||
override val content: T,
|
||||
@ -19,4 +19,6 @@ data class ChannelMessageImpl<T: MessageContent>(
|
||||
override val replyMarkup: InlineKeyboardMarkup?,
|
||||
override val senderBot: CommonBot?,
|
||||
override val authorSignature: AuthorSignature?
|
||||
) : ChannelMessage<T>
|
||||
) : ChannelContentMessage<T>
|
||||
@Deprecated("Renamed due to ambiguity of naming", ReplaceWith("ChannelContentMessageImpl", "dev.inmo.tgbotapi.types.message.ChannelContentMessageImpl"))
|
||||
typealias ChannelMessageImpl<T> = ChannelContentMessageImpl<T>
|
||||
|
@ -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 FromChannelGroupMessageImpl<T : MessageContent>(
|
||||
data class FromChannelGroupContentMessageImpl<T : MessageContent>(
|
||||
override val chat: GroupChat,
|
||||
override val channel: ChannelChat,
|
||||
override val messageId: MessageIdentifier,
|
||||
@ -20,9 +20,11 @@ data class FromChannelGroupMessageImpl<T : MessageContent>(
|
||||
override val content: T,
|
||||
override val senderBot: CommonBot?,
|
||||
override val authorSignature: AuthorSignature?
|
||||
) : FromChannelGroupMessage<T>
|
||||
) : FromChannelGroupContentMessage<T>
|
||||
@Deprecated("Renamed due to ambiguity of naming", ReplaceWith("FromChannelGroupContentMessageImpl", "dev.inmo.tgbotapi.types.message.FromChannelGroupContentMessageImpl"))
|
||||
typealias FromChannelGroupMessageImpl<T> = FromChannelGroupContentMessageImpl<T>
|
||||
|
||||
data class AnonymousGroupMessageImpl<T : MessageContent>(
|
||||
data class AnonymousGroupContentMessageImpl<T : MessageContent>(
|
||||
override val chat: GroupChat,
|
||||
override val messageId: MessageIdentifier,
|
||||
override val date: DateTime,
|
||||
@ -33,9 +35,11 @@ data class AnonymousGroupMessageImpl<T : MessageContent>(
|
||||
override val content: T,
|
||||
override val senderBot: CommonBot?,
|
||||
override val authorSignature: AuthorSignature?
|
||||
) : AnonymousGroupMessage<T>
|
||||
) : AnonymousGroupContentMessage<T>
|
||||
@Deprecated("Renamed due to ambiguity of naming", ReplaceWith("AnonymousGroupContentMessageImpl", "dev.inmo.tgbotapi.types.message.AnonymousGroupContentMessageImpl"))
|
||||
typealias AnonymousGroupMessageImpl<T> = AnonymousGroupContentMessageImpl<T>
|
||||
|
||||
data class CommonGroupMessageImpl<T : MessageContent>(
|
||||
data class CommonGroupContentMessageImpl<T : MessageContent>(
|
||||
override val chat: GroupChat,
|
||||
override val messageId: MessageIdentifier,
|
||||
override val user: User,
|
||||
@ -46,4 +50,6 @@ data class CommonGroupMessageImpl<T : MessageContent>(
|
||||
override val replyMarkup: InlineKeyboardMarkup?,
|
||||
override val content: T,
|
||||
override val senderBot: CommonBot?
|
||||
) : CommonGroupMessage<T>
|
||||
) : CommonGroupContentMessage<T>
|
||||
@Deprecated("Renamed due to ambiguity of naming", ReplaceWith("CommonGroupContentMessageImpl", "dev.inmo.tgbotapi.types.message.CommonGroupContentMessageImpl"))
|
||||
typealias CommonGroupMessageImpl<T> = CommonGroupContentMessageImpl<T>
|
||||
|
@ -4,12 +4,11 @@ import com.soywiz.klock.DateTime
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.chat.abstracts.Chat
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.PrivateMessage
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.*
|
||||
import dev.inmo.tgbotapi.types.message.content.abstracts.MessageContent
|
||||
import dev.inmo.tgbotapi.types.message.payments.SuccessfulPaymentInfo
|
||||
|
||||
data class PrivateMessageImpl<T: MessageContent>(
|
||||
data class PrivateContentMessageImpl<T: MessageContent>(
|
||||
override val messageId: MessageIdentifier,
|
||||
override val user: User,
|
||||
override val chat: Chat,
|
||||
@ -21,4 +20,6 @@ data class PrivateMessageImpl<T: MessageContent>(
|
||||
override val replyMarkup: InlineKeyboardMarkup?,
|
||||
override val senderBot: CommonBot?,
|
||||
val paymentInfo: SuccessfulPaymentInfo?
|
||||
) : PrivateMessage<T>
|
||||
) : PrivateContentMessage<T>
|
||||
@Deprecated("Renamed due to ambiguity of naming", ReplaceWith("PrivateContentMessageImpl", "dev.inmo.tgbotapi.types.message.PrivateContentMessageImpl"))
|
||||
typealias PrivateMessageImpl<T> = PrivateContentMessageImpl<T>
|
||||
|
@ -256,7 +256,7 @@ internal data class RawMessage(
|
||||
}
|
||||
} ?: when (chat) {
|
||||
is PublicChat -> when (chat) {
|
||||
is ChannelChat -> ChannelMessageImpl(
|
||||
is ChannelChat -> ChannelContentMessageImpl(
|
||||
messageId,
|
||||
chat,
|
||||
content,
|
||||
@ -269,7 +269,7 @@ internal data class RawMessage(
|
||||
author_signature
|
||||
)
|
||||
is GroupChat -> when (sender_chat) {
|
||||
is ChannelChat -> FromChannelGroupMessageImpl(
|
||||
is ChannelChat -> FromChannelGroupContentMessageImpl(
|
||||
chat,
|
||||
sender_chat,
|
||||
messageId,
|
||||
@ -282,7 +282,7 @@ internal data class RawMessage(
|
||||
via_bot,
|
||||
author_signature
|
||||
)
|
||||
is GroupChat -> AnonymousGroupMessageImpl(
|
||||
is GroupChat -> AnonymousGroupContentMessageImpl(
|
||||
chat,
|
||||
messageId,
|
||||
date.asDate,
|
||||
@ -294,7 +294,7 @@ internal data class RawMessage(
|
||||
via_bot,
|
||||
author_signature
|
||||
)
|
||||
null -> CommonGroupMessageImpl(
|
||||
null -> CommonGroupContentMessageImpl(
|
||||
chat,
|
||||
messageId,
|
||||
from ?: error("It is expected that in messages from non anonymous users and channels user must be specified"),
|
||||
@ -310,7 +310,7 @@ internal data class RawMessage(
|
||||
}
|
||||
else -> error("Unknown type of public chat: $chat")
|
||||
}
|
||||
is PrivateChat -> PrivateMessageImpl(
|
||||
is PrivateChat -> PrivateContentMessageImpl(
|
||||
messageId,
|
||||
from ?: error("Was detected common message, but owner (sender) of the message was not found"),
|
||||
chat,
|
||||
|
@ -4,8 +4,10 @@ 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
|
||||
|
||||
interface ChannelMessage<T: MessageContent> : PossiblySentViaBotCommonMessage<T>, SignedMessage, WithSenderChatMessage {
|
||||
interface ChannelContentMessage<T: MessageContent> : PossiblySentViaBotCommonMessage<T>, SignedMessage, WithSenderChatMessage {
|
||||
override val chat: ChannelChat
|
||||
override val senderChat: ChannelChat
|
||||
get() = chat
|
||||
}
|
||||
@Deprecated("Renamed due to ambiguity of naming", ReplaceWith("ChannelContentMessage", "dev.inmo.tgbotapi.types.message.abstracts.ChannelContentMessage"))
|
||||
typealias ChannelMessage<T> = ChannelContentMessage<T>
|
||||
|
@ -4,17 +4,28 @@ import dev.inmo.tgbotapi.types.chat.abstracts.ChannelChat
|
||||
import dev.inmo.tgbotapi.types.chat.abstracts.GroupChat
|
||||
import dev.inmo.tgbotapi.types.message.content.abstracts.MessageContent
|
||||
|
||||
interface GroupMessage<T : MessageContent> : PublicMessage<T> {
|
||||
interface GroupContentMessage<T : MessageContent> : PublicContentMessage<T> {
|
||||
override val chat: GroupChat
|
||||
}
|
||||
@Deprecated("Renamed due to ambiguity of naming", ReplaceWith("GroupContentMessage", "dev.inmo.tgbotapi.types.message.abstracts.GroupContentMessage"))
|
||||
typealias GroupMessage<T> = GroupContentMessage<T>
|
||||
|
||||
interface FromChannelGroupMessage<T : MessageContent> : GroupMessage<T>, SignedMessage, WithSenderChatMessage {
|
||||
|
||||
interface FromChannelGroupContentMessage<T : MessageContent> : GroupContentMessage<T>, SignedMessage, WithSenderChatMessage {
|
||||
val channel: ChannelChat
|
||||
override val senderChat: ChannelChat
|
||||
get() = channel
|
||||
}
|
||||
interface AnonymousGroupMessage<T : MessageContent> : GroupMessage<T>, SignedMessage, WithSenderChatMessage {
|
||||
@Deprecated("Renamed due to ambiguity of naming", ReplaceWith("FromChannelGroupContentMessage", "dev.inmo.tgbotapi.types.message.abstracts.FromChannelGroupContentMessage"))
|
||||
typealias FromChannelGroupMessage<T> = FromChannelGroupContentMessage<T>
|
||||
|
||||
interface AnonymousGroupContentMessage<T : MessageContent> : GroupContentMessage<T>, SignedMessage, WithSenderChatMessage {
|
||||
override val senderChat: GroupChat
|
||||
get() = chat
|
||||
}
|
||||
interface CommonGroupMessage<T : MessageContent> : GroupMessage<T>, FromUserMessage
|
||||
@Deprecated("Renamed due to ambiguity of naming", ReplaceWith("AnonymousGroupContentMessage", "dev.inmo.tgbotapi.types.message.abstracts.AnonymousGroupContentMessage"))
|
||||
typealias AnonymousGroupMessage<T> = AnonymousGroupContentMessage<T>
|
||||
|
||||
interface CommonGroupContentMessage<T : MessageContent> : GroupContentMessage<T>, FromUserMessage
|
||||
@Deprecated("Renamed due to ambiguity of naming", ReplaceWith("CommonGroupContentMessage", "dev.inmo.tgbotapi.types.message.abstracts.CommonGroupContentMessage"))
|
||||
typealias CommonGroupMessage<T> = CommonGroupContentMessage<T>
|
||||
|
@ -3,4 +3,6 @@ package dev.inmo.tgbotapi.types.message.abstracts
|
||||
import dev.inmo.tgbotapi.types.message.content.abstracts.MessageContent
|
||||
import dev.inmo.tgbotapi.types.message.content.abstracts.PossiblySentViaBotCommonMessage
|
||||
|
||||
interface PrivateMessage<T: MessageContent> : PossiblySentViaBotCommonMessage<T>, FromUserMessage
|
||||
interface PrivateContentMessage<T: MessageContent> : PossiblySentViaBotCommonMessage<T>, FromUserMessage
|
||||
@Deprecated("Renamed due to ambiguity of naming", ReplaceWith("PrivateContentMessage", "dev.inmo.tgbotapi.types.message.abstracts.PrivateContentMessage"))
|
||||
typealias PrivateMessage<T> = PrivateContentMessage<T>
|
||||
|
@ -4,6 +4,8 @@ import dev.inmo.tgbotapi.types.chat.abstracts.PublicChat
|
||||
import dev.inmo.tgbotapi.types.message.content.abstracts.MessageContent
|
||||
import dev.inmo.tgbotapi.types.message.content.abstracts.PossiblySentViaBotCommonMessage
|
||||
|
||||
interface PublicMessage<T: MessageContent> : PossiblySentViaBotCommonMessage<T> {
|
||||
interface PublicContentMessage<T: MessageContent> : PossiblySentViaBotCommonMessage<T> {
|
||||
override val chat: PublicChat
|
||||
}
|
||||
@Deprecated("Renamed due to ambiguity of naming", ReplaceWith("PublicContentMessage", "dev.inmo.tgbotapi.types.message.PublicContentMessage"))
|
||||
typealias PublicMessage<T> = PublicContentMessage<T>
|
||||
|
@ -393,25 +393,41 @@ inline fun SecureValue.asSecureValueWithTranslations(): SecureValueWithTranslati
|
||||
@PreviewFeature
|
||||
inline fun SecureValue.requireSecureValueWithTranslations(): SecureValueWithTranslations = this as SecureValueWithTranslations
|
||||
@PreviewFeature
|
||||
inline fun Message.asAnonymousGroupMessageImpl(): AnonymousGroupMessageImpl<MessageContent>? = this as? AnonymousGroupMessageImpl<MessageContent>
|
||||
inline fun Message.asAnonymousGroupContentMessageImpl(): AnonymousGroupContentMessageImpl<MessageContent>? = this as? AnonymousGroupContentMessageImpl<MessageContent>
|
||||
@Deprecated("Renamed", ReplaceWith("asAnonymousGroupContentMessageImpl", "dev.inmo.tgbotapi.extensions.utils.asAnonymousGroupContentMessageImpl"))
|
||||
inline fun Message.asAnonymousGroupMessageImpl() = asAnonymousGroupContentMessageImpl()
|
||||
@PreviewFeature
|
||||
inline fun Message.requireAnonymousGroupMessageImpl(): AnonymousGroupMessageImpl<MessageContent> = this as AnonymousGroupMessageImpl<MessageContent>
|
||||
inline fun Message.requireAnonymousGroupContentMessageImpl(): AnonymousGroupContentMessageImpl<MessageContent> = this as AnonymousGroupContentMessageImpl<MessageContent>
|
||||
@Deprecated("Renamed", ReplaceWith("requireAnonymousGroupContentMessageImpl", "dev.inmo.tgbotapi.extensions.utils.requireAnonymousGroupContentMessageImpl"))
|
||||
inline fun Message.requireAnonymousGroupMessageImpl() = requireAnonymousGroupContentMessageImpl()
|
||||
@PreviewFeature
|
||||
inline fun Message.asChannelMessageImpl(): ChannelMessageImpl<MessageContent>? = this as? ChannelMessageImpl<MessageContent>
|
||||
inline fun Message.asChannelContentMessageImpl(): ChannelContentMessageImpl<MessageContent>? = this as? ChannelContentMessageImpl<MessageContent>
|
||||
@Deprecated("Renamed", ReplaceWith("asChannelContentMessageImpl", "dev.inmo.tgbotapi.extensions.utils.asChannelContentMessageImpl"))
|
||||
inline fun Message.asChannelMessageImpl() = asChannelContentMessageImpl()
|
||||
@PreviewFeature
|
||||
inline fun Message.requireChannelMessageImpl(): ChannelMessageImpl<MessageContent> = this as ChannelMessageImpl<MessageContent>
|
||||
inline fun Message.requireChannelContentMessageImpl(): ChannelContentMessageImpl<MessageContent> = this as ChannelContentMessageImpl<MessageContent>
|
||||
@Deprecated("Renamed", ReplaceWith("requireChannelContentMessageImpl", "dev.inmo.tgbotapi.extensions.utils.requireChannelContentMessageImpl"))
|
||||
inline fun Message.requireChannelMessageImpl() = requireChannelContentMessageImpl()
|
||||
@PreviewFeature
|
||||
inline fun Message.asFromChannelGroupMessageImpl(): FromChannelGroupMessageImpl<MessageContent>? = this as? FromChannelGroupMessageImpl<MessageContent>
|
||||
inline fun Message.asFromChannelGroupContentMessageImpl(): FromChannelGroupContentMessageImpl<MessageContent>? = this as? FromChannelGroupContentMessageImpl<MessageContent>
|
||||
@Deprecated("Renamed", ReplaceWith("asFromChannelGroupContentMessageImpl", "dev.inmo.tgbotapi.extensions.utils.asFromChannelGroupContentMessageImpl"))
|
||||
inline fun Message.asFromChannelGroupMessageImpl() = asFromChannelGroupContentMessageImpl()
|
||||
@PreviewFeature
|
||||
inline fun Message.requireFromChannelGroupMessageImpl(): FromChannelGroupMessageImpl<MessageContent> = this as FromChannelGroupMessageImpl<MessageContent>
|
||||
inline fun Message.requireFromChannelGroupContentMessageImpl(): FromChannelGroupContentMessageImpl<MessageContent> = this as FromChannelGroupContentMessageImpl<MessageContent>
|
||||
@Deprecated("Renamed", ReplaceWith("requireFromChannelGroupContentMessageImpl", "dev.inmo.tgbotapi.extensions.utils.requireFromChannelGroupContentMessageImpl"))
|
||||
inline fun Message.requireFromChannelGroupMessageImpl() = requireFromChannelGroupContentMessageImpl()
|
||||
@PreviewFeature
|
||||
inline fun Message.asPassportMessage(): PassportMessage? = this as? PassportMessage
|
||||
@PreviewFeature
|
||||
inline fun Message.requirePassportMessage(): PassportMessage = this as PassportMessage
|
||||
@PreviewFeature
|
||||
inline fun Message.asPrivateMessageImpl(): PrivateMessageImpl<MessageContent>? = this as? PrivateMessageImpl<MessageContent>
|
||||
inline fun Message.asPrivateContentMessageImpl(): PrivateContentMessageImpl<MessageContent>? = this as? PrivateContentMessageImpl<MessageContent>
|
||||
@Deprecated("Renamed", ReplaceWith("asPrivateContentMessageImpl", "dev.inmo.tgbotapi.extensions.utils.asPrivateContentMessageImpl"))
|
||||
inline fun Message.asPrivateMessageImpl() = asPrivateContentMessageImpl()
|
||||
@PreviewFeature
|
||||
inline fun Message.requirePrivateMessageImpl(): PrivateMessageImpl<MessageContent> = this as PrivateMessageImpl<MessageContent>
|
||||
inline fun Message.requirePrivateContentMessageImpl(): PrivateContentMessageImpl<MessageContent> = this as PrivateContentMessageImpl<MessageContent>
|
||||
@Deprecated("Renamed", ReplaceWith("requirePrivateContentMessageImpl", "dev.inmo.tgbotapi.extensions.utils.requirePrivateContentMessageImpl"))
|
||||
inline fun Message.requirePrivateMessageImpl() = requirePrivateContentMessageImpl()
|
||||
@PreviewFeature
|
||||
inline fun Message.asChannelEventMessage(): ChannelEventMessage<ChannelEvent>? = this as? ChannelEventMessage<ChannelEvent>
|
||||
@PreviewFeature
|
||||
@ -433,21 +449,33 @@ inline fun Message.asCommonSupergroupEventMessage(): CommonSupergroupEventMessag
|
||||
@PreviewFeature
|
||||
inline fun Message.requireCommonSupergroupEventMessage(): CommonSupergroupEventMessage<SupergroupEvent> = this as CommonSupergroupEventMessage<SupergroupEvent>
|
||||
@PreviewFeature
|
||||
inline fun Message.asAnonymousGroupMessage(): AnonymousGroupMessage<MessageContent>? = this as? AnonymousGroupMessage<MessageContent>
|
||||
inline fun Message.asAnonymousGroupContentMessage(): AnonymousGroupContentMessage<MessageContent>? = this as? AnonymousGroupContentMessage<MessageContent>
|
||||
@Deprecated("Renamed", ReplaceWith("asAnonymousGroupContentMessage", "dev.inmo.tgbotapi.extensions.utils.asAnonymousGroupContentMessage"))
|
||||
inline fun Message.asAnonymousGroupMessage() = asAnonymousGroupContentMessage()
|
||||
@PreviewFeature
|
||||
inline fun Message.requireAnonymousGroupMessage(): AnonymousGroupMessage<MessageContent> = this as AnonymousGroupMessage<MessageContent>
|
||||
inline fun Message.requireAnonymousGroupContentMessage(): AnonymousGroupContentMessage<MessageContent> = this as AnonymousGroupContentMessage<MessageContent>
|
||||
@Deprecated("Renamed", ReplaceWith("requireAnonymousGroupContentMessage", "dev.inmo.tgbotapi.extensions.utils.requireAnonymousGroupContentMessage"))
|
||||
inline fun Message.requireAnonymousGroupMessage() = requireAnonymousGroupContentMessage()
|
||||
@PreviewFeature
|
||||
inline fun Message.asChannelMessage(): ChannelMessage<MessageContent>? = this as? ChannelMessage<MessageContent>
|
||||
inline fun Message.asChannelContentMessage(): ChannelContentMessageImpl<MessageContent>? = this as? ChannelContentMessageImpl<MessageContent>
|
||||
@Deprecated("Renamed", ReplaceWith("asChannelContentMessage", "dev.inmo.tgbotapi.extensions.utils.asChannelContentMessage"))
|
||||
inline fun Message.asChannelMessage() = asChannelContentMessage()
|
||||
@PreviewFeature
|
||||
inline fun Message.requireChannelMessage(): ChannelMessage<MessageContent> = this as ChannelMessage<MessageContent>
|
||||
inline fun Message.requireChannelContentMessage(): ChannelContentMessageImpl<MessageContent> = this as ChannelContentMessageImpl<MessageContent>
|
||||
@Deprecated("Renamed", ReplaceWith("requireChannelContentMessage", "dev.inmo.tgbotapi.extensions.utils.requireChannelContentMessage"))
|
||||
inline fun Message.requireChannelMessage() = requireChannelContentMessage()
|
||||
@PreviewFeature
|
||||
inline fun Message.asChatEventMessage(): ChatEventMessage<ChatEvent>? = this as? ChatEventMessage<ChatEvent>
|
||||
@PreviewFeature
|
||||
inline fun Message.requireChatEventMessage(): ChatEventMessage<ChatEvent> = this as ChatEventMessage<ChatEvent>
|
||||
@PreviewFeature
|
||||
inline fun Message.asCommonGroupMessage(): CommonGroupMessage<MessageContent>? = this as? CommonGroupMessage<MessageContent>
|
||||
inline fun Message.asCommonGroupContentMessage(): CommonGroupContentMessage<MessageContent>? = this as? CommonGroupContentMessage<MessageContent>
|
||||
@Deprecated("Renamed", ReplaceWith("asCommonGroupContentMessage", "dev.inmo.tgbotapi.extensions.utils.asCommonGroupContentMessage"))
|
||||
inline fun Message.asCommonGroupMessage() = asCommonGroupContentMessage()
|
||||
@PreviewFeature
|
||||
inline fun Message.requireCommonGroupMessage(): CommonGroupMessage<MessageContent> = this as CommonGroupMessage<MessageContent>
|
||||
inline fun Message.requireCommonGroupContentMessage(): CommonGroupContentMessage<MessageContent> = this as CommonGroupContentMessage<MessageContent>
|
||||
@Deprecated("Renamed", ReplaceWith("requireCommonGroupContentMessage", "dev.inmo.tgbotapi.extensions.utils.requireCommonGroupContentMessage"))
|
||||
inline fun Message.requireCommonGroupMessage() = requireCommonGroupContentMessage()
|
||||
@PreviewFeature
|
||||
inline fun Message.asCommonMessage(): CommonMessage<MessageContent>? = this as? CommonMessage<MessageContent>
|
||||
@PreviewFeature
|
||||
@ -457,17 +485,25 @@ inline fun Message.asContentMessage(): ContentMessage<MessageContent>? = this as
|
||||
@PreviewFeature
|
||||
inline fun Message.requireContentMessage(): ContentMessage<MessageContent> = this as ContentMessage<MessageContent>
|
||||
@PreviewFeature
|
||||
inline fun Message.asFromChannelGroupMessage(): FromChannelGroupMessage<MessageContent>? = this as? FromChannelGroupMessage<MessageContent>
|
||||
inline fun Message.asFromChannelGroupContentMessage(): FromChannelGroupContentMessage<MessageContent>? = this as? FromChannelGroupContentMessage<MessageContent>
|
||||
@Deprecated("Renamed", ReplaceWith("asFromChannelGroupContentMessage", "dev.inmo.tgbotapi.extensions.utils.asFromChannelGroupContentMessage"))
|
||||
inline fun Message.asFromChannelGroupMessage() = asFromChannelGroupContentMessage()
|
||||
@PreviewFeature
|
||||
inline fun Message.requireFromChannelGroupMessage(): FromChannelGroupMessage<MessageContent> = this as FromChannelGroupMessage<MessageContent>
|
||||
inline fun Message.requireFromChannelGroupContentMessage(): FromChannelGroupContentMessage<MessageContent> = this as FromChannelGroupContentMessage<MessageContent>
|
||||
@Deprecated("Renamed", ReplaceWith("requireFromChannelGroupContentMessage", "dev.inmo.tgbotapi.extensions.utils.requireFromChannelGroupContentMessage"))
|
||||
inline fun Message.requireFromChannelGroupMessage() = requireFromChannelGroupContentMessage()
|
||||
@PreviewFeature
|
||||
inline fun Message.asGroupEventMessage(): GroupEventMessage<GroupEvent>? = this as? GroupEventMessage<GroupEvent>
|
||||
@PreviewFeature
|
||||
inline fun Message.requireGroupEventMessage(): GroupEventMessage<GroupEvent> = this as GroupEventMessage<GroupEvent>
|
||||
@PreviewFeature
|
||||
inline fun Message.asGroupMessage(): GroupMessage<MessageContent>? = this as? GroupMessage<MessageContent>
|
||||
inline fun Message.asGroupContentMessage(): GroupContentMessage<MessageContent>? = this as? GroupContentMessage<MessageContent>
|
||||
@Deprecated("Renamed", ReplaceWith("asGroupContentMessage", "dev.inmo.tgbotapi.extensions.utils.asGroupContentMessage"))
|
||||
inline fun Message.asGroupMessage() = asGroupContentMessage()
|
||||
@PreviewFeature
|
||||
inline fun Message.requireGroupMessage(): GroupMessage<MessageContent> = this as GroupMessage<MessageContent>
|
||||
inline fun Message.requireGroupContentMessage(): GroupContentMessage<MessageContent> = this as GroupContentMessage<MessageContent>
|
||||
@Deprecated("Renamed", ReplaceWith("requireGroupContentMessage", "dev.inmo.tgbotapi.extensions.utils.requireGroupContentMessage"))
|
||||
inline fun Message.requireGroupMessage() = requireGroupContentMessage()
|
||||
@PreviewFeature
|
||||
inline fun Message.asMediaGroupMessage(): MediaGroupMessage<MediaGroupContent>? = this as? MediaGroupMessage<MediaGroupContent>
|
||||
@PreviewFeature
|
||||
@ -485,13 +521,21 @@ inline fun Message.asPossiblyPaymentMessage(): PossiblyPaymentMessage? = this as
|
||||
@PreviewFeature
|
||||
inline fun Message.requirePossiblyPaymentMessage(): PossiblyPaymentMessage = this as PossiblyPaymentMessage
|
||||
@PreviewFeature
|
||||
inline fun Message.asPrivateMessage(): PrivateMessage<MessageContent>? = this as? PrivateMessage<MessageContent>
|
||||
inline fun Message.asPrivateContentMessage(): PrivateContentMessage<MessageContent>? = this as? PrivateContentMessage<MessageContent>
|
||||
@Deprecated("Renamed", ReplaceWith("asPrivateContentMessage", "dev.inmo.tgbotapi.extensions.utils.asPrivateContentMessage"))
|
||||
inline fun Message.asPrivateMessage() = asPrivateContentMessage()
|
||||
@PreviewFeature
|
||||
inline fun Message.requirePrivateMessage(): PrivateMessage<MessageContent> = this as PrivateMessage<MessageContent>
|
||||
inline fun Message.requirePrivateContentMessage(): PrivateContentMessage<MessageContent> = this as PrivateContentMessage<MessageContent>
|
||||
@Deprecated("Renamed", ReplaceWith("requirePrivateContentMessage", "dev.inmo.tgbotapi.extensions.utils.requirePrivateContentMessage"))
|
||||
inline fun Message.requirePrivateMessage() = requirePrivateContentMessage()
|
||||
@PreviewFeature
|
||||
inline fun Message.asPublicMessage(): PublicMessage<MessageContent>? = this as? PublicMessage<MessageContent>
|
||||
inline fun Message.asPublicContentMessage(): PublicContentMessage<MessageContent>? = this as? PublicContentMessage<MessageContent>
|
||||
@Deprecated("Renamed", ReplaceWith("asPublicContentMessage", "dev.inmo.tgbotapi.extensions.utils.asPublicContentMessage"))
|
||||
inline fun Message.asPublicMessage() = asPublicContentMessage()
|
||||
@PreviewFeature
|
||||
inline fun Message.requirePublicMessage(): PublicMessage<MessageContent> = this as PublicMessage<MessageContent>
|
||||
inline fun Message.requirePublicContentMessage(): PublicContentMessage<MessageContent> = this as PublicContentMessage<MessageContent>
|
||||
@Deprecated("Renamed", ReplaceWith("requirePublicContentMessage", "dev.inmo.tgbotapi.extensions.utils.requirePublicContentMessage"))
|
||||
inline fun Message.requirePublicMessage() = requirePublicContentMessage()
|
||||
@PreviewFeature
|
||||
inline fun Message.asSignedMessage(): SignedMessage? = this as? SignedMessage
|
||||
@PreviewFeature
|
||||
|
@ -14,26 +14,26 @@ inline fun <reified T : MessageContent> CommonMessage<*>.requireWithContent() =
|
||||
inline fun <reified T : MessageContent> PossiblySentViaBotCommonMessage<*>.withContent() = if (content is T) { this as PossiblySentViaBotCommonMessage<T> } else { null }
|
||||
inline fun <reified T : MessageContent> PossiblySentViaBotCommonMessage<*>.requireWithContent() = withContent<T>()!!
|
||||
|
||||
inline fun <reified T : MessageContent> ChannelMessage<*>.withContent() = if (content is T) { this as ChannelMessage<T> } else { null }
|
||||
inline fun <reified T : MessageContent> ChannelMessage<*>.requireWithContent() = withContent<T>()!!
|
||||
inline fun <reified T : MessageContent> ChannelContentMessage<*>.withContent() = if (content is T) { this as ChannelContentMessage<T> } else { null }
|
||||
inline fun <reified T : MessageContent> ChannelContentMessage<*>.requireWithContent() = withContent<T>()!!
|
||||
|
||||
inline fun <reified T : MessageContent> PrivateMessage<*>.withContent() = if (content is T) { this as PrivateMessage<T> } else { null }
|
||||
inline fun <reified T : MessageContent> PrivateMessage<*>.requireWithContent() = withContent<T>()!!
|
||||
inline fun <reified T : MessageContent> PrivateContentMessage<*>.withContent() = if (content is T) { this as PrivateContentMessage<T> } else { null }
|
||||
inline fun <reified T : MessageContent> PrivateContentMessage<*>.requireWithContent() = withContent<T>()!!
|
||||
|
||||
inline fun <reified T : MessageContent> PublicMessage<*>.withContent() = if (content is T) { this as PublicMessage<T> } else { null }
|
||||
inline fun <reified T : MessageContent> PublicMessage<*>.requireWithContent() = withContent<T>()!!
|
||||
inline fun <reified T : MessageContent> PublicContentMessage<*>.withContent() = if (content is T) { this as PublicContentMessage<T> } else { null }
|
||||
inline fun <reified T : MessageContent> PublicContentMessage<*>.requireWithContent() = withContent<T>()!!
|
||||
|
||||
inline fun <reified T : MessageContent> GroupMessage<*>.withContent() = if (content is T) { this as GroupMessage<T> } else { null }
|
||||
inline fun <reified T : MessageContent> GroupMessage<*>.requireWithContent() = withContent<T>()!!
|
||||
inline fun <reified T : MessageContent> GroupContentMessage<*>.withContent() = if (content is T) { this as GroupContentMessage<T> } else { null }
|
||||
inline fun <reified T : MessageContent> GroupContentMessage<*>.requireWithContent() = withContent<T>()!!
|
||||
|
||||
inline fun <reified T : MessageContent> FromChannelGroupMessage<*>.withContent() = if (content is T) { this as FromChannelGroupMessage<T> } else { null }
|
||||
inline fun <reified T : MessageContent> FromChannelGroupMessage<*>.requireWithContent() = withContent<T>()!!
|
||||
inline fun <reified T : MessageContent> FromChannelGroupContentMessage<*>.withContent() = if (content is T) { this as FromChannelGroupContentMessage<T> } else { null }
|
||||
inline fun <reified T : MessageContent> FromChannelGroupContentMessage<*>.requireWithContent() = withContent<T>()!!
|
||||
|
||||
inline fun <reified T : MessageContent> AnonymousGroupMessage<*>.withContent() = if (content is T) { this as AnonymousGroupMessage<T> } else { null }
|
||||
inline fun <reified T : MessageContent> AnonymousGroupMessage<*>.requireWithContent() = withContent<T>()!!
|
||||
inline fun <reified T : MessageContent> AnonymousGroupContentMessage<*>.withContent() = if (content is T) { this as AnonymousGroupContentMessage<T> } else { null }
|
||||
inline fun <reified T : MessageContent> AnonymousGroupContentMessage<*>.requireWithContent() = withContent<T>()!!
|
||||
|
||||
inline fun <reified T : MessageContent> CommonGroupMessage<*>.withContent() = if (content is T) { this as CommonGroupMessage<T> } else { null }
|
||||
inline fun <reified T : MessageContent> CommonGroupMessage<*>.requireWithContent() = withContent<T>()!!
|
||||
inline fun <reified T : MessageContent> CommonGroupContentMessage<*>.withContent() = if (content is T) { this as CommonGroupContentMessage<T> } else { null }
|
||||
inline fun <reified T : MessageContent> CommonGroupContentMessage<*>.requireWithContent() = withContent<T>()!!
|
||||
|
||||
inline fun <reified T : MediaGroupContent> MediaGroupMessage<*>.withContent() = if (content is T) { this as MediaGroupMessage<T> } else { null }
|
||||
inline fun <reified T : MediaGroupContent> MediaGroupMessage<*>.requireWithContent() = withContent<T>()!!
|
||||
|
Loading…
Reference in New Issue
Block a user