diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/TextContent.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/TextContent.kt index 005aece25d..370d79eeb5 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/TextContent.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/TextContent.kt @@ -23,7 +23,7 @@ data class TextContent( replyMarkup: KeyboardMarkup? ): Request = SendMessage( chatId, - toMarkdownText(), + toMarkdownTexts().first(), MarkdownParseMode, false, disableNotification, diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/AudioContent.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/AudioContent.kt index e9aa329313..204a371a47 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/AudioContent.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/AudioContent.kt @@ -11,7 +11,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.files.AudioFile import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.CaptionedMediaContent import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaContent -import com.github.insanusmokrassar.TelegramBotAPI.utils.toMarkdownCaption +import com.github.insanusmokrassar.TelegramBotAPI.utils.toMarkdownCaptions data class AudioContent( override val media: AudioFile, @@ -27,7 +27,7 @@ data class AudioContent( chatId, media.fileId, media.thumb ?.fileId, - toMarkdownCaption(), + toMarkdownCaptions().firstOrNull(), MarkdownParseMode, media.duration, media.performer, diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/DocumentContent.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/DocumentContent.kt index 1ceed1fa24..73e79fde97 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/DocumentContent.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/DocumentContent.kt @@ -11,7 +11,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.files.DocumentFile import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.CaptionedMediaContent import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaContent -import com.github.insanusmokrassar.TelegramBotAPI.utils.toMarkdownCaption +import com.github.insanusmokrassar.TelegramBotAPI.utils.toMarkdownCaptions data class DocumentContent( override val media: DocumentFile, @@ -27,7 +27,7 @@ data class DocumentContent( chatId, media.fileId, media.thumb ?.fileId, - toMarkdownCaption(), + toMarkdownCaptions().firstOrNull(), MarkdownParseMode, disableNotification, replyToMessageId, diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/PhotoContent.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/PhotoContent.kt index 3b62698857..3a15314fb5 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/PhotoContent.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/PhotoContent.kt @@ -13,7 +13,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.files.PhotoSize import com.github.insanusmokrassar.TelegramBotAPI.types.files.biggest import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.* -import com.github.insanusmokrassar.TelegramBotAPI.utils.toMarkdownCaption +import com.github.insanusmokrassar.TelegramBotAPI.utils.toMarkdownCaptions data class PhotoContent( override val media: List, @@ -28,7 +28,7 @@ data class PhotoContent( ): Request = SendPhoto( chatId, media.biggest() ?.fileId ?: throw IllegalStateException("Empty list of media"), - toMarkdownCaption(), + toMarkdownCaptions().firstOrNull(), MarkdownParseMode, disableNotification, replyToMessageId, @@ -37,7 +37,7 @@ data class PhotoContent( override fun toMediaGroupMemberInputMedia(): MediaGroupMemberInputMedia = InputMediaPhoto( media.biggest() ?.fileId ?: throw IllegalStateException("Can't locate any photo size for this content"), - toMarkdownCaption(), + toMarkdownCaptions().firstOrNull(), MarkdownParseMode ) } diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/VideoContent.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/VideoContent.kt index 3312be91f0..44db88818c 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/VideoContent.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/VideoContent.kt @@ -12,7 +12,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup import com.github.insanusmokrassar.TelegramBotAPI.types.files.VideoFile import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.* -import com.github.insanusmokrassar.TelegramBotAPI.utils.toMarkdownCaption +import com.github.insanusmokrassar.TelegramBotAPI.utils.toMarkdownCaptions data class VideoContent( override val media: VideoFile, @@ -28,7 +28,7 @@ data class VideoContent( chatId, media.fileId, media.thumb ?.fileId, - toMarkdownCaption(), + toMarkdownCaptions().firstOrNull(), MarkdownParseMode, media.duration, media.width, @@ -41,7 +41,7 @@ data class VideoContent( override fun toMediaGroupMemberInputMedia(): MediaGroupMemberInputMedia = InputMediaVideo( media.fileId, - toMarkdownCaption(), + toMarkdownCaptions().firstOrNull(), MarkdownParseMode, media.width, media.height, diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/VoiceContent.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/VoiceContent.kt index b61c4fc2cd..86f1fba9b7 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/VoiceContent.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/VoiceContent.kt @@ -11,7 +11,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.files.VoiceFile import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.CaptionedMediaContent import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaContent -import com.github.insanusmokrassar.TelegramBotAPI.utils.toMarkdownCaption +import com.github.insanusmokrassar.TelegramBotAPI.utils.toMarkdownCaptions data class VoiceContent( override val media: VoiceFile, @@ -27,7 +27,7 @@ data class VoiceContent( chatId, media.fileId, null, - toMarkdownCaption(), + toMarkdownCaptions().firstOrNull(), MarkdownParseMode, media.duration, disableNotification, diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/CaptionSourcer.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/CaptionSourcer.kt index ab354a2b0b..336496dcd2 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/CaptionSourcer.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/CaptionSourcer.kt @@ -55,7 +55,11 @@ fun createMarkdownText( } @Deprecated( - "Deprecated because old version have problem with long texts, but new one must return list of strings" + "Deprecated because old version have problem with long texts, but new one must return list of strings", + ReplaceWith( + "toMarkdownCaptions().firstOrNull()", + "com.github.insanusmokrassar.TelegramBotAPI.utils.toMarkdownCaptions" + ) ) fun CaptionedMediaContent.toMarkdownCaption(): String? = toMarkdownCaptions().firstOrNull() @@ -69,7 +73,11 @@ fun CaptionedMediaContent.fullEntitiesList(): List = caption ?.le } ?: emptyList() @Deprecated( - "Deprecated because old version have problem with long texts, but new one must return list of strings" + "Deprecated because old version have problem with long texts, but new one must return list of strings", + ReplaceWith( + "toMarkdownTexts().first()", + "com.github.insanusmokrassar.TelegramBotAPI.utils.toMarkdownTexts" + ) ) fun TextContent.toMarkdownText(): String = toMarkdownTexts().first()