diff --git a/CHANGELOG.md b/CHANGELOG.md index 59f1af1355..ccd97637d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,9 @@ ### 0.28.5 +* `TelegramBotAPI-core`: + * Now in forward info you can get `ForwardFromSupergroupInfo` + ### 0.28.4 * `Common`: diff --git a/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ForwardInfo.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ForwardInfo.kt index f6fff2681d..55dbd39068 100644 --- a/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ForwardInfo.kt +++ b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ForwardInfo.kt @@ -2,6 +2,7 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.message import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.ChannelChat +import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.SupergroupChat sealed class ForwardInfo { abstract val dateOfOriginal: TelegramDate @@ -23,3 +24,9 @@ data class ForwardFromChannelInfo( val channelChat: ChannelChat, val signature: String? = null ) : ForwardInfo() + +data class ForwardFromSupergroupInfo( + override val dateOfOriginal: TelegramDate, + val messageId: MessageIdentifier, + val group: SupergroupChat +) : ForwardInfo() diff --git a/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/RawMessage.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/RawMessage.kt index e1837adb0b..1fbe57125d 100644 --- a/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/RawMessage.kt +++ b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/RawMessage.kt @@ -153,6 +153,11 @@ internal data class RawMessage( forward_from_chat, forward_signature ) + forward_from_chat is SupergroupChat -> ForwardFromSupergroupInfo( + forward_date, + forward_from_message_id ?: error("Channel forwarded message must contain message id, but was not"), + forward_from_chat + ) forward_from != null -> UserForwardInfo( forward_date, forward_from