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

deprecations removed

This commit is contained in:
InsanusMokrassar 2021-05-29 14:31:44 +06:00
parent 7825ec3010
commit fe1831fc19
24 changed files with 26 additions and 176 deletions

View File

@ -2,6 +2,8 @@
## 0.35.0 ## 0.35.0
**ALL PREVIOUS DEPRECATIONS HAVE BEEN REMOVED**
* `Common`: * `Common`:
* `Version`: * `Version`:
* `Kotlin`: `1.4.72` -> `1.5.10` * `Kotlin`: `1.4.72` -> `1.5.10`

View File

@ -1,20 +0,0 @@
package dev.inmo.tgbotapi.CommonAbstracts
const val CaptionDeprecation = "Captioned interface and others will be removed soon and not recommended to use"
@Deprecated(CaptionDeprecation)
interface Captioned : Texted {
@Deprecated(CaptionDeprecation)
val caption: String?
get() = text
}
@Deprecated(CaptionDeprecation)
interface CaptionedInput : Captioned, TextedInput {
/**
* Full list of entities. This list WILL contain [TextPart]s with [dev.inmo.tgbotapi.types.MessageEntity.textsources.RegularTextSource]
*/
@Deprecated(CaptionDeprecation)
val captionEntities: List<TextPart>
get() = textEntities
}

View File

@ -1,26 +0,0 @@
package dev.inmo.tgbotapi.CommonAbstracts
@Deprecated("Will be removed soon")
interface Explained : Texted {
val explanation: String?
get() = text
}
@Deprecated("Will be removed soon")
interface ParsableExplainedOutput : Explained, TextedOutput
@Deprecated("Will be removed soon")
interface EntitiesExplainedOutput : Explained, EntitiesOutput
@Deprecated("Will be removed soon")
interface ExplainedOutput : ParsableExplainedOutput, EntitiesExplainedOutput
@Deprecated("Will be removed soon")
interface ExplainedInput : Explained {
val textSources: TextSourcesList
/**
* Full list of entities. This list WILL contain [TextPart]s with [dev.inmo.tgbotapi.types.MessageEntity.textsources.RegularTextSource]
*/
val explanationEntities: List<TextPart>
get() = textSources.toTextParts()
}

View File

