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

deprecation of an old record audio and upload audio bot actions

This commit is contained in:
InsanusMokrassar 2021-04-26 21:02:11 +06:00
parent b2770e3ecc
commit 87071ca52c
3 changed files with 58 additions and 0 deletions

View File

@ -26,6 +26,8 @@ internal object BotActionSerializer: KSerializer<BotAction> {
UploadVideoAction.actionName -> UploadVideoAction
RecordAudioAction.actionName -> RecordAudioAction
UploadAudioAction.actionName -> UploadAudioAction
RecordVoiceAction.actionName -> RecordVoiceAction
UploadVoiceAction.actionName -> UploadVoiceAction
UploadDocumentAction.actionName -> UploadDocumentAction
FindLocationAction.actionName -> FindLocationAction
RecordVideoNoteAction.actionName -> RecordVideoNoteAction
@ -83,22 +85,46 @@ 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
/**

View File

@ -35,10 +35,18 @@ suspend fun TelegramBot.sendActionUploadVideo(
chatId: ChatIdentifier
) = 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)
@ -84,10 +92,18 @@ suspend fun TelegramBot.sendActionUploadVideo(
chat: Chat
) = 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)

View File

@ -56,7 +56,15 @@ 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.withRecordVideoAction(chatId: ChatId, block: TelegramBotActionCallback<T>) = withAction(chatId, RecordVideoAction, 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.withUploadVoiceAction(chatId: ChatId, block: TelegramBotActionCallback<T>) = withAction(chatId, UploadVoiceAction, block)
@ -70,7 +78,15 @@ 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.withRecordVideoAction(chat: Chat, block: TelegramBotActionCallback<T>) = withAction(chat, RecordVideoAction, 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.withUploadVoiceAction(chat: Chat, block: TelegramBotActionCallback<T>) = withAction(chat, UploadVoiceAction, block)