mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 16:23:48 +00:00
resend and other media group utils replaced into TelegramBotAPI_extensions-utils
This commit is contained in:
parent
b484a31a4a
commit
16f55d70af
18
CHANGELOG.md
18
CHANGELOG.md
@ -58,14 +58,24 @@
|
|||||||
* Fix: for sending requests caption and text lengths limits were updated
|
* Fix: for sending requests caption and text lengths limits were updated
|
||||||
* New variant of `row` was added
|
* New variant of `row` was added
|
||||||
* `makeLinkToMessage` extensions has been deprecated (replaced into `TelegramBotAPI-extensions-utils`)
|
* `makeLinkToMessage` extensions has been deprecated (replaced into `TelegramBotAPI-extensions-utils`)
|
||||||
* All `String` formatting public extensions and functions was deprecated and replaced into `TelegramBotAPI-extensions-utils`
|
* Next things was deprecated and replaced into `TelegramBotAPI-extensions-utils`:
|
||||||
* All extensions like `CaptionedInput#toHtmlCaptions` was deprecated and replaced into `TelegramBotAPI-extensions-utils`
|
* All `String` formatting public extensions and functions
|
||||||
|
* All extensions like `CaptionedInput#toHtmlCaptions`
|
||||||
|
* All helper extensions for `List<BaseMessageUpdate>`
|
||||||
* `TelegramBotAPI-extensions-utils`:
|
* `TelegramBotAPI-extensions-utils`:
|
||||||
* `safely` function was introduced. It is in `PreviewFeature` state currently
|
* `safely` function was introduced. It is in `PreviewFeature` state currently
|
||||||
* `makeLinkToMessage` extensions has been added
|
* `makeLinkToMessage` extensions has been added
|
||||||
* `makeLinkToAddStickerSet` function and its variations were added
|
* `makeLinkToAddStickerSet` function and its variations were added
|
||||||
* All `String` formatting extensions and functions from `TelegramBotAPI` was added
|
* Next tools was added from `TelegramBotAPI`:
|
||||||
* All extensions like `CaptionedInput#toHtmlCaptions` from `TelegramBotAPI` was added
|
* All `String` formatting extensions and functions
|
||||||
|
* All extensions like `CaptionedInput#toHtmlCaptions`
|
||||||
|
* All helper extensions for `List<BaseMessageUpdate>`
|
||||||
|
* Several new extensions for `SentMediaGroupUpdate` were added:
|
||||||
|
* `SentMediaGroupUpdate#forwardInfo`
|
||||||
|
* `SentMediaGroupUpdate#replyTo`
|
||||||
|
* `SentMediaGroupUpdate#chat`
|
||||||
|
* `SentMediaGroupUpdate#mediaGroupId`
|
||||||
|
* Several `List<MediaGroupMessage>.createResend` extensions were added
|
||||||
|
|
||||||
### 0.27.4
|
### 0.27.4
|
||||||
|
|
||||||
|
@ -0,0 +1,56 @@
|
|||||||
|
package com.github.insanusmokrassar.TelegramBotAPI.extensions.utils.shortcuts
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendMediaGroup
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.ForwardInfo
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.*
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.update.MediaGroupUpdates.SentMediaGroupUpdate
|
||||||
|
|
||||||
|
val List<MediaGroupMessage>.forwardInfo: ForwardInfo?
|
||||||
|
get() = firstOrNull() ?.forwardInfo
|
||||||
|
val List<MediaGroupMessage>.replyTo: Message?
|
||||||
|
get() = firstOrNull() ?.replyTo
|
||||||
|
val List<MediaGroupMessage>.chat: Chat?
|
||||||
|
get() = firstOrNull() ?.chat
|
||||||
|
val List<MediaGroupMessage>.mediaGroupId: MediaGroupIdentifier?
|
||||||
|
get() = firstOrNull() ?.mediaGroupId
|
||||||
|
|
||||||
|
val SentMediaGroupUpdate.forwardInfo: ForwardInfo?
|
||||||
|
get() = data.forwardInfo!!
|
||||||
|
val SentMediaGroupUpdate.replyTo: Message?
|
||||||
|
get() = data.replyTo
|
||||||
|
val SentMediaGroupUpdate.chat: Chat
|
||||||
|
get() = data.chat!!
|
||||||
|
val SentMediaGroupUpdate.mediaGroupId: MediaGroupIdentifier
|
||||||
|
get() = data.mediaGroupId!!
|
||||||
|
|
||||||
|
fun List<MediaGroupMessage>.createResend(
|
||||||
|
chatId: ChatId,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyTo: MessageIdentifier? = null
|
||||||
|
) = SendMediaGroup(
|
||||||
|
chatId,
|
||||||
|
map { it.content.toMediaGroupMemberInputMedia() },
|
||||||
|
disableNotification,
|
||||||
|
replyTo
|
||||||
|
)
|
||||||
|
|
||||||
|
fun List<MediaGroupMessage>.createResend(
|
||||||
|
chat: Chat,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyTo: MessageIdentifier? = null
|
||||||
|
) = createResend(
|
||||||
|
chat.id,
|
||||||
|
disableNotification,
|
||||||
|
replyTo
|
||||||
|
)
|
||||||
|
|
||||||
|
fun SentMediaGroupUpdate.createResend(
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyTo: MessageIdentifier? = null
|
||||||
|
) = data.createResend(
|
||||||
|
chat,
|
||||||
|
disableNotification,
|
||||||
|
replyTo
|
||||||
|
)
|
@ -6,18 +6,22 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.message.ForwardInfo
|
|||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.BaseMessageUpdate
|
import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.BaseMessageUpdate
|
||||||
|
|
||||||
|
@Deprecated("Replaced and updated inside of TelegramBotAPI-extensions-utils")
|
||||||
val List<BaseMessageUpdate>.forwarded: ForwardInfo?
|
val List<BaseMessageUpdate>.forwarded: ForwardInfo?
|
||||||
get() = first().let {
|
get() = first().let {
|
||||||
(it as? PossiblyForwardedMessage) ?.forwardInfo
|
(it as? PossiblyForwardedMessage) ?.forwardInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated("Replaced and updated inside of TelegramBotAPI-extensions-utils")
|
||||||
val List<BaseMessageUpdate>.replyTo: Message?
|
val List<BaseMessageUpdate>.replyTo: Message?
|
||||||
get() = first().let {
|
get() = first().let {
|
||||||
(it as? PossiblyReplyMessage) ?.replyTo
|
(it as? PossiblyReplyMessage) ?.replyTo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated("Replaced and updated inside of TelegramBotAPI-extensions-utils")
|
||||||
val List<BaseMessageUpdate>.chat: Chat?
|
val List<BaseMessageUpdate>.chat: Chat?
|
||||||
get() = first().data.chat
|
get() = first().data.chat
|
||||||
|
|
||||||
|
@Deprecated("Replaced and updated inside of TelegramBotAPI-extensions-utils")
|
||||||
val List<BaseMessageUpdate>.mediaGroupId: MediaGroupIdentifier?
|
val List<BaseMessageUpdate>.mediaGroupId: MediaGroupIdentifier?
|
||||||
get() = (first().data as? MediaGroupMessage) ?.mediaGroupId
|
get() = (first().data as? MediaGroupMessage) ?.mediaGroupId
|
||||||
|
Loading…
Reference in New Issue
Block a user