@ -66,7 +66,7 @@ fun List<dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource>.separateF
"Replaced", "Replaced",
ReplaceWith("separateForCaption", "dev.inmo.tgbotapi.types.MessageEntity.textsources.separateForCaption") ReplaceWith("separateForCaption", "dev.inmo.tgbotapi.types.MessageEntity.textsources.separateForCaption")
) )
fun List<dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource>.separateForCaption() = separateForCaption() fun List<TextSource>.separateForCaption() = separateForCaption()
/** /**
* This method will prepare [TextSource]s list for messages with [textLength] * This method will prepare [TextSource]s list for messages with [textLength]

View File

@ -356,7 +356,7 @@ data class SendQuizPoll internal constructor(
override val allowSendingWithoutReply: Boolean? = null, override val allowSendingWithoutReply: Boolean? = null,
@SerialName(replyMarkupField) @SerialName(replyMarkupField)
override val replyMarkup: KeyboardMarkup? = null override val replyMarkup: KeyboardMarkup? = null
) : SendPoll(), ExplainedOutput, TextedOutput { ) : SendPoll(), TextedOutput {
override val type: String = quizPollType override val type: String = quizPollType
override val requestSerializer: SerializationStrategy<*> override val requestSerializer: SerializationStrategy<*>
get() = serializer() get() = serializer()

View File

@ -1,7 +1,6 @@
package dev.inmo.tgbotapi.types.ChatMember package dev.inmo.tgbotapi.types.ChatMember
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.ChatMember.abstracts.ChatMember
import dev.inmo.tgbotapi.types.ChatMember.abstracts.LeftChatMember import dev.inmo.tgbotapi.types.ChatMember.abstracts.LeftChatMember
import kotlinx.serialization.* import kotlinx.serialization.*

View File

@ -1,9 +1,6 @@
package dev.inmo.tgbotapi.types.InlineQueries.abstracts package dev.inmo.tgbotapi.types.InlineQueries.abstracts
import dev.inmo.tgbotapi.types.InlineQueries.query.InlineQuery import dev.inmo.tgbotapi.types.InlineQueries.query.InlineQuery
import dev.inmo.tgbotapi.types.InlineQueryIdentifier
import dev.inmo.tgbotapi.types.User
import dev.inmo.tgbotapi.types.chat.ChatType
@Deprecated("Replaced", ReplaceWith("InlineQuery", "dev.inmo.tgbotapi.types.InlineQueries.query.InlineQuery")) @Deprecated("Replaced", ReplaceWith("InlineQuery", "dev.inmo.tgbotapi.types.InlineQueries.query.InlineQuery"))
typealias InlineQuery = InlineQuery typealias InlineQuery = InlineQuery

View File

@ -1,8 +1,6 @@
package dev.inmo.tgbotapi.types.InlineQueries.abstracts package dev.inmo.tgbotapi.types.InlineQueries.abstracts
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContentSerializer
import kotlinx.serialization.Serializable
@Deprecated("Replaced", ReplaceWith("InputMessageContent", "dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent")) @Deprecated("Replaced", ReplaceWith("InputMessageContent", "dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent"))
typealias InputMessageContent = InputMessageContent typealias InputMessageContent = InputMessageContent

View File

@ -28,8 +28,6 @@ internal object BotActionSerializer: KSerializer<BotAction> {
UploadPhotoAction.actionName -> UploadPhotoAction UploadPhotoAction.actionName -> UploadPhotoAction
RecordVideoAction.actionName -> RecordVideoAction RecordVideoAction.actionName -> RecordVideoAction
UploadVideoAction.actionName -> UploadVideoAction UploadVideoAction.actionName -> UploadVideoAction
RecordAudioAction.actionName -> RecordAudioAction
UploadAudioAction.actionName -> UploadAudioAction
RecordVoiceAction.actionName -> RecordVoiceAction RecordVoiceAction.actionName -> RecordVoiceAction
UploadVoiceAction.actionName -> UploadVoiceAction UploadVoiceAction.actionName -> UploadVoiceAction
UploadDocumentAction.actionName -> UploadDocumentAction UploadDocumentAction.actionName -> UploadDocumentAction
@ -85,52 +83,6 @@ inline val uploadVideo
get() = UploadVideoAction get() = UploadVideoAction
inline fun BotAction.asUploadVideo() = this as? UploadVideoAction inline fun BotAction.asUploadVideo() = this as? UploadVideoAction
/**
* Will notify user that bot is recording some audio
*/
@Serializable(BotActionSerializer::class)
@Deprecated(
"Deprecated according to https://core.telegram.org/bots/api-changelog#april-26-2021",
ReplaceWith("RecordVoiceAction", "dev.inmo.tgbotapi.types.actions.RecordVoiceAction")
)
object RecordAudioAction : BotAction {
override val actionName: String = "record_audio"
}
@Deprecated(
"Deprecated according to https://core.telegram.org/bots/api-changelog#april-26-2021",
ReplaceWith("recordVoice", "dev.inmo.tgbotapi.types.actions.recordVoice")
)
inline val recordAudio
get() = RecordAudioAction
@Deprecated(
"Deprecated according to https://core.telegram.org/bots/api-changelog#april-26-2021",
ReplaceWith("asRecordVoice", "dev.inmo.tgbotapi.types.actions.asRecordVoice")
)
inline fun BotAction.asRecordAudio() = this as? RecordAudioAction
/**
* Will notify user that bot is uploading some audio
*/
@Serializable(BotActionSerializer::class)
@Deprecated(
"Deprecated according to https://core.telegram.org/bots/api-changelog#april-26-2021",
ReplaceWith("UploadVoiceAction", "dev.inmo.tgbotapi.types.actions.UploadVoiceAction")
)
object UploadAudioAction : BotAction {
override val actionName: String = "upload_audio"
}
@Deprecated(
"Deprecated according to https://core.telegram.org/bots/api-changelog#april-26-2021",
ReplaceWith("uploadVoice", "dev.inmo.tgbotapi.types.actions.uploadVoice")
)
inline val uploadAudio
get() = UploadAudioAction
@Deprecated(
"Deprecated according to https://core.telegram.org/bots/api-changelog#april-26-2021",
ReplaceWith("asUploadVoice", "dev.inmo.tgbotapi.types.actions.asUploadVoice")
)
inline fun BotAction.asUploadAudio() = this as? UploadAudioAction
/** /**
* Will notify user that bot is recording some audio * Will notify user that bot is recording some audio
*/ */

View File

