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

record_voice and upload_voice

This commit is contained in:
InsanusMokrassar 2021-04-26 20:52:20 +06:00
parent df63ccfe07
commit b2770e3ecc
4 changed files with 50 additions and 0 deletions

View File

@ -101,6 +101,28 @@ inline val uploadAudio
get() = UploadAudioAction
inline fun BotAction.asUploadAudio() = this as? UploadAudioAction
/**
* Will notify user that bot is recording some audio
*/
@Serializable(BotActionSerializer::class)
object RecordVoiceAction : BotAction() {
override val actionName: String = "record_voice"
}
inline val recordVoice
get() = RecordVoiceAction
inline fun BotAction.asRecordVoice() = this as? RecordVoiceAction
/**
* Will notify user that bot is uploading some audio
*/
@Serializable(BotActionSerializer::class)
object UploadVoiceAction : BotAction() {
override val actionName: String = "upload_voice"
}
inline val uploadVoice
get() = UploadVoiceAction
inline fun BotAction.asUploadVoice() = this as? UploadVoiceAction
/**
* Will notify user that bot is uploading some document
*/

View File

@ -43,6 +43,14 @@ suspend fun TelegramBot.sendActionUploadAudio(
chatId: ChatIdentifier
) = sendBotAction(chatId, UploadAudioAction)
suspend fun TelegramBot.sendActionRecordVoice(
chatId: ChatIdentifier
) = sendBotAction(chatId, RecordVoiceAction)
suspend fun TelegramBot.sendActionUploadVoice(
chatId: ChatIdentifier
) = sendBotAction(chatId, UploadVoiceAction)
suspend fun TelegramBot.sendActionUploadDocument(
chatId: ChatIdentifier
) = sendBotAction(chatId, UploadDocumentAction)
@ -84,6 +92,14 @@ suspend fun TelegramBot.sendActionUploadAudio(
chat: Chat
) = sendBotAction(chat, UploadAudioAction)
suspend fun TelegramBot.sendActionRecordVoice(
chat: Chat
) = sendBotAction(chat, RecordVoiceAction)
suspend fun TelegramBot.sendActionUploadVoice(
chat: Chat
) = sendBotAction(chat, UploadVoiceAction)
suspend fun TelegramBot.sendActionUploadDocument(
chat: Chat
) = sendBotAction(chat, UploadDocumentAction)

View File

@ -58,6 +58,8 @@ suspend fun <T> TelegramBot.withRecordVideoAction(chatId: ChatId, block: Telegra
suspend fun <T> TelegramBot.withUploadVideoAction(chatId: ChatId, block: TelegramBotActionCallback<T>) = withAction(chatId, UploadVideoAction, block)
suspend fun <T> TelegramBot.withRecordAudioAction(chatId: ChatId, block: TelegramBotActionCallback<T>) = withAction(chatId, RecordAudioAction, block)
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)
suspend fun <T> TelegramBot.withUploadDocumentAction(chatId: ChatId, block: TelegramBotActionCallback<T>) = withAction(chatId, UploadDocumentAction, block)
suspend fun <T> TelegramBot.withFindLocationAction(chatId: ChatId, block: TelegramBotActionCallback<T>) = withAction(chatId, FindLocationAction, block)
suspend fun <T> TelegramBot.withRecordVideoNoteAction(chatId: ChatId, block: TelegramBotActionCallback<T>) = withAction(chatId, RecordVideoNoteAction, block)
@ -70,6 +72,8 @@ suspend fun <T> TelegramBot.withRecordVideoAction(chat: Chat, block: TelegramBot
suspend fun <T> TelegramBot.withUploadVideoAction(chat: Chat, block: TelegramBotActionCallback<T>) = withAction(chat, UploadVideoAction, block)
suspend fun <T> TelegramBot.withRecordAudioAction(chat: Chat, block: TelegramBotActionCallback<T>) = withAction(chat, RecordAudioAction, block)
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)
suspend fun <T> TelegramBot.withUploadDocumentAction(chat: Chat, block: TelegramBotActionCallback<T>) = withAction(chat, UploadDocumentAction, block)
suspend fun <T> TelegramBot.withFindLocationAction(chat: Chat, block: TelegramBotActionCallback<T>) = withAction(chat, FindLocationAction, block)
suspend fun <T> TelegramBot.withRecordVideoNoteAction(chat: Chat, block: TelegramBotActionCallback<T>) = withAction(chat, RecordVideoNoteAction, block)

View File

@ -525,6 +525,10 @@ inline fun BotAction.asRecordAudioAction(): RecordAudioAction? = this as? Record
@PreviewFeature
inline fun BotAction.requireRecordAudioAction(): RecordAudioAction = this as RecordAudioAction
@PreviewFeature
inline fun BotAction.asRecordVoiceAction(): RecordVoiceAction? = this as? RecordVoiceAction
@PreviewFeature
inline fun BotAction.requireRecordVoiceAction(): RecordVoiceAction = this as RecordVoiceAction
@PreviewFeature
inline fun BotAction.asRecordVideoAction(): RecordVideoAction? = this as? RecordVideoAction
@PreviewFeature
inline fun BotAction.requireRecordVideoAction(): RecordVideoAction = this as RecordVideoAction
@ -541,6 +545,10 @@ inline fun BotAction.asUploadAudioAction(): UploadAudioAction? = this as? Upload
@PreviewFeature
inline fun BotAction.requireUploadAudioAction(): UploadAudioAction = this as UploadAudioAction
@PreviewFeature
inline fun BotAction.asUploadVoiceAction(): UploadVoiceAction? = this as? UploadVoiceAction
@PreviewFeature
inline fun BotAction.requireUploadVoiceAction(): UploadVoiceAction = this as UploadVoiceAction
@PreviewFeature
inline fun BotAction.asUploadDocumentAction(): UploadDocumentAction? = this as? UploadDocumentAction
@PreviewFeature
inline fun BotAction.requireUploadDocumentAction(): UploadDocumentAction = this as UploadDocumentAction