1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-06-18 07:45:27 +00:00
tgbotapi/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/SendAction.kt

132 lines
4.3 KiB
Kotlin
Raw Normal View History

package dev.inmo.tgbotapi.extensions.api.send
2020-02-15 09:33:04 +00:00
2020-10-04 11:06:30 +00:00
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.send.SendAction
import dev.inmo.tgbotapi.types.ChatIdentifier
2022-12-30 14:49:47 +00:00
import dev.inmo.tgbotapi.types.MessageThreadId
2020-10-04 11:06:30 +00:00
import dev.inmo.tgbotapi.types.actions.*
2022-04-21 18:16:41 +00:00
import dev.inmo.tgbotapi.types.chat.Chat
2022-12-30 14:49:47 +00:00
import dev.inmo.tgbotapi.types.threadId
2020-02-15 09:33:04 +00:00
suspend fun TelegramBot.sendBotAction(
2020-02-15 09:33:04 +00:00
chatId: ChatIdentifier,
2022-12-30 14:49:47 +00:00
action: BotAction,
threadId: MessageThreadId? = chatId.threadId
2020-02-15 09:33:04 +00:00
) = execute(
2022-12-30 14:49:47 +00:00
SendAction(chatId, action, threadId)
2020-02-15 09:33:04 +00:00
)
suspend fun TelegramBot.sendBotAction(
2020-02-15 09:33:04 +00:00
chat: Chat,
2022-12-30 14:49:47 +00:00
action: BotAction,
threadId: MessageThreadId? = chat.id.threadId
) = sendBotAction(chat.id, action, threadId)
2020-02-15 09:33:04 +00:00
suspend fun TelegramBot.sendActionTyping(
2022-12-30 14:49:47 +00:00
chatId: ChatIdentifier,
threadId: MessageThreadId? = chatId.threadId
) = sendBotAction(chatId, TypingAction, threadId)
2020-02-15 09:33:04 +00:00
suspend fun TelegramBot.sendActionUploadPhoto(
2022-12-30 14:49:47 +00:00
chatId: ChatIdentifier,
threadId: MessageThreadId? = chatId.threadId
) = sendBotAction(chatId, UploadPhotoAction, threadId)
2020-02-15 09:33:04 +00:00
suspend fun TelegramBot.sendActionRecordVideo(
2022-12-30 14:49:47 +00:00
chatId: ChatIdentifier,
threadId: MessageThreadId? = chatId.threadId
) = sendBotAction(chatId, RecordVideoAction, threadId)
2020-02-15 09:33:04 +00:00
suspend fun TelegramBot.sendActionUploadVideo(
2022-12-30 14:49:47 +00:00
chatId: ChatIdentifier,
threadId: MessageThreadId? = chatId.threadId
) = sendBotAction(chatId, UploadVideoAction, threadId)
2020-02-15 09:33:04 +00:00
2021-04-26 14:52:20 +00:00
suspend fun TelegramBot.sendActionRecordVoice(
2022-12-30 14:49:47 +00:00
chatId: ChatIdentifier,
threadId: MessageThreadId? = chatId.threadId
) = sendBotAction(chatId, RecordVoiceAction, threadId)
2021-04-26 14:52:20 +00:00
suspend fun TelegramBot.sendActionUploadVoice(
2022-12-30 14:49:47 +00:00
chatId: ChatIdentifier,
threadId: MessageThreadId? = chatId.threadId
) = sendBotAction(chatId, UploadVoiceAction, threadId)
2021-04-26 14:52:20 +00:00
suspend fun TelegramBot.sendActionUploadDocument(
2022-12-30 14:49:47 +00:00
chatId: ChatIdentifier,
threadId: MessageThreadId? = chatId.threadId
) = sendBotAction(chatId, UploadDocumentAction, threadId)
2020-02-15 09:33:04 +00:00
suspend fun TelegramBot.sendActionFindLocation(
2022-12-30 14:49:47 +00:00
chatId: ChatIdentifier,
threadId: MessageThreadId? = chatId.threadId
) = sendBotAction(chatId, FindLocationAction, threadId)
2020-02-15 09:33:04 +00:00
suspend fun TelegramBot.sendActionRecordVideoNote(
2022-12-30 14:49:47 +00:00
chatId: ChatIdentifier,
threadId: MessageThreadId? = chatId.threadId
) = sendBotAction(chatId, RecordVideoNoteAction, threadId)
2020-02-15 09:33:04 +00:00
suspend fun TelegramBot.sendActionUploadVideoNote(
2022-12-30 14:49:47 +00:00
chatId: ChatIdentifier,
threadId: MessageThreadId? = chatId.threadId
) = sendBotAction(chatId, UploadVideoNoteAction, threadId)
2020-02-15 09:33:04 +00:00
suspend fun TelegramBot.sendActionTyping(
2022-12-30 14:49:47 +00:00
chat: Chat,
threadId: MessageThreadId? = chat.id.threadId
) = sendBotAction(chat, TypingAction, threadId)
2020-02-15 09:33:04 +00:00
suspend fun TelegramBot.sendActionUploadPhoto(
2022-12-30 14:49:47 +00:00
chat: Chat,
threadId: MessageThreadId? = chat.id.threadId
) = sendBotAction(chat, UploadPhotoAction, threadId)
2020-02-15 09:33:04 +00:00
suspend fun TelegramBot.sendActionRecordVideo(
2022-12-30 14:49:47 +00:00
chat: Chat,
threadId: MessageThreadId? = chat.id.threadId
) = sendBotAction(chat, RecordVideoAction, threadId)
2020-02-15 09:33:04 +00:00
suspend fun TelegramBot.sendActionUploadVideo(
2022-12-30 14:49:47 +00:00
chat: Chat,
threadId: MessageThreadId? = chat.id.threadId
) = sendBotAction(chat, UploadVideoAction, threadId)
2020-02-15 09:33:04 +00:00
2021-04-26 14:52:20 +00:00
suspend fun TelegramBot.sendActionRecordVoice(
2022-12-30 14:49:47 +00:00
chat: Chat,
threadId: MessageThreadId? = chat.id.threadId
) = sendBotAction(chat, RecordVoiceAction, threadId)
2021-04-26 14:52:20 +00:00
suspend fun TelegramBot.sendActionUploadVoice(
2022-12-30 14:49:47 +00:00
chat: Chat,
threadId: MessageThreadId? = chat.id.threadId
) = sendBotAction(chat, UploadVoiceAction, threadId)
2021-04-26 14:52:20 +00:00
suspend fun TelegramBot.sendActionUploadDocument(
2022-12-30 14:49:47 +00:00
chat: Chat,
threadId: MessageThreadId? = chat.id.threadId
) = sendBotAction(chat, UploadDocumentAction, threadId)
2020-02-15 09:33:04 +00:00
suspend fun TelegramBot.sendActionFindLocation(
2022-12-30 14:49:47 +00:00
chat: Chat,
threadId: MessageThreadId? = chat.id.threadId
) = sendBotAction(chat, FindLocationAction, threadId)
2020-02-15 09:33:04 +00:00
suspend fun TelegramBot.sendActionRecordVideoNote(
2022-12-30 14:49:47 +00:00
chat: Chat,
threadId: MessageThreadId? = chat.id.threadId
) = sendBotAction(chat, RecordVideoNoteAction, threadId)
2020-02-15 09:33:04 +00:00
suspend fun TelegramBot.sendActionUploadVideoNote(
2022-12-30 14:49:47 +00:00
chat: Chat,
threadId: MessageThreadId? = chat.id.threadId
) = sendBotAction(chat, UploadVideoNoteAction, threadId)
2020-02-15 09:33:04 +00:00
2021-11-08 12:36:17 +00:00
suspend fun TelegramBot.sendActionChooseStickerAction(
2022-12-30 14:49:47 +00:00
chat: Chat,
threadId: MessageThreadId? = chat.id.threadId
) = sendBotAction(chat, ChooseStickerAction, threadId)
2021-11-08 12:36:17 +00:00