@ -1,6 +1,5 @@
package dev.inmo.tgbotapi.types.files package dev.inmo.tgbotapi.types.files
import dev.inmo.tgbotapi.CommonAbstracts.TextSourcesList
import dev.inmo.tgbotapi.requests.abstracts.FileId import dev.inmo.tgbotapi.requests.abstracts.FileId
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.InputMedia.InputMediaVideo import dev.inmo.tgbotapi.types.InputMedia.InputMediaVideo

View File

@ -1,6 +1,7 @@
package dev.inmo.tgbotapi.types.games package dev.inmo.tgbotapi.types.games
import dev.inmo.tgbotapi.CommonAbstracts.* import dev.inmo.tgbotapi.CommonAbstracts.*
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
import dev.inmo.tgbotapi.types.files.AnimationFile import dev.inmo.tgbotapi.types.files.AnimationFile
import dev.inmo.tgbotapi.types.files.Photo import dev.inmo.tgbotapi.types.files.Photo
@ -11,4 +12,4 @@ data class Game(
override val text: String? = null, override val text: String? = null,
override val textSources: TextSourcesList = emptyList(), override val textSources: TextSourcesList = emptyList(),
val animation: AnimationFile? = null val animation: AnimationFile? = null
) : Titled, CaptionedInput, TextedInput ) : Titled, TextedInput

View File

@ -1,6 +1,5 @@
package dev.inmo.tgbotapi.types.message.content package dev.inmo.tgbotapi.types.message.content
import dev.inmo.tgbotapi.CommonAbstracts.TextSourcesList
import dev.inmo.tgbotapi.CommonAbstracts.TextedInput import dev.inmo.tgbotapi.CommonAbstracts.TextedInput
import dev.inmo.tgbotapi.requests.abstracts.Request import dev.inmo.tgbotapi.requests.abstracts.Request
import dev.inmo.tgbotapi.requests.send.SendTextMessage import dev.inmo.tgbotapi.requests.send.SendTextMessage

View File

@ -4,7 +4,7 @@ import dev.inmo.tgbotapi.CommonAbstracts.CaptionedInput
import dev.inmo.tgbotapi.CommonAbstracts.TextedInput import dev.inmo.tgbotapi.CommonAbstracts.TextedInput
import dev.inmo.tgbotapi.types.InputMedia.* import dev.inmo.tgbotapi.types.InputMedia.*
interface MediaGroupContent : MediaContent, CaptionedInput, TextedInput { interface MediaGroupContent : MediaContent, TextedInput {
fun toMediaGroupMemberInputMedia(): MediaGroupMemberInputMedia fun toMediaGroupMemberInputMedia(): MediaGroupMemberInputMedia
} }

View File

