152 lines
6.0 KiB
Kotlin
152 lines
6.0 KiB
Kotlin
package dev.inmo.tgbotapi.extensions.api.send.media
|
|
|
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
|
import dev.inmo.tgbotapi.requests.abstracts.InputFile
|
|
import dev.inmo.tgbotapi.requests.send.media.SendPhoto
|
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
|
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
|
import dev.inmo.tgbotapi.types.MessageIdentifier
|
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
|
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
|
import dev.inmo.tgbotapi.types.chat.abstracts.Chat
|
|
import dev.inmo.tgbotapi.types.files.Photo
|
|
import dev.inmo.tgbotapi.types.files.biggest
|
|
|
|
/**
|
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
|
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
|
*/
|
|
suspend fun TelegramBot.sendPhoto(
|
|
chatId: ChatIdentifier,
|
|
fileId: InputFile,
|
|
text: String? = null,
|
|
parseMode: ParseMode? = null,
|
|
disableNotification: Boolean = false,
|
|
replyToMessageId: MessageIdentifier? = null,
|
|
allowSendingWithoutReply: Boolean? = null,
|
|
replyMarkup: KeyboardMarkup? = null
|
|
) = execute(
|
|
SendPhoto(
|
|
chatId,
|
|
fileId,
|
|
text,
|
|
parseMode,
|
|
disableNotification,
|
|
replyToMessageId,
|
|
allowSendingWithoutReply,
|
|
replyMarkup
|
|
)
|
|
)
|
|
|
|
/**
|
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
|
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
|
*/
|
|
suspend fun TelegramBot.sendPhoto(
|
|
chat: Chat,
|
|
fileId: InputFile,
|
|
text: String? = null,
|
|
parseMode: ParseMode? = null,
|
|
disableNotification: Boolean = false,
|
|
replyToMessageId: MessageIdentifier? = null,
|
|
allowSendingWithoutReply: Boolean? = null,
|
|
replyMarkup: KeyboardMarkup? = null
|
|
) = sendPhoto(chat.id, fileId, text, parseMode, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
|
|
|
/**
|
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
|
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
|
*/
|
|
suspend fun TelegramBot.sendPhoto(
|
|
chatId: ChatIdentifier,
|
|
photo: Photo,
|
|
text: String? = null,
|
|
parseMode: ParseMode? = null,
|
|
disableNotification: Boolean = false,
|
|
replyToMessageId: MessageIdentifier? = null,
|
|
allowSendingWithoutReply: Boolean? = null,
|
|
replyMarkup: KeyboardMarkup? = null
|
|
) = sendPhoto(chatId, photo.biggest() ?.fileId ?: error("Photo content must not be empty"), text, parseMode, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
|
|
|
/**
|
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
|
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
|
*/
|
|
suspend fun TelegramBot.sendPhoto(
|
|
chat: Chat,
|
|
photo: Photo,
|
|
text: String? = null,
|
|
parseMode: ParseMode? = null,
|
|
disableNotification: Boolean = false,
|
|
replyToMessageId: MessageIdentifier? = null,
|
|
allowSendingWithoutReply: Boolean? = null,
|
|
replyMarkup: KeyboardMarkup? = null
|
|
) = sendPhoto(chat.id, photo, text, parseMode, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
|
|
|
|
|
/**
|
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
|
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
|
*/
|
|
suspend inline fun TelegramBot.sendPhoto(
|
|
chatId: ChatIdentifier,
|
|
fileId: InputFile,
|
|
entities: TextSourcesList,
|
|
disableNotification: Boolean = false,
|
|
replyToMessageId: MessageIdentifier? = null,
|
|
allowSendingWithoutReply: Boolean? = null,
|
|
replyMarkup: KeyboardMarkup? = null
|
|
) = execute(
|
|
SendPhoto(
|
|
chatId,
|
|
fileId,
|
|
entities,
|
|
disableNotification,
|
|
replyToMessageId,
|
|
allowSendingWithoutReply,
|
|
replyMarkup
|
|
)
|
|
)
|
|
|
|
/**
|
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
|
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
|
*/
|
|
suspend inline fun TelegramBot.sendPhoto(
|
|
chat: Chat,
|
|
fileId: InputFile,
|
|
entities: TextSourcesList,
|
|
disableNotification: Boolean = false,
|
|
replyToMessageId: MessageIdentifier? = null,
|
|
allowSendingWithoutReply: Boolean? = null,
|
|
replyMarkup: KeyboardMarkup? = null
|
|
) = sendPhoto(chat.id, fileId, entities, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
|
|
|
/**
|
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
|
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
|
*/
|
|
suspend inline fun TelegramBot.sendPhoto(
|
|
chatId: ChatIdentifier,
|
|
photo: Photo,
|
|
entities: TextSourcesList,
|
|
disableNotification: Boolean = false,
|
|
replyToMessageId: MessageIdentifier? = null,
|
|
allowSendingWithoutReply: Boolean? = null,
|
|
replyMarkup: KeyboardMarkup? = null
|
|
) = sendPhoto(chatId, photo.biggest() ?.fileId ?: error("Photo content must not be empty"), entities, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
|
|
|
/**
|
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
|
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
|
*/
|
|
suspend inline fun TelegramBot.sendPhoto(
|
|
chat: Chat,
|
|
photo: Photo,
|
|
entities: TextSourcesList,
|
|
disableNotification: Boolean = false,
|
|
replyToMessageId: MessageIdentifier? = null,
|
|
allowSendingWithoutReply: Boolean? = null,
|
|
replyMarkup: KeyboardMarkup? = null
|
|
) = sendPhoto(chat.id, photo, entities, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|