mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 08:13:47 +00:00
fixes of build
This commit is contained in:
parent
f3b05bbffd
commit
8df72edd52
@ -741,7 +741,7 @@ suspend fun <BC : BehaviourContext> BC.onScheduledGiveawayContent(
|
|||||||
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
|
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
|
||||||
* data
|
* data
|
||||||
*/
|
*/
|
||||||
suspend fun <BC : BehaviourContext> BC.onScheduledGiveawayContent(
|
suspend fun <BC : BehaviourContext> BC.onGiveawayPublicResultsContent(
|
||||||
initialFilter: CommonMessageFilter<GiveawayPublicResultsContent>? = null,
|
initialFilter: CommonMessageFilter<GiveawayPublicResultsContent>? = null,
|
||||||
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, GiveawayPublicResultsContentMessage, Update>? = MessageFilterByChat,
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, GiveawayPublicResultsContentMessage, Update>? = MessageFilterByChat,
|
||||||
markerFactory: MarkerFactory<in GiveawayPublicResultsContentMessage, Any> = ByChatMessageMarkerFactory,
|
markerFactory: MarkerFactory<in GiveawayPublicResultsContentMessage, Any> = ByChatMessageMarkerFactory,
|
||||||
|
@ -63,13 +63,13 @@ sealed interface ReplyInfo {
|
|||||||
) : Content
|
) : Content
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class Media<T>(
|
data class Media(
|
||||||
override val origin: MessageOrigin,
|
override val origin: MessageOrigin,
|
||||||
override val chat: SuperPublicChat?,
|
override val chat: SuperPublicChat?,
|
||||||
override val messageMeta: Message.MetaInfo?,
|
override val messageMeta: Message.MetaInfo?,
|
||||||
override val spoilered: Boolean,
|
override val spoilered: Boolean,
|
||||||
override val content: T
|
override val content: MediaContentVariant
|
||||||
) : Content, SpoilerableData where T: ContentVariant, T : TelegramMediaFile
|
) : Content, SpoilerableData
|
||||||
}
|
}
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
@ -133,7 +133,7 @@ sealed interface ReplyInfo {
|
|||||||
|
|
||||||
return content ?.let {
|
return content ?.let {
|
||||||
when (it) {
|
when (it) {
|
||||||
is TelegramMediaFile -> {
|
is MediaContentVariant -> {
|
||||||
Content.Media(
|
Content.Media(
|
||||||
origin,
|
origin,
|
||||||
chat,
|
chat,
|
||||||
|
@ -24,4 +24,4 @@ data class AnimationFile(
|
|||||||
@SerialName(fileSizeField)
|
@SerialName(fileSizeField)
|
||||||
override val fileSize: Long? = null
|
override val fileSize: Long? = null
|
||||||
) : TelegramMediaFile, MimedMediaFile, ThumbedMediaFile, PlayableMediaFile, CustomNamedMediaFile, SizedMediaFile,
|
) : TelegramMediaFile, MimedMediaFile, ThumbedMediaFile, PlayableMediaFile, CustomNamedMediaFile, SizedMediaFile,
|
||||||
ReplyInfo.External.ContentVariant
|
MediaContentVariant
|
||||||
|
@ -28,6 +28,6 @@ data class AudioFile(
|
|||||||
@SerialName(thumbnailField)
|
@SerialName(thumbnailField)
|
||||||
override val thumbnail: PhotoSize? = null
|
override val thumbnail: PhotoSize? = null
|
||||||
) : TelegramMediaFile, CustomNamedMediaFile, MimedMediaFile, ThumbedMediaFile, PlayableMediaFile, TitledMediaFile,
|
) : TelegramMediaFile, CustomNamedMediaFile, MimedMediaFile, ThumbedMediaFile, PlayableMediaFile, TitledMediaFile,
|
||||||
Performerable, ReplyInfo.External.ContentVariant
|
Performerable, MediaContentVariant
|
||||||
|
|
||||||
fun AudioFile.asVoiceFile() = VoiceFile(fileId, fileUniqueId, duration, mimeType, fileSize)
|
fun AudioFile.asVoiceFile() = VoiceFile(fileId, fileUniqueId, duration, mimeType, fileSize)
|
||||||
|
@ -20,7 +20,7 @@ data class DocumentFile(
|
|||||||
override val mimeType: MimeType? = null,
|
override val mimeType: MimeType? = null,
|
||||||
@SerialName(fileNameField)
|
@SerialName(fileNameField)
|
||||||
override val fileName: String? = null
|
override val fileName: String? = null
|
||||||
) : TelegramMediaFile, MimedMediaFile, ThumbedMediaFile, CustomNamedMediaFile, ReplyInfo.External.ContentVariant
|
) : TelegramMediaFile, MimedMediaFile, ThumbedMediaFile, CustomNamedMediaFile, MediaContentVariant
|
||||||
|
|
||||||
@Suppress("NOTHING_TO_INLINE")
|
@Suppress("NOTHING_TO_INLINE")
|
||||||
inline fun TelegramMediaFile.asDocumentFile() = if (this is DocumentFile) {
|
inline fun TelegramMediaFile.asDocumentFile() = if (this is DocumentFile) {
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
package dev.inmo.tgbotapi.types.files
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.types.ReplyInfo
|
||||||
|
|
||||||
|
interface MediaContentVariant : ReplyInfo.External.ContentVariant, TelegramMediaFile
|
@ -12,7 +12,22 @@ import kotlin.jvm.JvmInline
|
|||||||
@JvmInline
|
@JvmInline
|
||||||
value class Photo(
|
value class Photo(
|
||||||
val photos: List<PhotoSize>
|
val photos: List<PhotoSize>
|
||||||
) : List<PhotoSize> by photos, ReplyInfo.External.ContentVariant
|
) : List<PhotoSize> by photos, MediaContentVariant {
|
||||||
|
val biggest: PhotoSize
|
||||||
|
get() = biggest()!!
|
||||||
|
override val fileId: FileId
|
||||||
|
get() = biggest.fileId
|
||||||
|
override val fileUniqueId: FileUniqueId
|
||||||
|
get() = biggest.fileUniqueId
|
||||||
|
override val fileSize: Long?
|
||||||
|
get() = biggest.fileSize
|
||||||
|
|
||||||
|
init {
|
||||||
|
require(photos.isNotEmpty()) {
|
||||||
|
"Photos collection must not be empty"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun Photo.biggest(): PhotoSize? = maxByOrNull {
|
fun Photo.biggest(): PhotoSize? = maxByOrNull {
|
||||||
it.resolution
|
it.resolution
|
||||||
|
@ -34,7 +34,7 @@ data class StickerSurrogate(
|
|||||||
|
|
||||||
// TODO:: Serializer
|
// TODO:: Serializer
|
||||||
@Serializable(StickerSerializer::class)
|
@Serializable(StickerSerializer::class)
|
||||||
sealed interface Sticker : TelegramMediaFile, SizedMediaFile, ThumbedMediaFile, ReplyInfo.External.ContentVariant {
|
sealed interface Sticker : TelegramMediaFile, SizedMediaFile, ThumbedMediaFile, MediaContentVariant {
|
||||||
val emoji: String?
|
val emoji: String?
|
||||||
val stickerSetName: StickerSetName?
|
val stickerSetName: StickerSetName?
|
||||||
val stickerFormat: StickerFormat
|
val stickerFormat: StickerFormat
|
||||||
|
@ -30,7 +30,7 @@ data class VideoFile(
|
|||||||
@SerialName(fileSizeField)
|
@SerialName(fileSizeField)
|
||||||
override val fileSize: Long? = null
|
override val fileSize: Long? = null
|
||||||
) : TelegramMediaFile, CustomNamedMediaFile, MimedMediaFile, ThumbedMediaFile, PlayableMediaFile, SizedMediaFile,
|
) : TelegramMediaFile, CustomNamedMediaFile, MimedMediaFile, ThumbedMediaFile, PlayableMediaFile, SizedMediaFile,
|
||||||
ReplyInfo.External.ContentVariant
|
MediaContentVariant
|
||||||
|
|
||||||
@Suppress("NOTHING_TO_INLINE")
|
@Suppress("NOTHING_TO_INLINE")
|
||||||
inline fun VideoFile.toTelegramMediaVideo(
|
inline fun VideoFile.toTelegramMediaVideo(
|
||||||
|
@ -18,7 +18,7 @@ data class VideoNoteFile(
|
|||||||
override val thumbnail: PhotoSize? = null,
|
override val thumbnail: PhotoSize? = null,
|
||||||
@SerialName(fileSizeField)
|
@SerialName(fileSizeField)
|
||||||
override val fileSize: Long? = null
|
override val fileSize: Long? = null
|
||||||
) : TelegramMediaFile, ThumbedMediaFile, PlayableMediaFile, SizedMediaFile, ReplyInfo.External.ContentVariant {
|
) : TelegramMediaFile, ThumbedMediaFile, PlayableMediaFile, SizedMediaFile, MediaContentVariant {
|
||||||
override val height: Int
|
override val height: Int
|
||||||
get() = width
|
get() = width
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ data class VoiceFile(
|
|||||||
override val mimeType: MimeType? = null,
|
override val mimeType: MimeType? = null,
|
||||||
@SerialName(fileSizeField)
|
@SerialName(fileSizeField)
|
||||||
override val fileSize: Long? = null
|
override val fileSize: Long? = null
|
||||||
) : TelegramMediaFile, MimedMediaFile, PlayableMediaFile, ReplyInfo.External.ContentVariant
|
) : TelegramMediaFile, MimedMediaFile, PlayableMediaFile, MediaContentVariant
|
||||||
|
|
||||||
fun VoiceFile.asAudioFile(
|
fun VoiceFile.asAudioFile(
|
||||||
performer: String? = null,
|
performer: String? = null,
|
||||||
|
@ -36,6 +36,6 @@ data class ChannelContentMessageImpl<T: MessageContent>(
|
|||||||
authorSignature: AuthorSignature?,
|
authorSignature: AuthorSignature?,
|
||||||
mediaGroupId: MediaGroupIdentifier?,
|
mediaGroupId: MediaGroupIdentifier?,
|
||||||
) : this(
|
) : this(
|
||||||
messageId, chat, content, date, editDate, hasProtectedContent, forwardInfo.messageOrigin(), replyTo, replyMarkup, senderBot, authorSignature, mediaGroupId
|
messageId, chat, content, date, editDate, hasProtectedContent, forwardInfo.messageOrigin(), replyTo ?.let { ReplyInfo.Internal(it) }, replyMarkup, senderBot, authorSignature, mediaGroupId
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -83,6 +83,7 @@ fun MessageOrigin.forwardInfo() = when(this) {
|
|||||||
date,
|
date,
|
||||||
user
|
user
|
||||||
)
|
)
|
||||||
|
is MessageOrigin.Unknown -> null
|
||||||
}
|
}
|
||||||
|
|
||||||
fun ForwardInfo.messageOrigin() = when (this) {
|
fun ForwardInfo.messageOrigin() = when (this) {
|
||||||
|
@ -40,7 +40,7 @@ data class ConnectedFromChannelGroupContentMessageImpl<T : MessageContent>(
|
|||||||
authorSignature: AuthorSignature?,
|
authorSignature: AuthorSignature?,
|
||||||
mediaGroupId: MediaGroupIdentifier?,
|
mediaGroupId: MediaGroupIdentifier?,
|
||||||
) : this(
|
) : this(
|
||||||
chat, channel, messageId, date, forwardInfo.messageOrigin(), editDate, hasProtectedContent, replyTo, replyMarkup, content, senderBot, authorSignature, mediaGroupId
|
chat, channel, messageId, date, forwardInfo.messageOrigin(), editDate, hasProtectedContent, replyTo ?.let { ReplyInfo.Internal(it) }, replyMarkup, content, senderBot, authorSignature, mediaGroupId
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ data class UnconnectedFromChannelGroupContentMessageImpl<T: MessageContent>(
|
|||||||
authorSignature: AuthorSignature?,
|
authorSignature: AuthorSignature?,
|
||||||
mediaGroupId: MediaGroupIdentifier?,
|
mediaGroupId: MediaGroupIdentifier?,
|
||||||
) : this(
|
) : this(
|
||||||
chat, channel, messageId, date, forwardInfo.messageOrigin(), editDate, hasProtectedContent, replyTo, replyMarkup, content, senderBot, authorSignature, mediaGroupId
|
chat, channel, messageId, date, forwardInfo.messageOrigin(), editDate, hasProtectedContent, replyTo ?.let { ReplyInfo.Internal(it) }, replyMarkup, content, senderBot, authorSignature, mediaGroupId
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,7 +106,7 @@ data class AnonymousGroupContentMessageImpl<T : MessageContent>(
|
|||||||
authorSignature: AuthorSignature?,
|
authorSignature: AuthorSignature?,
|
||||||
mediaGroupId: MediaGroupIdentifier?,
|
mediaGroupId: MediaGroupIdentifier?,
|
||||||
) : this(
|
) : this(
|
||||||
chat, messageId, date, forwardInfo.messageOrigin(), editDate, hasProtectedContent, replyTo, replyMarkup, content, senderBot, authorSignature, mediaGroupId
|
chat, messageId, date, forwardInfo.messageOrigin(), editDate, hasProtectedContent, replyTo ?.let { ReplyInfo.Internal(it) }, replyMarkup, content, senderBot, authorSignature, mediaGroupId
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,7 +138,7 @@ data class CommonGroupContentMessageImpl<T : MessageContent>(
|
|||||||
senderBot: CommonBot?,
|
senderBot: CommonBot?,
|
||||||
mediaGroupId: MediaGroupIdentifier?,
|
mediaGroupId: MediaGroupIdentifier?,
|
||||||
) : this(
|
) : this(
|
||||||
chat, messageId, from, date, forwardInfo.messageOrigin(), editDate, hasProtectedContent, replyTo, replyMarkup, content, senderBot, mediaGroupId
|
chat, messageId, from, date, forwardInfo.messageOrigin(), editDate, hasProtectedContent, replyTo ?.let { ReplyInfo.Internal(it) }, replyMarkup, content, senderBot, mediaGroupId
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,7 +174,7 @@ data class FromChannelForumContentMessageImpl<T: MessageContent>(
|
|||||||
authorSignature: AuthorSignature?,
|
authorSignature: AuthorSignature?,
|
||||||
mediaGroupId: MediaGroupIdentifier?,
|
mediaGroupId: MediaGroupIdentifier?,
|
||||||
) : this(
|
) : this(
|
||||||
chat, channel, messageId, threadId, date, forwardInfo.messageOrigin(), editDate, hasProtectedContent, replyTo, replyMarkup, content, senderBot, authorSignature, mediaGroupId
|
chat, channel, messageId, threadId, date, forwardInfo.messageOrigin(), editDate, hasProtectedContent, replyTo ?.let { ReplyInfo.Internal(it) }, replyMarkup, content, senderBot, authorSignature, mediaGroupId
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -208,7 +208,7 @@ data class AnonymousForumContentMessageImpl<T : MessageContent>(
|
|||||||
authorSignature: AuthorSignature?,
|
authorSignature: AuthorSignature?,
|
||||||
mediaGroupId: MediaGroupIdentifier?,
|
mediaGroupId: MediaGroupIdentifier?,
|
||||||
) : this(
|
) : this(
|
||||||
chat, messageId, threadId, date, forwardInfo.messageOrigin(), editDate, hasProtectedContent, replyTo, replyMarkup, content, senderBot, authorSignature, mediaGroupId
|
chat, messageId, threadId, date, forwardInfo.messageOrigin(), editDate, hasProtectedContent, replyTo ?.let { ReplyInfo.Internal(it) }, replyMarkup, content, senderBot, authorSignature, mediaGroupId
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -242,6 +242,6 @@ data class CommonForumContentMessageImpl<T : MessageContent>(
|
|||||||
senderBot: CommonBot?,
|
senderBot: CommonBot?,
|
||||||
mediaGroupId: MediaGroupIdentifier?,
|
mediaGroupId: MediaGroupIdentifier?,
|
||||||
) : this(
|
) : this(
|
||||||
chat, messageId, threadId, from, date, forwardInfo.messageOrigin(), editDate, hasProtectedContent, replyTo, replyMarkup, content, senderBot, mediaGroupId
|
chat, messageId, threadId, from, date, forwardInfo.messageOrigin(), editDate, hasProtectedContent, replyTo ?.let { ReplyInfo.Internal(it) }, replyMarkup, content, senderBot, mediaGroupId
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ sealed interface MessageOrigin {
|
|||||||
@Serializable
|
@Serializable
|
||||||
data class User(
|
data class User(
|
||||||
@SerialName(senderUserField)
|
@SerialName(senderUserField)
|
||||||
val user: PreviewUser,
|
val user: dev.inmo.tgbotapi.types.chat.User,
|
||||||
@SerialName(dateField)
|
@SerialName(dateField)
|
||||||
override val date: TelegramDate
|
override val date: TelegramDate
|
||||||
) : MessageOrigin {
|
) : MessageOrigin {
|
||||||
|
@ -38,6 +38,6 @@ data class PrivateContentMessageImpl<T: MessageContent>(
|
|||||||
senderBot: CommonBot?,
|
senderBot: CommonBot?,
|
||||||
mediaGroupId: MediaGroupIdentifier?,
|
mediaGroupId: MediaGroupIdentifier?,
|
||||||
) : this(
|
) : this(
|
||||||
messageId, from, chat, content, date, editDate, hasProtectedContent, forwardInfo.messageOrigin(), replyTo, replyMarkup, senderBot, mediaGroupId
|
messageId, from, chat, content, date, editDate, hasProtectedContent, forwardInfo.messageOrigin(), replyTo ?.let { ReplyInfo.Internal(it) }, replyMarkup, senderBot, mediaGroupId
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package dev.inmo.tgbotapi
|
package dev.inmo.tgbotapi
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.toInputFile
|
import dev.inmo.tgbotapi.requests.abstracts.toInputFile
|
||||||
|
import dev.inmo.tgbotapi.types.files.Photo
|
||||||
import dev.inmo.tgbotapi.types.media.MediaGroupMemberTelegramMediaSerializer
|
import dev.inmo.tgbotapi.types.media.MediaGroupMemberTelegramMediaSerializer
|
||||||
import dev.inmo.tgbotapi.types.files.PhotoSize
|
import dev.inmo.tgbotapi.types.files.PhotoSize
|
||||||
import dev.inmo.tgbotapi.types.message.content.PhotoContent
|
import dev.inmo.tgbotapi.types.message.content.PhotoContent
|
||||||
@ -20,8 +21,10 @@ class SimpleInputFilesTest {
|
|||||||
@Test
|
@Test
|
||||||
fun test_that_creating_of_photo_and_converting_to_input_media_working_correctly() {
|
fun test_that_creating_of_photo_and_converting_to_input_media_working_correctly() {
|
||||||
val photoContent = PhotoContent(
|
val photoContent = PhotoContent(
|
||||||
listOf(
|
Photo(
|
||||||
PhotoSize("example_file_id".toInputFile(), "example_unique_file_id", 100, 100, 100)
|
listOf(
|
||||||
|
PhotoSize("example_file_id".toInputFile(), "example_unique_file_id", 100, 100, 100)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
val inputMedia = photoContent.toMediaGroupMemberTelegramMedia()
|
val inputMedia = photoContent.toMediaGroupMemberTelegramMedia()
|
||||||
|
@ -75,6 +75,7 @@ import dev.inmo.tgbotapi.types.InlineQueries.query.BaseInlineQuery
|
|||||||
import dev.inmo.tgbotapi.types.InlineQueries.query.InlineQuery
|
import dev.inmo.tgbotapi.types.InlineQueries.query.InlineQuery
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.query.LocationInlineQuery
|
import dev.inmo.tgbotapi.types.InlineQueries.query.LocationInlineQuery
|
||||||
import dev.inmo.tgbotapi.types.PrimaryInviteLink
|
import dev.inmo.tgbotapi.types.PrimaryInviteLink
|
||||||
|
import dev.inmo.tgbotapi.types.ReplyInfo
|
||||||
import dev.inmo.tgbotapi.types.SecondaryChatInviteLink
|
import dev.inmo.tgbotapi.types.SecondaryChatInviteLink
|
||||||
import dev.inmo.tgbotapi.types.Username
|
import dev.inmo.tgbotapi.types.Username
|
||||||
import dev.inmo.tgbotapi.types.actions.BotAction
|
import dev.inmo.tgbotapi.types.actions.BotAction
|
||||||
@ -179,9 +180,11 @@ import dev.inmo.tgbotapi.types.files.MaskAnimatedSticker
|
|||||||
import dev.inmo.tgbotapi.types.files.MaskSimpleSticker
|
import dev.inmo.tgbotapi.types.files.MaskSimpleSticker
|
||||||
import dev.inmo.tgbotapi.types.files.MaskSticker
|
import dev.inmo.tgbotapi.types.files.MaskSticker
|
||||||
import dev.inmo.tgbotapi.types.files.MaskVideoSticker
|
import dev.inmo.tgbotapi.types.files.MaskVideoSticker
|
||||||
|
import dev.inmo.tgbotapi.types.files.MediaContentVariant
|
||||||
import dev.inmo.tgbotapi.types.files.MimedMediaFile
|
import dev.inmo.tgbotapi.types.files.MimedMediaFile
|
||||||
import dev.inmo.tgbotapi.types.files.PassportFile
|
import dev.inmo.tgbotapi.types.files.PassportFile
|
||||||
import dev.inmo.tgbotapi.types.files.PathedFile
|
import dev.inmo.tgbotapi.types.files.PathedFile
|
||||||
|
import dev.inmo.tgbotapi.types.files.Photo
|
||||||
import dev.inmo.tgbotapi.types.files.PhotoSize
|
import dev.inmo.tgbotapi.types.files.PhotoSize
|
||||||
import dev.inmo.tgbotapi.types.files.PlayableMediaFile
|
import dev.inmo.tgbotapi.types.files.PlayableMediaFile
|
||||||
import dev.inmo.tgbotapi.types.files.RegularAnimatedSticker
|
import dev.inmo.tgbotapi.types.files.RegularAnimatedSticker
|
||||||
@ -1572,6 +1575,60 @@ public inline fun <T>
|
|||||||
InputMessageContent.ifInputVenueMessageContent(block: (InputVenueMessageContent) -> T): T? =
|
InputMessageContent.ifInputVenueMessageContent(block: (InputVenueMessageContent) -> T): T? =
|
||||||
inputVenueMessageContentOrNull() ?.let(block)
|
inputVenueMessageContentOrNull() ?.let(block)
|
||||||
|
|
||||||
|
public inline fun ReplyInfo.externalOrNull(): ReplyInfo.External? = this as?
|
||||||
|
dev.inmo.tgbotapi.types.ReplyInfo.External
|
||||||
|
|
||||||
|
public inline fun ReplyInfo.externalOrThrow(): ReplyInfo.External = this as
|
||||||
|
dev.inmo.tgbotapi.types.ReplyInfo.External
|
||||||
|
|
||||||
|
public inline fun <T> ReplyInfo.ifExternal(block: (ReplyInfo.External) -> T): T? = externalOrNull()
|
||||||
|
?.let(block)
|
||||||
|
|
||||||
|
public inline fun ReplyInfo.contentOrNull(): ReplyInfo.External.Content? = this as?
|
||||||
|
dev.inmo.tgbotapi.types.ReplyInfo.External.Content
|
||||||
|
|
||||||
|
public inline fun ReplyInfo.contentOrThrow(): ReplyInfo.External.Content = this as
|
||||||
|
dev.inmo.tgbotapi.types.ReplyInfo.External.Content
|
||||||
|
|
||||||
|
public inline fun <T> ReplyInfo.ifContent(block: (ReplyInfo.External.Content) -> T): T? =
|
||||||
|
contentOrNull() ?.let(block)
|
||||||
|
|
||||||
|
public inline fun ReplyInfo.mediaOrNull(): ReplyInfo.External.Content.Media? = this as?
|
||||||
|
dev.inmo.tgbotapi.types.ReplyInfo.External.Content.Media
|
||||||
|
|
||||||
|
public inline fun ReplyInfo.mediaOrThrow(): ReplyInfo.External.Content.Media = this as
|
||||||
|
dev.inmo.tgbotapi.types.ReplyInfo.External.Content.Media
|
||||||
|
|
||||||
|
public inline fun <T> ReplyInfo.ifMedia(block: (ReplyInfo.External.Content.Media) -> T): T? =
|
||||||
|
mediaOrNull() ?.let(block)
|
||||||
|
|
||||||
|
public inline fun ReplyInfo.simpleOrNull(): ReplyInfo.External.Content.Simple? = this as?
|
||||||
|
dev.inmo.tgbotapi.types.ReplyInfo.External.Content.Simple
|
||||||
|
|
||||||
|
public inline fun ReplyInfo.simpleOrThrow(): ReplyInfo.External.Content.Simple = this as
|
||||||
|
dev.inmo.tgbotapi.types.ReplyInfo.External.Content.Simple
|
||||||
|
|
||||||
|
public inline fun <T> ReplyInfo.ifSimple(block: (ReplyInfo.External.Content.Simple) -> T): T? =
|
||||||
|
simpleOrNull() ?.let(block)
|
||||||
|
|
||||||
|
public inline fun ReplyInfo.textOrNull(): ReplyInfo.External.Text? = this as?
|
||||||
|
dev.inmo.tgbotapi.types.ReplyInfo.External.Text
|
||||||
|
|
||||||
|
public inline fun ReplyInfo.textOrThrow(): ReplyInfo.External.Text = this as
|
||||||
|
dev.inmo.tgbotapi.types.ReplyInfo.External.Text
|
||||||
|
|
||||||
|
public inline fun <T> ReplyInfo.ifText(block: (ReplyInfo.External.Text) -> T): T? = textOrNull()
|
||||||
|
?.let(block)
|
||||||
|
|
||||||
|
public inline fun ReplyInfo.internalOrNull(): ReplyInfo.Internal? = this as?
|
||||||
|
dev.inmo.tgbotapi.types.ReplyInfo.Internal
|
||||||
|
|
||||||
|
public inline fun ReplyInfo.internalOrThrow(): ReplyInfo.Internal = this as
|
||||||
|
dev.inmo.tgbotapi.types.ReplyInfo.Internal
|
||||||
|
|
||||||
|
public inline fun <T> ReplyInfo.ifInternal(block: (ReplyInfo.Internal) -> T): T? = internalOrNull()
|
||||||
|
?.let(block)
|
||||||
|
|
||||||
public inline fun BotAction.typingActionOrNull(): TypingAction? = this as?
|
public inline fun BotAction.typingActionOrNull(): TypingAction? = this as?
|
||||||
dev.inmo.tgbotapi.types.actions.TypingAction
|
dev.inmo.tgbotapi.types.actions.TypingAction
|
||||||
|
|
||||||
@ -2385,6 +2442,15 @@ public inline fun TelegramMediaFile.fileOrThrow(): File = this as dev.inmo.tgbot
|
|||||||
|
|
||||||
public inline fun <T> TelegramMediaFile.ifFile(block: (File) -> T): T? = fileOrNull() ?.let(block)
|
public inline fun <T> TelegramMediaFile.ifFile(block: (File) -> T): T? = fileOrNull() ?.let(block)
|
||||||
|
|
||||||
|
public inline fun TelegramMediaFile.mediaContentVariantOrNull(): MediaContentVariant? = this as?
|
||||||
|
dev.inmo.tgbotapi.types.files.MediaContentVariant
|
||||||
|
|
||||||
|
public inline fun TelegramMediaFile.mediaContentVariantOrThrow(): MediaContentVariant = this as
|
||||||
|
dev.inmo.tgbotapi.types.files.MediaContentVariant
|
||||||
|
|
||||||
|
public inline fun <T> TelegramMediaFile.ifMediaContentVariant(block: (MediaContentVariant) -> T): T?
|
||||||
|
= mediaContentVariantOrNull() ?.let(block)
|
||||||
|
|
||||||
public inline fun TelegramMediaFile.mimedMediaFileOrNull(): MimedMediaFile? = this as?
|
public inline fun TelegramMediaFile.mimedMediaFileOrNull(): MimedMediaFile? = this as?
|
||||||
dev.inmo.tgbotapi.types.files.MimedMediaFile
|
dev.inmo.tgbotapi.types.files.MimedMediaFile
|
||||||
|
|
||||||
@ -2412,6 +2478,15 @@ public inline fun TelegramMediaFile.pathedFileOrThrow(): PathedFile = this as
|
|||||||
public inline fun <T> TelegramMediaFile.ifPathedFile(block: (PathedFile) -> T): T? =
|
public inline fun <T> TelegramMediaFile.ifPathedFile(block: (PathedFile) -> T): T? =
|
||||||
pathedFileOrNull() ?.let(block)
|
pathedFileOrNull() ?.let(block)
|
||||||
|
|
||||||
|
public inline fun TelegramMediaFile.photoOrNull(): Photo? = this as?
|
||||||
|
dev.inmo.tgbotapi.types.files.Photo
|
||||||
|
|
||||||
|
public inline fun TelegramMediaFile.photoOrThrow(): Photo = this as
|
||||||
|
dev.inmo.tgbotapi.types.files.Photo
|
||||||
|
|
||||||
|
public inline fun <T> TelegramMediaFile.ifPhoto(block: (Photo) -> T): T? = photoOrNull()
|
||||||
|
?.let(block)
|
||||||
|
|
||||||
public inline fun TelegramMediaFile.photoSizeOrNull(): PhotoSize? = this as?
|
public inline fun TelegramMediaFile.photoSizeOrNull(): PhotoSize? = this as?
|
||||||
dev.inmo.tgbotapi.types.files.PhotoSize
|
dev.inmo.tgbotapi.types.files.PhotoSize
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ inline val AccessibleMessage.is_automatic_forward: Boolean?
|
|||||||
get() = this is ConnectedFromChannelGroupContentMessage<*>
|
get() = this is ConnectedFromChannelGroupContentMessage<*>
|
||||||
@RiskFeature(RawFieldsUsageWarning)
|
@RiskFeature(RawFieldsUsageWarning)
|
||||||
inline val AccessibleMessage.reply_to_message: AccessibleMessage?
|
inline val AccessibleMessage.reply_to_message: AccessibleMessage?
|
||||||
get() = asPossiblyReplyMessage() ?.replyInfo
|
get() = asPossiblyReplyMessage() ?.replyTo
|
||||||
@RiskFeature(RawFieldsUsageWarning)
|
@RiskFeature(RawFieldsUsageWarning)
|
||||||
inline val AccessibleMessage.via_bot: CommonBot?
|
inline val AccessibleMessage.via_bot: CommonBot?
|
||||||
get() = asPossiblySentViaBotCommonMessage() ?.senderBot
|
get() = asPossiblySentViaBotCommonMessage() ?.senderBot
|
||||||
|
Loading…
Reference in New Issue
Block a user