@ -5,6 +5,7 @@ import dev.inmo.tgbotapi.requests.abstracts.Request
import dev.inmo.tgbotapi.requests.send.media.SendAnimation import dev.inmo.tgbotapi.requests.send.media.SendAnimation
import dev.inmo.tgbotapi.types.ChatIdentifier import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.InputMedia.InputMediaAnimation import dev.inmo.tgbotapi.types.InputMedia.InputMediaAnimation
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
import dev.inmo.tgbotapi.types.MessageIdentifier import dev.inmo.tgbotapi.types.MessageIdentifier
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.files.AnimationFile import dev.inmo.tgbotapi.types.files.AnimationFile
@ -17,7 +18,7 @@ data class AnimationContent(
val includedDocument: DocumentFile?, val includedDocument: DocumentFile?,
override val text: String?, override val text: String?,
override val textSources: TextSourcesList = emptyList() override val textSources: TextSourcesList = emptyList()
) : MediaContent, CaptionedInput, TextedInput { ) : MediaContent, TextedInput {
override fun createResend( override fun createResend(
chatId: ChatIdentifier, chatId: ChatIdentifier,
disableNotification: Boolean, disableNotification: Boolean,

View File

@ -1,6 +1,5 @@
package dev.inmo.tgbotapi.types.message.content.media package dev.inmo.tgbotapi.types.message.content.media
import dev.inmo.tgbotapi.CommonAbstracts.TextSourcesList
import dev.inmo.tgbotapi.requests.abstracts.Request import dev.inmo.tgbotapi.requests.abstracts.Request
import dev.inmo.tgbotapi.requests.send.media.SendAudio import dev.inmo.tgbotapi.requests.send.media.SendAudio
import dev.inmo.tgbotapi.types.ChatIdentifier import dev.inmo.tgbotapi.types.ChatIdentifier

View File

@ -1,12 +1,12 @@
package dev.inmo.tgbotapi.types.message.content.media package dev.inmo.tgbotapi.types.message.content.media
import dev.inmo.tgbotapi.CommonAbstracts.TextSourcesList
import dev.inmo.tgbotapi.CommonAbstracts.TextedInput import dev.inmo.tgbotapi.CommonAbstracts.TextedInput
import dev.inmo.tgbotapi.requests.abstracts.Request import dev.inmo.tgbotapi.requests.abstracts.Request
import dev.inmo.tgbotapi.requests.send.media.SendDocument import dev.inmo.tgbotapi.requests.send.media.SendDocument
import dev.inmo.tgbotapi.types.ChatIdentifier import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.InputMedia.InputMediaDocument import dev.inmo.tgbotapi.types.InputMedia.InputMediaDocument
import dev.inmo.tgbotapi.types.InputMedia.toInputMediaDocument import dev.inmo.tgbotapi.types.InputMedia.toInputMediaDocument
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
import dev.inmo.tgbotapi.types.MessageIdentifier import dev.inmo.tgbotapi.types.MessageIdentifier
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.files.DocumentFile import dev.inmo.tgbotapi.types.files.DocumentFile

View File

@ -1,11 +1,11 @@
package dev.inmo.tgbotapi.types.message.content.media package dev.inmo.tgbotapi.types.message.content.media
import dev.inmo.tgbotapi.CommonAbstracts.TextSourcesList
import dev.inmo.tgbotapi.requests.abstracts.Request import dev.inmo.tgbotapi.requests.abstracts.Request
import dev.inmo.tgbotapi.requests.send.media.SendPhoto import dev.inmo.tgbotapi.requests.send.media.SendPhoto
import dev.inmo.tgbotapi.types.ChatIdentifier import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.InputMedia.InputMediaPhoto import dev.inmo.tgbotapi.types.InputMedia.InputMediaPhoto
import dev.inmo.tgbotapi.types.InputMedia.toInputMediaPhoto import dev.inmo.tgbotapi.types.InputMedia.toInputMediaPhoto
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
import dev.inmo.tgbotapi.types.MessageIdentifier import dev.inmo.tgbotapi.types.MessageIdentifier
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.files.* import dev.inmo.tgbotapi.types.files.*

View File

@ -1,10 +1,10 @@
package dev.inmo.tgbotapi.types.message.content.media package dev.inmo.tgbotapi.types.message.content.media
import dev.inmo.tgbotapi.CommonAbstracts.TextSourcesList
import dev.inmo.tgbotapi.requests.abstracts.Request import dev.inmo.tgbotapi.requests.abstracts.Request
import dev.inmo.tgbotapi.requests.send.media.SendVideo import dev.inmo.tgbotapi.requests.send.media.SendVideo
import dev.inmo.tgbotapi.types.ChatIdentifier import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.InputMedia.InputMediaVideo import dev.inmo.tgbotapi.types.InputMedia.InputMediaVideo
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
import dev.inmo.tgbotapi.types.MessageIdentifier import dev.inmo.tgbotapi.types.MessageIdentifier
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.files.VideoFile import dev.inmo.tgbotapi.types.files.VideoFile

View File

@ -5,6 +5,7 @@ import dev.inmo.tgbotapi.requests.abstracts.Request
import dev.inmo.tgbotapi.requests.send.media.SendVoice import dev.inmo.tgbotapi.requests.send.media.SendVoice
import dev.inmo.tgbotapi.types.ChatIdentifier import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.InputMedia.InputMediaAudio import dev.inmo.tgbotapi.types.InputMedia.InputMediaAudio
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
import dev.inmo.tgbotapi.types.MessageIdentifier import dev.inmo.tgbotapi.types.MessageIdentifier
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.files.VoiceFile import dev.inmo.tgbotapi.types.files.VoiceFile
@ -15,7 +16,7 @@ data class VoiceContent(
override val media: VoiceFile, override val media: VoiceFile,
override val text: String? = null, override val text: String? = null,
override val textSources: TextSourcesList = emptyList() override val textSources: TextSourcesList = emptyList()
) : MediaContent, CaptionedInput, TextedInput { ) : MediaContent, TextedInput {
override fun createResend( override fun createResend(
chatId: ChatIdentifier, chatId: ChatIdentifier,
disableNotification: Boolean, disableNotification: Boolean,

View File

@ -20,8 +20,6 @@ class BotActionTests {
UploadPhotoAction -> example.botAction.actionName UploadPhotoAction -> example.botAction.actionName
RecordVideoAction -> example.botAction.actionName RecordVideoAction -> example.botAction.actionName
UploadVideoAction -> example.botAction.actionName UploadVideoAction -> example.botAction.actionName
RecordAudioAction -> example.botAction.actionName
UploadAudioAction -> example.botAction.actionName
RecordVoiceAction -> example.botAction.actionName RecordVoiceAction -> example.botAction.actionName
UploadVoiceAction -> example.botAction.actionName UploadVoiceAction -> example.botAction.actionName
UploadDocumentAction -> example.botAction.actionName UploadDocumentAction -> example.botAction.actionName
@ -51,8 +49,6 @@ class BotActionTests {
UploadPhotoAction.example(), UploadPhotoAction.example(),
RecordVideoAction.example(), RecordVideoAction.example(),
UploadVideoAction.example(), UploadVideoAction.example(),
RecordAudioAction.example(),
UploadAudioAction.example(),
RecordVoiceAction.example(), RecordVoiceAction.example(),
UploadVoiceAction.example(), UploadVoiceAction.example(),
UploadDocumentAction.example(), UploadDocumentAction.example(),

View File

@ -35,22 +35,6 @@ suspend fun TelegramBot.sendActionUploadVideo(
chatId: ChatIdentifier chatId: ChatIdentifier
) = sendBotAction(chatId, UploadVideoAction) ) = sendBotAction(chatId, UploadVideoAction)
@Deprecated(
"Deprecated according to https://core.telegram.org/bots/api-changelog#april-26-2021",
ReplaceWith("sendActionRecordVoice", "dev.inmo.tgbotapi.extensions.api.send.sendActionRecordVoice")
)
suspend fun TelegramBot.sendActionRecordAudio(
chatId: ChatIdentifier
) = sendBotAction(chatId, RecordAudioAction)
@Deprecated(
"Deprecated according to https://core.telegram.org/bots/api-changelog#april-26-2021",
ReplaceWith("sendActionUploadVoice", "dev.inmo.tgbotapi.extensions.api.send.sendActionUploadVoice")
)
suspend fun TelegramBot.sendActionUploadAudio(
chatId: ChatIdentifier
) = sendBotAction(chatId, UploadAudioAction)
suspend fun TelegramBot.sendActionRecordVoice( suspend fun TelegramBot.sendActionRecordVoice(
chatId: ChatIdentifier chatId: ChatIdentifier
) = sendBotAction(chatId, RecordVoiceAction) ) = sendBotAction(chatId, RecordVoiceAction)
@ -92,22 +76,6 @@ suspend fun TelegramBot.sendActionUploadVideo(
chat: Chat chat: Chat
) = sendBotAction(chat, UploadVideoAction) ) = sendBotAction(chat, UploadVideoAction)
@Deprecated(
"Deprecated according to https://core.telegram.org/bots/api-changelog#april-26-2021",
ReplaceWith("sendActionRecordVoice", "dev.inmo.tgbotapi.extensions.api.send.sendActionRecordVoice")
)
suspend fun TelegramBot.sendActionRecordAudio(
chat: Chat
) = sendBotAction(chat, RecordAudioAction)
@Deprecated(
"Deprecated according to https://core.telegram.org/bots/api-changelog#april-26-2021",
ReplaceWith("sendActionUploadVoice", "dev.inmo.tgbotapi.extensions.api.send.sendActionUploadVoice")
)
suspend fun TelegramBot.sendActionUploadAudio(
chat: Chat
) = sendBotAction(chat, UploadAudioAction)
suspend fun TelegramBot.sendActionRecordVoice( suspend fun TelegramBot.sendActionRecordVoice(
chat: Chat chat: Chat
) = sendBotAction(chat, RecordVoiceAction) ) = sendBotAction(chat, RecordVoiceAction)

View File

@ -56,16 +56,6 @@ suspend fun <T> TelegramBot.withTypingAction(chatId: ChatId, block: TelegramBotA
suspend fun <T> TelegramBot.withUploadPhotoAction(chatId: ChatId, block: TelegramBotActionCallback<T>) = withAction(chatId, UploadPhotoAction, block) suspend fun <T> TelegramBot.withUploadPhotoAction(chatId: ChatId, block: TelegramBotActionCallback<T>) = withAction(chatId, UploadPhotoAction, block)
suspend fun <T> TelegramBot.withRecordVideoAction(chatId: ChatId, block: TelegramBotActionCallback<T>) = withAction(chatId, RecordVideoAction, block) suspend fun <T> TelegramBot.withRecordVideoAction(chatId: ChatId, block: TelegramBotActionCallback<T>) = withAction(chatId, RecordVideoAction, block)
suspend fun <T> TelegramBot.withUploadVideoAction(chatId: ChatId, block: TelegramBotActionCallback<T>) = withAction(chatId, UploadVideoAction, block) suspend fun <T> TelegramBot.withUploadVideoAction(chatId: ChatId, block: TelegramBotActionCallback<T>) = withAction(chatId, UploadVideoAction, block)
@Deprecated(
"Deprecated according to https://core.telegram.org/bots/api-changelog#april-26-2021",
ReplaceWith("withRecordVoiceAction", "dev.inmo.tgbotapi.extensions.api.send.withRecordVoiceAction")
)
suspend fun <T> TelegramBot.withRecordAudioAction(chatId: ChatId, block: TelegramBotActionCallback<T>) = withAction(chatId, RecordAudioAction, block)
@Deprecated(
"Deprecated according to https://core.telegram.org/bots/api-changelog#april-26-2021",
ReplaceWith("withUploadVoiceAction", "dev.inmo.tgbotapi.extensions.api.send.withUploadVoiceAction")
)
suspend fun <T> TelegramBot.withUploadAudioAction(chatId: ChatId, block: TelegramBotActionCallback<T>) = withAction(chatId, UploadAudioAction, block)
suspend fun <T> TelegramBot.withRecordVoiceAction(chatId: ChatId, block: TelegramBotActionCallback<T>) = withAction(chatId, RecordVoiceAction, block) suspend fun <T> TelegramBot.withRecordVoiceAction(chatId: ChatId, block: TelegramBotActionCallback<T>) = withAction(chatId, RecordVoiceAction, block)
suspend fun <T> TelegramBot.withUploadVoiceAction(chatId: ChatId, block: TelegramBotActionCallback<T>) = withAction(chatId, UploadVoiceAction, block) suspend fun <T> TelegramBot.withUploadVoiceAction(chatId: ChatId, block: TelegramBotActionCallback<T>) = withAction(chatId, UploadVoiceAction, block)
suspend fun <T> TelegramBot.withUploadDocumentAction(chatId: ChatId, block: TelegramBotActionCallback<T>) = withAction(chatId, UploadDocumentAction, block) suspend fun <T> TelegramBot.withUploadDocumentAction(chatId: ChatId, block: TelegramBotActionCallback<T>) = withAction(chatId, UploadDocumentAction, block)
@ -78,16 +68,6 @@ suspend fun <T> TelegramBot.withTypingAction(chat: Chat, block: TelegramBotActio
suspend fun <T> TelegramBot.withUploadPhotoAction(chat: Chat, block: TelegramBotActionCallback<T>) = withAction(chat, UploadPhotoAction, block) suspend fun <T> TelegramBot.withUploadPhotoAction(chat: Chat, block: TelegramBotActionCallback<T>) = withAction(chat, UploadPhotoAction, block)
suspend fun <T> TelegramBot.withRecordVideoAction(chat: Chat, block: TelegramBotActionCallback<T>) = withAction(chat, RecordVideoAction, block) suspend fun <T> TelegramBot.withRecordVideoAction(chat: Chat, block: TelegramBotActionCallback<T>) = withAction(chat, RecordVideoAction, block)
suspend fun <T> TelegramBot.withUploadVideoAction(chat: Chat, block: TelegramBotActionCallback<T>) = withAction(chat, UploadVideoAction, block) suspend fun <T> TelegramBot.withUploadVideoAction(chat: Chat, block: TelegramBotActionCallback<T>) = withAction(chat, UploadVideoAction, block)
@Deprecated(
"Deprecated according to https://core.telegram.org/bots/api-changelog#april-26-2021",
ReplaceWith("withRecordVoiceAction", "dev.inmo.tgbotapi.extensions.api.send.withRecordVoiceAction")
)
suspend fun <T> TelegramBot.withRecordAudioAction(chat: Chat, block: TelegramBotActionCallback<T>) = withAction(chat, RecordAudioAction, block)
@Deprecated(
"Deprecated according to https://core.telegram.org/bots/api-changelog#april-26-2021",
ReplaceWith("withUploadVoiceAction", "dev.inmo.tgbotapi.extensions.api.send.withUploadVoiceAction")
)
suspend fun <T> TelegramBot.withUploadAudioAction(chat: Chat, block: TelegramBotActionCallback<T>) = withAction(chat, UploadAudioAction, block)
suspend fun <T> TelegramBot.withRecordVoiceAction(chat: Chat, block: TelegramBotActionCallback<T>) = withAction(chat, RecordVoiceAction, block) suspend fun <T> TelegramBot.withRecordVoiceAction(chat: Chat, block: TelegramBotActionCallback<T>) = withAction(chat, RecordVoiceAction, block)
suspend fun <T> TelegramBot.withUploadVoiceAction(chat: Chat, block: TelegramBotActionCallback<T>) = withAction(chat, UploadVoiceAction, block) suspend fun <T> TelegramBot.withUploadVoiceAction(chat: Chat, block: TelegramBotActionCallback<T>) = withAction(chat, UploadVoiceAction, block)
suspend fun <T> TelegramBot.withUploadDocumentAction(chat: Chat, block: TelegramBotActionCallback<T>) = withAction(chat, UploadDocumentAction, block) suspend fun <T> TelegramBot.withUploadDocumentAction(chat: Chat, block: TelegramBotActionCallback<T>) = withAction(chat, UploadDocumentAction, block)

View File

@ -7,6 +7,7 @@ import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.CallbackQuery.* import dev.inmo.tgbotapi.types.CallbackQuery.*
import dev.inmo.tgbotapi.types.ChatMember.* import dev.inmo.tgbotapi.types.ChatMember.*
import dev.inmo.tgbotapi.types.ChatMember.abstracts.* import dev.inmo.tgbotapi.types.ChatMember.abstracts.*
import dev.inmo.tgbotapi.types.ChatMember.abstracts.MemberChatMember
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.* import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.*
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.* import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.*
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.audio.* import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.audio.*
@ -23,6 +24,8 @@ import dev.inmo.tgbotapi.types.InlineQueries.query.BaseInlineQuery
import dev.inmo.tgbotapi.types.InlineQueries.query.LocationInlineQuery import dev.inmo.tgbotapi.types.InlineQueries.query.LocationInlineQuery
import dev.inmo.tgbotapi.types.InputMedia.* import dev.inmo.tgbotapi.types.InputMedia.*
import dev.inmo.tgbotapi.types.MessageEntity.textsources.* import dev.inmo.tgbotapi.types.MessageEntity.textsources.*
import dev.inmo.tgbotapi.types.MessageEntity.textsources.MultilevelTextSource
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource
import dev.inmo.tgbotapi.types.actions.* import dev.inmo.tgbotapi.types.actions.*
import dev.inmo.tgbotapi.types.buttons.* import dev.inmo.tgbotapi.types.buttons.*
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons.* import dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons.*
@ -521,10 +524,6 @@ inline fun BotAction.asFindLocationAction(): FindLocationAction? = this as? Find
@PreviewFeature @PreviewFeature
inline fun BotAction.requireFindLocationAction(): FindLocationAction = this as FindLocationAction inline fun BotAction.requireFindLocationAction(): FindLocationAction = this as FindLocationAction
@PreviewFeature @PreviewFeature
inline fun BotAction.asRecordAudioAction(): RecordAudioAction? = this as? RecordAudioAction
@PreviewFeature
inline fun BotAction.requireRecordAudioAction(): RecordAudioAction = this as RecordAudioAction
@PreviewFeature
inline fun BotAction.asRecordVoiceAction(): RecordVoiceAction? = this as? RecordVoiceAction inline fun BotAction.asRecordVoiceAction(): RecordVoiceAction? = this as? RecordVoiceAction
@PreviewFeature @PreviewFeature
inline fun BotAction.requireRecordVoiceAction(): RecordVoiceAction = this as RecordVoiceAction inline fun BotAction.requireRecordVoiceAction(): RecordVoiceAction = this as RecordVoiceAction
@ -541,10 +540,6 @@ inline fun BotAction.asTypingAction(): TypingAction? = this as? TypingAction
@PreviewFeature @PreviewFeature
inline fun BotAction.requireTypingAction(): TypingAction = this as TypingAction inline fun BotAction.requireTypingAction(): TypingAction = this as TypingAction
@PreviewFeature @PreviewFeature
inline fun BotAction.asUploadAudioAction(): UploadAudioAction? = this as? UploadAudioAction
@PreviewFeature
inline fun BotAction.requireUploadAudioAction(): UploadAudioAction = this as UploadAudioAction
@PreviewFeature
inline fun BotAction.asUploadVoiceAction(): UploadVoiceAction? = this as? UploadVoiceAction inline fun BotAction.asUploadVoiceAction(): UploadVoiceAction? = this as? UploadVoiceAction
@PreviewFeature @PreviewFeature
inline fun BotAction.requireUploadVoiceAction(): UploadVoiceAction = this as UploadVoiceAction inline fun BotAction.requireUploadVoiceAction(): UploadVoiceAction = this as UploadVoiceAction

View File

@ -55,18 +55,21 @@ fun TextSourcesList.toMarkdownCaptions(): List<String> = createMarkdownText(
this, this,
captionLength.last captionLength.last
) )
fun CaptionedInput.toMarkdownCaptions(): List<String> = textSources.toMarkdownCaptions() fun CaptionedInput.toMarkdownCaptions(): List<String> = textSources.toMarkdownCaptions()
fun TextSourcesList.toMarkdownTexts(): List<String> = createMarkdownText( fun TextSourcesList.toMarkdownTexts(): List<String> = createMarkdownText(
this, this,
textLength.last textLength.last
) )
fun TextContent.toMarkdownTexts(): List<String> = textSources.toMarkdownTexts() fun TextContent.toMarkdownTexts(): List<String> = textSources.toMarkdownTexts()
fun TextSourcesList.toMarkdownExplanations(): List<String> = createMarkdownText( fun TextSourcesList.toMarkdownExplanations(): List<String> = createMarkdownText(
this, this,
explanationLimit.last explanationLimit.last
) )
fun ExplainedInput.toMarkdownExplanations(): List<String> = textSources.toMarkdownTexts() fun ExplainedInput.toMarkdownExplanations(): List<String> = textSources.toMarkdownTexts()
@ -79,18 +82,21 @@ fun TextSourcesList.toMarkdownV2Captions(): List<String> = createMarkdownV2Text(
this, this,
captionLength.last captionLength.last
) )
fun CaptionedInput.toMarkdownV2Captions(): List<String> = textSources.toMarkdownV2Captions() fun CaptionedInput.toMarkdownV2Captions(): List<String> = textSources.toMarkdownV2Captions()
fun TextSourcesList.toMarkdownV2Texts(): List<String> = createMarkdownV2Text( fun TextSourcesList.toMarkdownV2Texts(): List<String> = createMarkdownV2Text(
this, this,
textLength.last textLength.last
) )
fun TextContent.toMarkdownV2Texts(): List<String> = textSources.toMarkdownV2Texts() fun TextContent.toMarkdownV2Texts(): List<String> = textSources.toMarkdownV2Texts()
fun TextSourcesList.toMarkdownV2Explanations(): List<String> = createMarkdownV2Text( fun TextSourcesList.toMarkdownV2Explanations(): List<String> = createMarkdownV2Text(
this, this,
explanationLimit.last explanationLimit.last
) )
fun ExplainedInput.toMarkdownV2Explanations(): List<String> = textSources.toMarkdownV2Texts() fun ExplainedInput.toMarkdownV2Explanations(): List<String> = textSources.toMarkdownV2Texts()
@ -103,18 +109,21 @@ fun TextSourcesList.toHtmlCaptions(): List<String> = createHtmlText(
this, this,
captionLength.last captionLength.last
) )
fun CaptionedInput.toHtmlCaptions(): List<String> = textSources.toHtmlCaptions() fun CaptionedInput.toHtmlCaptions(): List<String> = textSources.toHtmlCaptions()
fun TextSourcesList.toHtmlTexts(): List<String> = createHtmlText( fun TextSourcesList.toHtmlTexts(): List<String> = createHtmlText(
this, this,
textLength.last textLength.last
) )
fun TextContent.toHtmlTexts(): List<String> = textSources.toHtmlTexts() fun TextContent.toHtmlTexts(): List<String> = textSources.toHtmlTexts()
fun TextSourcesList.toHtmlExplanations(): List<String> = createHtmlText( fun TextSourcesList.toHtmlExplanations(): List<String> = createHtmlText(
this, this,
explanationLimit.last explanationLimit.last
) )
fun ExplainedInput.toHtmlExplanations(): List<String> = textSources.toHtmlTexts() fun ExplainedInput.toHtmlExplanations(): List<String> = textSources.toHtmlTexts()