1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-22 00:03:48 +00:00

ForwardFromSupergroupInfo

This commit is contained in:
InsanusMokrassar 2020-10-02 14:59:10 +06:00
parent 403aa684a8
commit 70b592baad
3 changed files with 15 additions and 0 deletions

View File

@ -44,6 +44,9 @@
### 0.28.5
* `TelegramBotAPI-core`:
* Now in forward info you can get `ForwardFromSupergroupInfo`
### 0.28.4
* `Common`:

View File

@ -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()

View File

@ -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