2020-10-04 10:57:39 +00:00
|
|
|
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.*
|
2024-04-17 09:09:45 +00:00
|
|
|
import dev.inmo.tgbotapi.types.businessConnectionId
|
|
|
|
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
|
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
|
|
|
|
2020-10-04 07:18:24 +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,
|
2024-04-17 09:09:45 +00:00
|
|
|
threadId: MessageThreadId? = chatId.threadId,
|
|
|
|
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId
|
2020-02-15 09:33:04 +00:00
|
|
|
) = execute(
|
2024-04-17 09:09:45 +00:00
|
|
|
SendAction(chatId, action, threadId, businessConnectionId)
|
2020-02-15 09:33:04 +00:00
|
|
|
)
|
|
|
|
|
2020-10-04 07:18:24 +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,
|
2024-04-17 09:09:45 +00:00
|
|
|
threadId: MessageThreadId? = chat.id.threadId,
|
|
|
|
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId
|
|
|
|
) = sendBotAction(chat.id, action, threadId, businessConnectionId)
|
2020-02-15 09:33:04 +00:00
|
|
|
|
|
|
|
|
2020-10-04 07:18:24 +00:00
|
|
|
suspend fun TelegramBot.sendActionTyping(
|
2022-12-30 14:49:47 +00:00
|
|
|
chatId: ChatIdentifier,
|
2024-04-17 09:09:45 +00:00
|
|
|
threadId: MessageThreadId? = chatId.threadId,
|
|
|
|
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId
|
|
|
|
) = sendBotAction(chatId, TypingAction, threadId, businessConnectionId)
|
2020-02-15 09:33:04 +00:00
|
|
|
|
2020-10-04 07:18:24 +00:00
|
|
|
suspend fun TelegramBot.sendActionUploadPhoto(
|
2022-12-30 14:49:47 +00:00
|
|
|
chatId: ChatIdentifier,
|
2024-04-17 09:09:45 +00:00
|
|
|
threadId: MessageThreadId? = chatId.threadId,
|
|
|
|
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId
|
|
|
|
) = sendBotAction(chatId, UploadPhotoAction, threadId, businessConnectionId)
|
2020-02-15 09:33:04 +00:00
|
|
|
|
2020-10-04 07:18:24 +00:00
|
|
|
suspend fun TelegramBot.sendActionRecordVideo(
|
2022-12-30 14:49:47 +00:00
|
|
|
chatId: ChatIdentifier,
|
2024-04-17 09:09:45 +00:00
|
|
|
threadId: MessageThreadId? = chatId.threadId,
|
|
|
|
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId
|
|
|
|
) = sendBotAction(chatId, RecordVideoAction, threadId, businessConnectionId)
|
2020-02-15 09:33:04 +00:00
|
|
|
|
2020-10-04 07:18:24 +00:00
|
|
|
suspend fun TelegramBot.sendActionUploadVideo(
|
2022-12-30 14:49:47 +00:00
|
|
|
chatId: ChatIdentifier,
|
2024-04-17 09:09:45 +00:00
|
|
|
threadId: MessageThreadId? = chatId.threadId,
|
|
|
|
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId
|
|
|
|
) = sendBotAction(chatId, UploadVideoAction, threadId, businessConnectionId)
|
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,
|
2024-04-17 09:09:45 +00:00
|
|
|
threadId: MessageThreadId? = chatId.threadId,
|
|
|
|
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId
|
|
|
|
) = sendBotAction(chatId, RecordVoiceAction, threadId, businessConnectionId)
|
2021-04-26 14:52:20 +00:00
|
|
|
|
|
|
|
suspend fun TelegramBot.sendActionUploadVoice(
|
2022-12-30 14:49:47 +00:00
|
|
|
chatId: ChatIdentifier,
|
2024-04-17 09:09:45 +00:00
|
|
|
threadId: MessageThreadId? = chatId.threadId,
|
|
|
|
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId
|
|
|
|
) = sendBotAction(chatId, UploadVoiceAction, threadId, businessConnectionId)
|
2021-04-26 14:52:20 +00:00
|
|
|
|
2020-10-04 07:18:24 +00:00
|
|
|
suspend fun TelegramBot.sendActionUploadDocument(
|
2022-12-30 14:49:47 +00:00
|
|
|
chatId: ChatIdentifier,
|
2024-04-17 09:09:45 +00:00
|
|
|
threadId: MessageThreadId? = chatId.threadId,
|
|
|
|
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId
|
|
|
|
) = sendBotAction(chatId, UploadDocumentAction, threadId, businessConnectionId)
|
2020-02-15 09:33:04 +00:00
|
|
|
|
2020-10-04 07:18:24 +00:00
|
|
|
suspend fun TelegramBot.sendActionFindLocation(
|
2022-12-30 14:49:47 +00:00
|
|
|
chatId: ChatIdentifier,
|
2024-04-17 09:09:45 +00:00
|
|
|
threadId: MessageThreadId? = chatId.threadId,
|
|
|
|
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId
|
|
|
|
) = sendBotAction(chatId, FindLocationAction, threadId, businessConnectionId)
|
2020-02-15 09:33:04 +00:00
|
|
|
|
2020-10-04 07:18:24 +00:00
|
|
|
suspend fun TelegramBot.sendActionRecordVideoNote(
|
2022-12-30 14:49:47 +00:00
|
|
|
chatId: ChatIdentifier,
|
2024-04-17 09:09:45 +00:00
|
|
|
threadId: MessageThreadId? = chatId.threadId,
|
|
|
|
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId
|
|
|
|
) = sendBotAction(chatId, RecordVideoNoteAction, threadId, businessConnectionId)
|
2020-02-15 09:33:04 +00:00
|
|
|
|
2020-10-04 07:18:24 +00:00
|
|
|
suspend fun TelegramBot.sendActionUploadVideoNote(
|
2022-12-30 14:49:47 +00:00
|
|
|
chatId: ChatIdentifier,
|
2024-04-17 09:09:45 +00:00
|
|
|
threadId: MessageThreadId? = chatId.threadId,
|
|
|
|
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId
|
|
|
|
) = sendBotAction(chatId, UploadVideoNoteAction, threadId, businessConnectionId)
|
2020-02-15 09:33:04 +00:00
|
|
|
|
|
|
|
|
2020-10-04 07:18:24 +00:00
|
|
|
suspend fun TelegramBot.sendActionTyping(
|
2022-12-30 14:49:47 +00:00
|
|
|
chat: Chat,
|
2024-04-17 09:09:45 +00:00
|
|
|
threadId: MessageThreadId? = chat.id.threadId,
|
|
|
|
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId
|
|
|
|
) = sendBotAction(chat, TypingAction, threadId, businessConnectionId)
|
2020-02-15 09:33:04 +00:00
|
|
|
|
2020-10-04 07:18:24 +00:00
|
|
|
suspend fun TelegramBot.sendActionUploadPhoto(
|
2022-12-30 14:49:47 +00:00
|
|
|
chat: Chat,
|
2024-04-17 09:09:45 +00:00
|
|
|
threadId: MessageThreadId? = chat.id.threadId,
|
|
|
|
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId
|
|
|
|
) = sendBotAction(chat, UploadPhotoAction, threadId, businessConnectionId)
|
2020-02-15 09:33:04 +00:00
|
|
|
|
2020-10-04 07:18:24 +00:00
|
|
|
suspend fun TelegramBot.sendActionRecordVideo(
|
2022-12-30 14:49:47 +00:00
|
|
|
chat: Chat,
|
2024-04-17 09:09:45 +00:00
|
|
|
threadId: MessageThreadId? = chat.id.threadId,
|
|
|
|
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId
|
|
|
|
) = sendBotAction(chat, RecordVideoAction, threadId, businessConnectionId)
|
2020-02-15 09:33:04 +00:00
|
|
|
|
2020-10-04 07:18:24 +00:00
|
|
|
suspend fun TelegramBot.sendActionUploadVideo(
|
2022-12-30 14:49:47 +00:00
|
|
|
chat: Chat,
|
2024-04-17 09:09:45 +00:00
|
|
|
threadId: MessageThreadId? = chat.id.threadId,
|
|
|
|
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId
|
|
|
|
) = sendBotAction(chat, UploadVideoAction, threadId, businessConnectionId)
|
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,
|
2024-04-17 09:09:45 +00:00
|
|
|
threadId: MessageThreadId? = chat.id.threadId,
|
|
|
|
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId
|
|
|
|
) = sendBotAction(chat, RecordVoiceAction, threadId, businessConnectionId)
|
2021-04-26 14:52:20 +00:00
|
|
|
|
|
|
|
suspend fun TelegramBot.sendActionUploadVoice(
|
2022-12-30 14:49:47 +00:00
|
|
|
chat: Chat,
|
2024-04-17 09:09:45 +00:00
|
|
|
threadId: MessageThreadId? = chat.id.threadId,
|
|
|
|
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId
|
|
|
|
) = sendBotAction(chat, UploadVoiceAction, threadId, businessConnectionId)
|
2021-04-26 14:52:20 +00:00
|
|
|
|
2020-10-04 07:18:24 +00:00
|
|
|
suspend fun TelegramBot.sendActionUploadDocument(
|
2022-12-30 14:49:47 +00:00
|
|
|
chat: Chat,
|
2024-04-17 09:09:45 +00:00
|
|
|
threadId: MessageThreadId? = chat.id.threadId,
|
|
|
|
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId
|
|
|
|
) = sendBotAction(chat, UploadDocumentAction, threadId, businessConnectionId)
|
2020-02-15 09:33:04 +00:00
|
|
|
|
2020-10-04 07:18:24 +00:00
|
|
|
suspend fun TelegramBot.sendActionFindLocation(
|
2022-12-30 14:49:47 +00:00
|
|
|
chat: Chat,
|
2024-04-17 09:09:45 +00:00
|
|
|
threadId: MessageThreadId? = chat.id.threadId,
|
|
|
|
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId
|
|
|
|
) = sendBotAction(chat, FindLocationAction, threadId, businessConnectionId)
|
2020-02-15 09:33:04 +00:00
|
|
|
|
2020-10-04 07:18:24 +00:00
|
|
|
suspend fun TelegramBot.sendActionRecordVideoNote(
|
2022-12-30 14:49:47 +00:00
|
|
|
chat: Chat,
|
2024-04-17 09:09:45 +00:00
|
|
|
threadId: MessageThreadId? = chat.id.threadId,
|
|
|
|
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId
|
|
|
|
) = sendBotAction(chat, RecordVideoNoteAction, threadId, businessConnectionId)
|
2020-02-15 09:33:04 +00:00
|
|
|
|
2020-10-04 07:18:24 +00:00
|
|
|
suspend fun TelegramBot.sendActionUploadVideoNote(
|
2022-12-30 14:49:47 +00:00
|
|
|
chat: Chat,
|
2024-04-17 09:09:45 +00:00
|
|
|
threadId: MessageThreadId? = chat.id.threadId,
|
|
|
|
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId
|
|
|
|
) = sendBotAction(chat, UploadVideoNoteAction, threadId, businessConnectionId)
|
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,
|
2024-04-17 09:09:45 +00:00
|
|
|
threadId: MessageThreadId? = chat.id.threadId,
|
|
|
|
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId
|
|
|
|
) = sendBotAction(chat, ChooseStickerAction, threadId, businessConnectionId)
|
2021-11-08 12:36:17 +00:00
|
|
|
|