1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-25 19:48:43 +00:00

update extnsions.api

This commit is contained in:
InsanusMokrassar 2020-11-05 23:48:23 +06:00
parent 98d7b9c651
commit 99bb8d6e0d
52 changed files with 1468 additions and 205 deletions

View File

@ -64,6 +64,7 @@
* New property `PromoteChatMember#isAnonymous` * New property `PromoteChatMember#isAnonymous`
* Update all classes which must have `entities`/`caption_entities` fields * Update all classes which must have `entities`/`caption_entities` fields
* New request `CopyMessage` * New request `CopyMessage`
* New extension `List<TextSource>#makeString` for more comfortable work with new api with entities
* `API`: * `API`:
* Extensions `TelegramBot#pinChatMessage` now support any `Chat` and `Message`s from any `Chat` * Extensions `TelegramBot#pinChatMessage` now support any `Chat` and `Message`s from any `Chat`
* New extensions `TelegramBot#unpinAllChatMessages` * New extensions `TelegramBot#unpinAllChatMessages`

View File

@ -3,6 +3,7 @@ package dev.inmo.tgbotapi.requests.edit.LiveLocation
import dev.inmo.tgbotapi.requests.edit.abstracts.* import dev.inmo.tgbotapi.requests.edit.abstracts.*
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.location.LiveLocation
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
import dev.inmo.tgbotapi.types.message.content.LocationContent import dev.inmo.tgbotapi.types.message.content.LocationContent

View File

@ -16,7 +16,7 @@ import kotlinx.serialization.builtins.serializer
@Serializable @Serializable
object Close : SimpleRequest<Boolean> { object Close : SimpleRequest<Boolean> {
override val requestSerializer: SerializationStrategy<*> override val requestSerializer: SerializationStrategy<*>
get() = LogOut.serializer() get() = serializer()
override fun method(): String = "close" override fun method(): String = "close"

View File

@ -46,6 +46,7 @@ fun SendPoll(
isClosed: Boolean = false, isClosed: Boolean = false,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = SendRegularPoll( ) = SendRegularPoll(
chatId, chatId,
@ -53,6 +54,7 @@ fun SendPoll(
options, options,
isAnonymous, isAnonymous,
isClosed, isClosed,
allowSendingWithoutReply = allowSendingWithoutReply,
disableNotification = disableNotification, disableNotification = disableNotification,
replyToMessageId = replyToMessageId, replyToMessageId = replyToMessageId,
replyMarkup = replyMarkup replyMarkup = replyMarkup

View File

@ -2,6 +2,7 @@ package dev.inmo.tgbotapi.types.InlineQueries.query
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InlineQuery import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InlineQuery
import dev.inmo.tgbotapi.types.location.Location
import dev.inmo.tgbotapi.types.location.StaticLocation import dev.inmo.tgbotapi.types.location.StaticLocation
data class LocationInlineQuery( data class LocationInlineQuery(
@ -9,5 +10,5 @@ data class LocationInlineQuery(
override val from: User, override val from: User,
override val query: String, override val query: String,
override val offset: String, override val offset: String,
val location: StaticLocation val location: Location
) : InlineQuery ) : InlineQuery

View File

@ -1,6 +1,7 @@
package dev.inmo.tgbotapi.types.InlineQueries.query package dev.inmo.tgbotapi.types.InlineQueries.query
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.location.Location
import dev.inmo.tgbotapi.types.location.StaticLocation import dev.inmo.tgbotapi.types.location.StaticLocation
import kotlinx.serialization.SerialName import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
@ -16,7 +17,7 @@ internal data class RawInlineQuery(
@SerialName(offsetField) @SerialName(offsetField)
val offset: String, val offset: String,
@SerialName(locationField) @SerialName(locationField)
val location: StaticLocation? = null val location: Location? = null
) { ) {
val asInlineQuery by lazy { val asInlineQuery by lazy {
location ?.let { location ?.let {

View File

@ -14,8 +14,9 @@ data class ContactContent(
chatId: ChatIdentifier, chatId: ChatIdentifier,
disableNotification: Boolean, disableNotification: Boolean,
replyToMessageId: MessageIdentifier?, replyToMessageId: MessageIdentifier?,
allowSendingWithoutReply: Boolean?,
replyMarkup: KeyboardMarkup? replyMarkup: KeyboardMarkup?
): Request<ContentMessage<ContactContent>> = SendContact( ): Request<ContentMessage<ContactContent>> = SendContact(
chatId, contact, disableNotification, replyToMessageId, replyMarkup chatId, contact, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
} }

View File

@ -16,12 +16,14 @@ data class DiceContent(
chatId: ChatIdentifier, chatId: ChatIdentifier,
disableNotification: Boolean, disableNotification: Boolean,
replyToMessageId: MessageIdentifier?, replyToMessageId: MessageIdentifier?,
allowSendingWithoutReply: Boolean?,
replyMarkup: KeyboardMarkup? replyMarkup: KeyboardMarkup?
): Request<ContentMessage<DiceContent>> = SendDice( ): Request<ContentMessage<DiceContent>> = SendDice(
chatId, chatId,
dice.animationType, dice.animationType,
disableNotification, disableNotification,
replyToMessageId, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )
} }

View File

@ -16,12 +16,14 @@ data class GameContent(
chatId: ChatIdentifier, chatId: ChatIdentifier,
disableNotification: Boolean, disableNotification: Boolean,
replyToMessageId: MessageIdentifier?, replyToMessageId: MessageIdentifier?,
allowSendingWithoutReply: Boolean?,
replyMarkup: KeyboardMarkup? replyMarkup: KeyboardMarkup?
): Request<ContentMessage<GameContent>> = SendGame( ): Request<ContentMessage<GameContent>> = SendGame(
chatId, chatId,
game.title, game.title,
disableNotification, disableNotification,
replyToMessageId, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )
} }

View File

@ -7,7 +7,9 @@ import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.location.* import dev.inmo.tgbotapi.types.location.*
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.content.abstracts.MessageContent import dev.inmo.tgbotapi.types.message.content.abstracts.MessageContent
import kotlinx.serialization.Serializable
@Serializable
data class LocationContent( data class LocationContent(
val location: Location val location: Location
) : MessageContent { ) : MessageContent {
@ -23,6 +25,7 @@ data class LocationContent(
location.longitude, location.longitude,
disableNotification, disableNotification,
replyToMessageId, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )
is LiveLocation -> SendLiveLocation( is LiveLocation -> SendLiveLocation(
@ -35,6 +38,7 @@ data class LocationContent(
location.proximityAlertRadius, location.proximityAlertRadius,
disableNotification, disableNotification,
replyToMessageId, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )
} }

View File

@ -16,11 +16,13 @@ data class PollContent(
chatId: ChatIdentifier, chatId: ChatIdentifier,
disableNotification: Boolean, disableNotification: Boolean,
replyToMessageId: MessageIdentifier?, replyToMessageId: MessageIdentifier?,
allowSendingWithoutReply: Boolean?,
replyMarkup: KeyboardMarkup? replyMarkup: KeyboardMarkup?
): Request<ContentMessage<PollContent>> = poll.createRequest( ): Request<ContentMessage<PollContent>> = poll.createRequest(
chatId, chatId,
disableNotification, disableNotification,
replyToMessageId, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )
} }

View File

@ -24,6 +24,7 @@ data class TextContent(
chatId: ChatIdentifier, chatId: ChatIdentifier,
disableNotification: Boolean, disableNotification: Boolean,
replyToMessageId: MessageIdentifier?, replyToMessageId: MessageIdentifier?,
allowSendingWithoutReply: Boolean?,
replyMarkup: KeyboardMarkup? replyMarkup: KeyboardMarkup?
): Request<ContentMessage<TextContent>> = SendTextMessage( ): Request<ContentMessage<TextContent>> = SendTextMessage(
chatId, chatId,
@ -32,6 +33,7 @@ data class TextContent(
false, false,
disableNotification, disableNotification,
replyToMessageId, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )
@ -39,11 +41,13 @@ data class TextContent(
chatId: ChatIdentifier, chatId: ChatIdentifier,
disableNotification: Boolean, disableNotification: Boolean,
replyToMessageId: MessageIdentifier?, replyToMessageId: MessageIdentifier?,
allowSendingWithoutReply: Boolean?,
replyMarkup: KeyboardMarkup? replyMarkup: KeyboardMarkup?
): List<Request<ContentMessage<TextContent>>> = createResends( ): List<Request<ContentMessage<TextContent>>> = createResends(
chatId, chatId,
disableNotification, disableNotification,
replyToMessageId, replyToMessageId,
allowSendingWithoutReply,
replyMarkup, replyMarkup,
HTMLParseMode HTMLParseMode
) )
@ -52,6 +56,7 @@ data class TextContent(
chatId: ChatIdentifier, chatId: ChatIdentifier,
disableNotification: Boolean, disableNotification: Boolean,
replyToMessageId: MessageIdentifier?, replyToMessageId: MessageIdentifier?,
allowSendingWithoutReply: Boolean?,
replyMarkup: KeyboardMarkup?, replyMarkup: KeyboardMarkup?,
parseMode: ParseMode = HTMLParseMode parseMode: ParseMode = HTMLParseMode
): List<Request<ContentMessage<TextContent>>> = when (parseMode) { ): List<Request<ContentMessage<TextContent>>> = when (parseMode) {
@ -66,6 +71,7 @@ data class TextContent(
false, false,
disableNotification, disableNotification,
replyToMessageId, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )
} }

View File

@ -16,8 +16,9 @@ data class VenueContent(
chatId: ChatIdentifier, chatId: ChatIdentifier,
disableNotification: Boolean, disableNotification: Boolean,
replyToMessageId: MessageIdentifier?, replyToMessageId: MessageIdentifier?,
allowSendingWithoutReply: Boolean?,
replyMarkup: KeyboardMarkup? replyMarkup: KeyboardMarkup?
): Request<ContentMessage<VenueContent>> = SendVenue( ): Request<ContentMessage<VenueContent>> = SendVenue(
chatId, venue, disableNotification, replyToMessageId, replyMarkup chatId, venue, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
} }

View File

@ -11,6 +11,7 @@ interface ResendableContent {
chatId: ChatIdentifier, chatId: ChatIdentifier,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): Request<out Message> ): Request<out Message>
@ -18,6 +19,7 @@ interface ResendableContent {
chatId: ChatIdentifier, chatId: ChatIdentifier,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): List<Request<out Message>> = listOf(createResend(chatId, disableNotification, replyToMessageId, replyMarkup)) ): List<Request<out Message>> = listOf(createResend(chatId, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup))
} }

View File

@ -27,6 +27,7 @@ data class AnimationContent(
chatId: ChatIdentifier, chatId: ChatIdentifier,
disableNotification: Boolean, disableNotification: Boolean,
replyToMessageId: MessageIdentifier?, replyToMessageId: MessageIdentifier?,
allowSendingWithoutReply: Boolean?,
replyMarkup: KeyboardMarkup? replyMarkup: KeyboardMarkup?
): Request<ContentMessage<AnimationContent>> = SendAnimation( ): Request<ContentMessage<AnimationContent>> = SendAnimation(
chatId, chatId,
@ -39,6 +40,7 @@ data class AnimationContent(
media.height, media.height,
disableNotification, disableNotification,
replyToMessageId, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )

View File

@ -24,6 +24,7 @@ data class AudioContent(
chatId: ChatIdentifier, chatId: ChatIdentifier,
disableNotification: Boolean, disableNotification: Boolean,
replyToMessageId: MessageIdentifier?, replyToMessageId: MessageIdentifier?,
allowSendingWithoutReply: Boolean?,
replyMarkup: KeyboardMarkup? replyMarkup: KeyboardMarkup?
): Request<ContentMessage<AudioContent>> = SendAudio( ): Request<ContentMessage<AudioContent>> = SendAudio(
chatId, chatId,
@ -36,6 +37,7 @@ data class AudioContent(
media.title, media.title,
disableNotification, disableNotification,
replyToMessageId, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )

View File

@ -26,6 +26,7 @@ data class DocumentContent(
chatId: ChatIdentifier, chatId: ChatIdentifier,
disableNotification: Boolean, disableNotification: Boolean,
replyToMessageId: MessageIdentifier?, replyToMessageId: MessageIdentifier?,
allowSendingWithoutReply: Boolean?,
replyMarkup: KeyboardMarkup? replyMarkup: KeyboardMarkup?
): Request<ContentMessage<DocumentContent>> = SendDocument( ): Request<ContentMessage<DocumentContent>> = SendDocument(
chatId, chatId,
@ -35,6 +36,7 @@ data class DocumentContent(
HTMLParseMode, HTMLParseMode,
disableNotification, disableNotification,
replyToMessageId, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )

View File

@ -26,6 +26,7 @@ data class PhotoContent(
chatId: ChatIdentifier, chatId: ChatIdentifier,
disableNotification: Boolean, disableNotification: Boolean,
replyToMessageId: MessageIdentifier?, replyToMessageId: MessageIdentifier?,
allowSendingWithoutReply: Boolean?,
replyMarkup: KeyboardMarkup? replyMarkup: KeyboardMarkup?
): Request<ContentMessage<PhotoContent>> = SendPhoto( ): Request<ContentMessage<PhotoContent>> = SendPhoto(
chatId, chatId,
@ -34,6 +35,7 @@ data class PhotoContent(
HTMLParseMode, HTMLParseMode,
disableNotification, disableNotification,
replyToMessageId, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )

View File

@ -17,12 +17,14 @@ data class StickerContent(
chatId: ChatIdentifier, chatId: ChatIdentifier,
disableNotification: Boolean, disableNotification: Boolean,
replyToMessageId: MessageIdentifier?, replyToMessageId: MessageIdentifier?,
allowSendingWithoutReply: Boolean?,
replyMarkup: KeyboardMarkup? replyMarkup: KeyboardMarkup?
): Request<ContentMessage<StickerContent>> = SendSticker( ): Request<ContentMessage<StickerContent>> = SendSticker(
chatId, chatId,
media.fileId, media.fileId,
disableNotification, disableNotification,
replyToMessageId, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )

View File

@ -27,6 +27,7 @@ data class VideoContent(
chatId: ChatIdentifier, chatId: ChatIdentifier,
disableNotification: Boolean, disableNotification: Boolean,
replyToMessageId: MessageIdentifier?, replyToMessageId: MessageIdentifier?,
allowSendingWithoutReply: Boolean?,
replyMarkup: KeyboardMarkup? replyMarkup: KeyboardMarkup?
): Request<ContentMessage<VideoContent>> = SendVideo( ): Request<ContentMessage<VideoContent>> = SendVideo(
chatId, chatId,
@ -40,6 +41,7 @@ data class VideoContent(
null, null,
disableNotification, disableNotification,
replyToMessageId, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )

View File

@ -18,26 +18,17 @@ data class VideoNoteContent(
chatId: ChatIdentifier, chatId: ChatIdentifier,
disableNotification: Boolean, disableNotification: Boolean,
replyToMessageId: MessageIdentifier?, replyToMessageId: MessageIdentifier?,
allowSendingWithoutReply: Boolean?,
replyMarkup: KeyboardMarkup? replyMarkup: KeyboardMarkup?
): Request<ContentMessage<VideoNoteContent>> = createResend(chatId, null, null, disableNotification, replyToMessageId, replyMarkup)
fun createResend(
chatId: ChatIdentifier,
caption: String?,
parseMode: ParseMode? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
): Request<ContentMessage<VideoNoteContent>> = SendVideoNote( ): Request<ContentMessage<VideoNoteContent>> = SendVideoNote(
chatId, chatId,
media.fileId, media.fileId,
media.thumb ?.fileId, media.thumb ?.fileId,
caption,
parseMode,
media.duration, media.duration,
media.width, media.width,
disableNotification, disableNotification,
replyToMessageId, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )

View File

@ -25,6 +25,7 @@ data class VoiceContent(
chatId: ChatIdentifier, chatId: ChatIdentifier,
disableNotification: Boolean, disableNotification: Boolean,
replyToMessageId: MessageIdentifier?, replyToMessageId: MessageIdentifier?,
allowSendingWithoutReply: Boolean?,
replyMarkup: KeyboardMarkup? replyMarkup: KeyboardMarkup?
): Request<ContentMessage<VoiceContent>> = SendVoice( ): Request<ContentMessage<VoiceContent>> = SendVoice(
chatId, chatId,
@ -34,6 +35,7 @@ data class VoiceContent(
media.duration, media.duration,
disableNotification, disableNotification,
replyToMessageId, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )

View File

@ -15,6 +15,7 @@ data class InvoiceContent(
chatId: ChatIdentifier, chatId: ChatIdentifier,
disableNotification: Boolean, disableNotification: Boolean,
replyToMessageId: MessageIdentifier?, replyToMessageId: MessageIdentifier?,
allowSendingWithoutReply: Boolean?,
replyMarkup: KeyboardMarkup? replyMarkup: KeyboardMarkup?
): Request<ContentMessage<InvoiceContent>> { ): Request<ContentMessage<InvoiceContent>> {
error("Unfortunately, currently InvoiceOfPayment can not be resend due to requirement of additional parameters," + error("Unfortunately, currently InvoiceOfPayment can not be resend due to requirement of additional parameters," +

View File

@ -0,0 +1,7 @@
package dev.inmo.tgbotapi.extensions.api
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.local.Close
@Suppress("unused")
suspend inline fun TelegramBot.close() = execute(Close)

View File

@ -3,7 +3,6 @@ package dev.inmo.tgbotapi.extensions.api
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.extensions.api.edit.LiveLocation.editLiveLocation import dev.inmo.tgbotapi.extensions.api.edit.LiveLocation.editLiveLocation
import dev.inmo.tgbotapi.extensions.api.edit.LiveLocation.stopLiveLocation import dev.inmo.tgbotapi.extensions.api.edit.LiveLocation.stopLiveLocation
import dev.inmo.tgbotapi.requests.send.SendLocation
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
@ -13,14 +12,15 @@ import dev.inmo.tgbotapi.types.message.abstracts.Message
import dev.inmo.tgbotapi.types.message.content.LocationContent import dev.inmo.tgbotapi.types.message.content.LocationContent
import com.soywiz.klock.DateTime import com.soywiz.klock.DateTime
import com.soywiz.klock.TimeSpan import com.soywiz.klock.TimeSpan
import dev.inmo.tgbotapi.types.location.StaticLocation import dev.inmo.tgbotapi.requests.send.SendLiveLocation
import dev.inmo.tgbotapi.types.location.*
import io.ktor.utils.io.core.Closeable import io.ktor.utils.io.core.Closeable
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlin.math.ceil import kotlin.math.ceil
val defaultLivePeriodDelayMillis = (livePeriodLimit.last - 60L) * 1000L val defaultLivePeriodDelayMillis = (livePeriodLimit.last - 60L) * 1000L
class LiveLocation internal constructor( class LiveLocationProvider internal constructor(
private val requestsExecutor: TelegramBot, private val requestsExecutor: TelegramBot,
scope: CoroutineScope, scope: CoroutineScope,
autoCloseTimeDelay: Double, autoCloseTimeDelay: Double,
@ -40,13 +40,13 @@ class LiveLocation internal constructor(
get() = field || leftUntilCloseMillis.millisecondsLong < 0L get() = field || leftUntilCloseMillis.millisecondsLong < 0L
private var message: ContentMessage<LocationContent> = initMessage private var message: ContentMessage<LocationContent> = initMessage
val lastLocation: StaticLocation val lastLocation: LiveLocation
get() = message.content.location get() = message.content.location as LiveLocation
suspend fun updateLocation( suspend fun updateLocation(
location: StaticLocation, location: LiveLocation,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
): StaticLocation { ): LiveLocation {
if (!isClosed) { if (!isClosed) {
message = requestsExecutor.editLiveLocation( message = requestsExecutor.editLiveLocation(
message, message,
@ -74,24 +74,32 @@ suspend fun TelegramBot.startLiveLocation(
latitude: Double, latitude: Double,
longitude: Double, longitude: Double,
liveTimeMillis: Long = defaultLivePeriodDelayMillis, liveTimeMillis: Long = defaultLivePeriodDelayMillis,
initHorizontalAccuracy: Meters? = null,
initHeading: Degrees? = null,
initProximityAlertRadius: Meters? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): LiveLocation { ): LiveLocationProvider {
val liveTimeAsDouble = liveTimeMillis.toDouble() val liveTimeAsDouble = liveTimeMillis.toDouble()
val locationMessage = execute( val locationMessage = execute(
SendLocation( SendLiveLocation(
chatId, chatId,
latitude, latitude,
longitude, longitude,
ceil(liveTimeAsDouble / 1000).toLong(), ceil(liveTimeAsDouble / 1000).toInt(),
initHorizontalAccuracy,
initHeading,
initProximityAlertRadius,
disableNotification, disableNotification,
replyToMessageId, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )
) )
return LiveLocation( return LiveLocationProvider(
this, this,
scope, scope,
liveTimeAsDouble, liveTimeAsDouble,
@ -105,11 +113,26 @@ suspend fun TelegramBot.startLiveLocation(
latitude: Double, latitude: Double,
longitude: Double, longitude: Double,
liveTimeMillis: Long = defaultLivePeriodDelayMillis, liveTimeMillis: Long = defaultLivePeriodDelayMillis,
initHorizontalAccuracy: Meters? = null,
initHeading: Degrees? = null,
initProximityAlertRadius: Meters? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): LiveLocation = startLiveLocation( ): LiveLocationProvider = startLiveLocation(
scope, chat.id, latitude, longitude, liveTimeMillis, disableNotification, replyToMessageId, replyMarkup scope,
chat.id,
latitude,
longitude,
liveTimeMillis,
initHorizontalAccuracy,
initHeading,
initProximityAlertRadius,
disableNotification,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup
) )
suspend fun TelegramBot.startLiveLocation( suspend fun TelegramBot.startLiveLocation(
@ -117,11 +140,26 @@ suspend fun TelegramBot.startLiveLocation(
chatId: ChatId, chatId: ChatId,
location: StaticLocation, location: StaticLocation,
liveTimeMillis: Long = defaultLivePeriodDelayMillis, liveTimeMillis: Long = defaultLivePeriodDelayMillis,
initHorizontalAccuracy: Meters? = null,
initHeading: Degrees? = null,
initProximityAlertRadius: Meters? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): LiveLocation = startLiveLocation( ): LiveLocationProvider = startLiveLocation(
scope, chatId, location.latitude, location.longitude, liveTimeMillis, disableNotification, replyToMessageId, replyMarkup scope,
chatId,
location.latitude,
location.longitude,
liveTimeMillis,
initHorizontalAccuracy,
initHeading,
initProximityAlertRadius,
disableNotification,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup
) )
suspend fun TelegramBot.startLiveLocation( suspend fun TelegramBot.startLiveLocation(
@ -129,11 +167,26 @@ suspend fun TelegramBot.startLiveLocation(
chat: Chat, chat: Chat,
location: StaticLocation, location: StaticLocation,
liveTimeMillis: Long = defaultLivePeriodDelayMillis, liveTimeMillis: Long = defaultLivePeriodDelayMillis,
initHorizontalAccuracy: Meters? = null,
initHeading: Degrees? = null,
initProximityAlertRadius: Meters? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): LiveLocation = startLiveLocation( ): LiveLocationProvider = startLiveLocation(
scope, chat.id, location.latitude, location.longitude, liveTimeMillis, disableNotification, replyToMessageId, replyMarkup scope,
chat.id,
location.latitude,
location.longitude,
liveTimeMillis,
initHorizontalAccuracy,
initHeading,
initProximityAlertRadius,
disableNotification,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup
) )
suspend inline fun TelegramBot.replyWithLiveLocation( suspend inline fun TelegramBot.replyWithLiveLocation(
@ -142,15 +195,48 @@ suspend inline fun TelegramBot.replyWithLiveLocation(
latitude: Double, latitude: Double,
longitude: Double, longitude: Double,
liveTimeMillis: Long = defaultLivePeriodDelayMillis, liveTimeMillis: Long = defaultLivePeriodDelayMillis,
initHorizontalAccuracy: Meters? = null,
initHeading: Degrees? = null,
initProximityAlertRadius: Meters? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = startLiveLocation(scope, to.chat, latitude, longitude, liveTimeMillis, disableNotification, to.messageId, replyMarkup) ) = startLiveLocation(
scope,
to.chat,
latitude,
longitude,
liveTimeMillis,
initHorizontalAccuracy,
initHeading,
initProximityAlertRadius,
disableNotification,
to.messageId,
allowSendingWithoutReply,
replyMarkup
)
suspend inline fun TelegramBot.replyWithLiveLocation( suspend inline fun TelegramBot.replyWithLiveLocation(
to: Message, to: Message,
scope: CoroutineScope, scope: CoroutineScope,
location: StaticLocation, location: StaticLocation,
liveTimeMillis: Long = defaultLivePeriodDelayMillis, liveTimeMillis: Long = defaultLivePeriodDelayMillis,
initHorizontalAccuracy: Meters? = null,
initHeading: Degrees? = null,
initProximityAlertRadius: Meters? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = startLiveLocation(scope, to.chat, location, liveTimeMillis, disableNotification, to.messageId, replyMarkup) ) = startLiveLocation(
scope,
to.chat,
location,
liveTimeMillis,
initHorizontalAccuracy,
initHeading,
initProximityAlertRadius,
disableNotification,
to.messageId,
allowSendingWithoutReply,
replyMarkup
)

View File

@ -0,0 +1,6 @@
package dev.inmo.tgbotapi.extensions.api
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.local.LogOut
suspend inline fun TelegramBot.logOut() = execute(LogOut)

View File

@ -7,21 +7,25 @@ import dev.inmo.tgbotapi.types.chat.abstracts.PublicChat
suspend fun TelegramBot.unbanChatMember( suspend fun TelegramBot.unbanChatMember(
chatId: ChatIdentifier, chatId: ChatIdentifier,
userId: UserId userId: UserId,
) = execute(UnbanChatMember(chatId, userId)) onlyIfBanned: Boolean? = null
) = execute(UnbanChatMember(chatId, userId, onlyIfBanned))
suspend fun TelegramBot.unbanChatMember( suspend fun TelegramBot.unbanChatMember(
chat: PublicChat, chat: PublicChat,
userId: UserId userId: UserId,
) = unbanChatMember(chat.id, userId) onlyIfBanned: Boolean? = null
) = unbanChatMember(chat.id, userId, onlyIfBanned)
suspend fun TelegramBot.unbanChatMember( suspend fun TelegramBot.unbanChatMember(
chatId: ChatId, chatId: ChatId,
user: User user: User,
) = unbanChatMember(chatId, user.id) onlyIfBanned: Boolean? = null
) = unbanChatMember(chatId, user.id, onlyIfBanned)
suspend fun TelegramBot.unbanChatMember( suspend fun TelegramBot.unbanChatMember(
chat: PublicChat, chat: PublicChat,
user: User user: User,
) = unbanChatMember(chat.id, user.id) onlyIfBanned: Boolean? = null
) = unbanChatMember(chat.id, user.id, onlyIfBanned)

View File

@ -5,6 +5,7 @@ import dev.inmo.tgbotapi.requests.edit.LiveLocation.EditChatMessageLiveLocation
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.chat.abstracts.Chat import dev.inmo.tgbotapi.types.chat.abstracts.Chat
import dev.inmo.tgbotapi.types.location.LiveLocation
import dev.inmo.tgbotapi.types.location.StaticLocation import dev.inmo.tgbotapi.types.location.StaticLocation
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.content.LocationContent import dev.inmo.tgbotapi.types.message.content.LocationContent
@ -14,10 +15,13 @@ suspend fun TelegramBot.editLiveLocation(
messageId: MessageIdentifier, messageId: MessageIdentifier,
latitude: Double, latitude: Double,
longitude: Double, longitude: Double,
horizontalAccuracy: Meters? = null,
heading: Degrees? = null,
proximityAlertRadius: Meters? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = execute( ) = execute(
EditChatMessageLiveLocation( EditChatMessageLiveLocation(
chatId, messageId, latitude, longitude, replyMarkup chatId, messageId, latitude, longitude, horizontalAccuracy, heading, proximityAlertRadius, replyMarkup
) )
) )
@ -26,36 +30,42 @@ suspend fun TelegramBot.editLiveLocation(
messageId: MessageIdentifier, messageId: MessageIdentifier,
latitude: Double, latitude: Double,
longitude: Double, longitude: Double,
horizontalAccuracy: Meters? = null,
heading: Degrees? = null,
proximityAlertRadius: Meters? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = editLiveLocation(chat.id, messageId, latitude, longitude, replyMarkup) ) = editLiveLocation(chat.id, messageId, latitude, longitude, horizontalAccuracy, heading, proximityAlertRadius, replyMarkup)
suspend fun TelegramBot.editLiveLocation( suspend fun TelegramBot.editLiveLocation(
message: ContentMessage<LocationContent>, message: ContentMessage<LocationContent>,
latitude: Double, latitude: Double,
longitude: Double, longitude: Double,
horizontalAccuracy: Meters? = null,
heading: Degrees? = null,
proximityAlertRadius: Meters? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = editLiveLocation(message.chat, message.messageId, latitude, longitude, replyMarkup) ) = editLiveLocation(message.chat, message.messageId, latitude, longitude, horizontalAccuracy, heading, proximityAlertRadius, replyMarkup)
suspend fun TelegramBot.editLiveLocation( suspend fun TelegramBot.editLiveLocation(
chatId: ChatIdentifier, chatId: ChatIdentifier,
messageId: MessageIdentifier, messageId: MessageIdentifier,
location: StaticLocation, location: LiveLocation,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = execute( ) = execute(
EditChatMessageLiveLocation( EditChatMessageLiveLocation(
chatId, messageId, location.latitude, location.longitude, replyMarkup chatId, messageId, location.latitude, location.longitude, location.horizontalAccuracy, location.heading, location.proximityAlertRadius, replyMarkup
) )
) )
suspend fun TelegramBot.editLiveLocation( suspend fun TelegramBot.editLiveLocation(
chat: Chat, chat: Chat,
messageId: MessageIdentifier, messageId: MessageIdentifier,
location: StaticLocation, location: LiveLocation,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = editLiveLocation(chat.id, messageId, location.latitude, location.longitude, replyMarkup) ) = editLiveLocation(chat.id, messageId, location.latitude, location.longitude, location.horizontalAccuracy, location.heading, location.proximityAlertRadius, replyMarkup)
suspend fun TelegramBot.editLiveLocation( suspend fun TelegramBot.editLiveLocation(
message: ContentMessage<LocationContent>, message: ContentMessage<LocationContent>,
location: StaticLocation, location: LiveLocation,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = editLiveLocation(message.chat, message.messageId, location.latitude, location.longitude, replyMarkup) ) = editLiveLocation(message.chat, message.messageId, location.latitude, location.longitude, location.horizontalAccuracy, location.heading, location.proximityAlertRadius, replyMarkup)

View File

@ -2,22 +2,27 @@ package dev.inmo.tgbotapi.extensions.api.edit.LiveLocation
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.edit.LiveLocation.EditInlineMessageLiveLocation import dev.inmo.tgbotapi.requests.edit.LiveLocation.EditInlineMessageLiveLocation
import dev.inmo.tgbotapi.types.InlineMessageIdentifier import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.location.StaticLocation import dev.inmo.tgbotapi.types.location.StaticLocation
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.location.LiveLocation
import kotlinx.serialization.SerialName
suspend fun TelegramBot.editLiveLocation( suspend fun TelegramBot.editLiveLocation(
inlineMessageId: InlineMessageIdentifier, inlineMessageId: InlineMessageIdentifier,
latitude: Double, latitude: Double,
longitude: Double, longitude: Double,
horizontalAccuracy: Meters? = null,
heading: Degrees? = null,
proximityAlertRadius: Meters? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = execute( ) = execute(
EditInlineMessageLiveLocation( EditInlineMessageLiveLocation(
inlineMessageId, latitude, longitude, replyMarkup inlineMessageId, latitude, longitude, horizontalAccuracy, heading, proximityAlertRadius, replyMarkup
) )
) )
suspend fun TelegramBot.editLiveLocation( suspend fun TelegramBot.editLiveLocation(
inlineMessageId: InlineMessageIdentifier, inlineMessageId: InlineMessageIdentifier,
location: StaticLocation, location: LiveLocation,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = editLiveLocation(inlineMessageId, location.latitude, location.longitude, replyMarkup) ) = editLiveLocation(inlineMessageId, location.latitude, location.longitude, location.horizontalAccuracy, location.heading, location.proximityAlertRadius, replyMarkup)

View File

@ -1,6 +1,7 @@
package dev.inmo.tgbotapi.extensions.api.edit.caption package dev.inmo.tgbotapi.extensions.api.edit.caption
import dev.inmo.tgbotapi.CommonAbstracts.CaptionedInput import dev.inmo.tgbotapi.CommonAbstracts.CaptionedInput
import dev.inmo.tgbotapi.CommonAbstracts.TextSource
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.edit.caption.EditChatMessageCaption import dev.inmo.tgbotapi.requests.edit.caption.EditChatMessageCaption
import dev.inmo.tgbotapi.types.ChatIdentifier import dev.inmo.tgbotapi.types.ChatIdentifier
@ -37,3 +38,27 @@ suspend fun <T> TelegramBot.editMessageCaption(
): ContentMessage<MediaContent> where T : CaptionedInput, T : MediaContent { ): ContentMessage<MediaContent> where T : CaptionedInput, T : MediaContent {
return editMessageCaption(message.chat.id, message.messageId, text, parseMode, replyMarkup) return editMessageCaption(message.chat.id, message.messageId, text, parseMode, replyMarkup)
} }
suspend fun TelegramBot.editMessageCaption(
chatId: ChatIdentifier,
messageId: MessageIdentifier,
entities: List<TextSource>,
replyMarkup: InlineKeyboardMarkup? = null
) = execute(
EditChatMessageCaption(chatId, messageId, entities, replyMarkup)
)
suspend fun TelegramBot.editMessageCaption(
chat: Chat,
messageId: MessageIdentifier,
entities: List<TextSource>,
replyMarkup: InlineKeyboardMarkup? = null
) = editMessageCaption(chat.id, messageId, entities, replyMarkup)
suspend fun <T> TelegramBot.editMessageCaption(
message: ContentMessage<T>,
entities: List<TextSource>,
replyMarkup: InlineKeyboardMarkup? = null
): ContentMessage<MediaContent> where T : CaptionedInput, T : MediaContent {
return editMessageCaption(message.chat.id, message.messageId, entities, replyMarkup)
}

View File

@ -1,5 +1,6 @@
package dev.inmo.tgbotapi.extensions.api.edit.caption package dev.inmo.tgbotapi.extensions.api.edit.caption
import dev.inmo.tgbotapi.CommonAbstracts.TextSource
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.edit.caption.EditInlineMessageCaption import dev.inmo.tgbotapi.requests.edit.caption.EditInlineMessageCaption
import dev.inmo.tgbotapi.types.InlineMessageIdentifier import dev.inmo.tgbotapi.types.InlineMessageIdentifier
@ -12,3 +13,9 @@ suspend fun TelegramBot.editMessageCaption(
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = execute(EditInlineMessageCaption(inlineMessageId, text, parseMode, replyMarkup)) ) = execute(EditInlineMessageCaption(inlineMessageId, text, parseMode, replyMarkup))
suspend fun TelegramBot.editMessageCaption(
inlineMessageId: InlineMessageIdentifier,
entities: List<TextSource>,
replyMarkup: InlineKeyboardMarkup? = null
) = execute(EditInlineMessageCaption(inlineMessageId, entities, replyMarkup))

View File

@ -1,5 +1,6 @@
package dev.inmo.tgbotapi.extensions.api.edit.text package dev.inmo.tgbotapi.extensions.api.edit.text
import dev.inmo.tgbotapi.CommonAbstracts.TextSource
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.edit.text.EditChatMessageText import dev.inmo.tgbotapi.requests.edit.text.EditChatMessageText
import dev.inmo.tgbotapi.types.ChatIdentifier import dev.inmo.tgbotapi.types.ChatIdentifier
@ -36,4 +37,29 @@ suspend fun TelegramBot.editMessageText(
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
disableWebPagePreview: Boolean? = null, disableWebPagePreview: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = editMessageText(message.chat.id, message.messageId, text, parseMode, disableWebPagePreview, replyMarkup) ) = editMessageText(message.chat.id, message.messageId, text, parseMode, disableWebPagePreview, replyMarkup)
suspend fun TelegramBot.editMessageText(
chatId: ChatIdentifier,
messageId: MessageIdentifier,
entities: List<TextSource>,
disableWebPagePreview: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null
) = execute(
EditChatMessageText(chatId, messageId, entities, disableWebPagePreview, replyMarkup)
)
suspend fun TelegramBot.editMessageText(
chat: Chat,
messageId: MessageIdentifier,
entities: List<TextSource>,
disableWebPagePreview: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null
) = editMessageText(chat.id, messageId, entities, disableWebPagePreview, replyMarkup)
suspend fun TelegramBot.editMessageText(
message: ContentMessage<TextContent>,
entities: List<TextSource>,
disableWebPagePreview: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null
) = editMessageText(message.chat.id, message.messageId, entities, disableWebPagePreview, replyMarkup)

View File

@ -1,5 +1,6 @@
package dev.inmo.tgbotapi.extensions.api.edit.text package dev.inmo.tgbotapi.extensions.api.edit.text
import dev.inmo.tgbotapi.CommonAbstracts.TextSource
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.edit.text.EditInlineMessageText import dev.inmo.tgbotapi.requests.edit.text.EditInlineMessageText
import dev.inmo.tgbotapi.types.InlineMessageIdentifier import dev.inmo.tgbotapi.types.InlineMessageIdentifier
@ -13,3 +14,10 @@ suspend fun TelegramBot.editMessageText(
disableWebPagePreview: Boolean? = null, disableWebPagePreview: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = execute(EditInlineMessageText(inlineMessageId, text, parseMode, disableWebPagePreview, replyMarkup)) ) = execute(EditInlineMessageText(inlineMessageId, text, parseMode, disableWebPagePreview, replyMarkup))
suspend fun TelegramBot.editMessageText(
inlineMessageId: InlineMessageIdentifier,
entities: List<TextSource>,
disableWebPagePreview: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null
) = execute(EditInlineMessageText(inlineMessageId, entities, disableWebPagePreview, replyMarkup))

View File

@ -0,0 +1,150 @@
package dev.inmo.tgbotapi.extensions.api.send
import dev.inmo.tgbotapi.CommonAbstracts.TextSource
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.send.CopyMessage
import dev.inmo.tgbotapi.types.ChatIdentifier
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.message.abstracts.Message
suspend inline fun TelegramBot.copyMessage(
fromChatId: ChatIdentifier,
toChatId: ChatIdentifier,
messageId: MessageIdentifier,
text: String? = null,
parseMode: ParseMode? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
CopyMessage(fromChatId, toChatId, messageId, text, parseMode, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
)
suspend inline fun TelegramBot.copyMessage(
fromChat: Chat,
toChatId: ChatIdentifier,
messageId: MessageIdentifier,
text: String? = null,
parseMode: ParseMode? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = copyMessage(fromChat.id, toChatId, messageId, text, parseMode, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.copyMessage(
fromChatId: ChatIdentifier,
toChat: Chat,
messageId: MessageIdentifier,
text: String? = null,
parseMode: ParseMode? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = copyMessage(fromChatId, toChat.id, messageId, text, parseMode, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.copyMessage(
fromChat: Chat,
toChat: Chat,
messageId: MessageIdentifier,
text: String? = null,
parseMode: ParseMode? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = copyMessage(fromChat.id, toChat.id, messageId, text, parseMode, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.copyMessage(
toChatId: ChatIdentifier,
message: Message,
text: String? = null,
parseMode: ParseMode? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = copyMessage(message.chat, toChatId, message.messageId, text, parseMode, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.copyMessage(
toChat: Chat,
message: Message,
text: String? = null,
parseMode: ParseMode? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = copyMessage(message.chat, toChat, message.messageId, text, parseMode, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.copyMessage(
fromChatId: ChatIdentifier,
toChatId: ChatIdentifier,
messageId: MessageIdentifier,
entities: List<TextSource>,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
CopyMessage(fromChatId, toChatId, messageId, entities, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
)
suspend inline fun TelegramBot.copyMessage(
fromChat: Chat,
toChatId: ChatIdentifier,
messageId: MessageIdentifier,
entities: List<TextSource>,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = copyMessage(fromChat.id, toChatId, messageId, entities, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.copyMessage(
fromChatId: ChatIdentifier,
toChat: Chat,
messageId: MessageIdentifier,
entities: List<TextSource>,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = copyMessage(fromChatId, toChat.id, messageId, entities, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.copyMessage(
fromChat: Chat,
toChat: Chat,
messageId: MessageIdentifier,
entities: List<TextSource>,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = copyMessage(fromChat.id, toChat.id, messageId, entities, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.copyMessage(
toChatId: ChatIdentifier,
message: Message,
entities: List<TextSource>,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = copyMessage(message.chat, toChatId, message.messageId, entities, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.copyMessage(
toChat: Chat,
message: Message,
entities: List<TextSource>,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = copyMessage(message.chat, toChat, message.messageId, entities, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)

View File

@ -14,10 +14,11 @@ suspend fun TelegramBot.sendContact(
lastName: String? = null, lastName: String? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = execute( ) = execute(
SendContact( SendContact(
chatId, phoneNumber, firstName, lastName, disableNotification, replyToMessageId, replyMarkup chatId, phoneNumber, firstName, lastName, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
) )
@ -26,10 +27,11 @@ suspend fun TelegramBot.sendContact(
contact: Contact, contact: Contact,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = execute( ) = execute(
SendContact( SendContact(
chatId, contact, disableNotification, replyToMessageId, replyMarkup chatId, contact, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
) )
@ -40,9 +42,10 @@ suspend fun TelegramBot.sendContact(
lastName: String? = null, lastName: String? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendContact( ) = sendContact(
chat.id, phoneNumber, firstName, lastName, disableNotification, replyToMessageId, replyMarkup chat.id, phoneNumber, firstName, lastName, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
suspend fun TelegramBot.sendContact( suspend fun TelegramBot.sendContact(
@ -50,9 +53,10 @@ suspend fun TelegramBot.sendContact(
contact: Contact, contact: Contact,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendContact( ) = sendContact(
chat.id, contact, disableNotification, replyToMessageId, replyMarkup chat.id, contact, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
suspend inline fun TelegramBot.reply( suspend inline fun TelegramBot.reply(
@ -61,6 +65,7 @@ suspend inline fun TelegramBot.reply(
firstName: String, firstName: String,
lastName: String? = null, lastName: String? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendContact( ) = sendContact(
to.chat, to.chat,
@ -69,6 +74,7 @@ suspend inline fun TelegramBot.reply(
lastName, lastName,
disableNotification, disableNotification,
to.messageId, to.messageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )
@ -76,11 +82,13 @@ suspend inline fun TelegramBot.reply(
to: Message, to: Message,
contact: Contact, contact: Contact,
disableNotification: Boolean = false, disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendContact( ) = sendContact(
to.chat, to.chat,
contact, contact,
disableNotification, disableNotification,
to.messageId, to.messageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )

View File

@ -14,9 +14,10 @@ suspend fun TelegramBot.sendDice(
animationType: DiceAnimationType? = null, animationType: DiceAnimationType? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = execute( ) = execute(
SendDice(chatId, animationType, disableNotification, replyToMessageId, replyMarkup) SendDice(chatId, animationType, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) )
suspend fun TelegramBot.sendDice( suspend fun TelegramBot.sendDice(
@ -24,12 +25,14 @@ suspend fun TelegramBot.sendDice(
animationType: DiceAnimationType? = null, animationType: DiceAnimationType? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendDice(chat.id, animationType, disableNotification, replyToMessageId, replyMarkup) ) = sendDice(chat.id, animationType, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.reply( suspend inline fun TelegramBot.reply(
to: Message, to: Message,
animationType: DiceAnimationType? = null, animationType: DiceAnimationType? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendDice(to.chat, animationType, disableNotification, to.messageId, replyMarkup) ) = sendDice(to.chat, animationType, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)

View File

@ -2,6 +2,7 @@ package dev.inmo.tgbotapi.extensions.api.send
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.send.SendLocation import dev.inmo.tgbotapi.requests.send.SendLocation
import dev.inmo.tgbotapi.requests.send.SendStaticLocation
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.abstracts.Chat import dev.inmo.tgbotapi.types.chat.abstracts.Chat
@ -16,7 +17,7 @@ suspend fun TelegramBot.sendLocation(
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = execute( ) = execute(
SendLocation( SendStaticLocation(
chatId, chatId,
latitude, latitude,
longitude, longitude,
@ -72,6 +73,40 @@ suspend fun TelegramBot.sendLocation(
replyMarkup replyMarkup
) )
suspend fun TelegramBot.sendStaticLocation(
chatId: ChatIdentifier,
latitude: Double,
longitude: Double,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
) = sendLocation(chatId, latitude, longitude, disableNotification, replyToMessageId, replyMarkup)
suspend fun TelegramBot.sendStaticLocation(
chatId: ChatIdentifier,
location: StaticLocation,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
) = sendLocation(chatId, location.latitude, location.longitude, disableNotification, replyToMessageId, replyMarkup)
suspend fun TelegramBot.sendStaticLocation(
chat: Chat,
latitude: Double,
longitude: Double,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
) = sendLocation(chat.id, latitude, longitude, disableNotification, replyToMessageId, replyMarkup)
suspend fun TelegramBot.sendStaticLocation(
chat: Chat,
location: StaticLocation,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
) = sendLocation(chat.id, location.latitude, location.longitude, disableNotification, replyToMessageId, replyMarkup)
suspend inline fun TelegramBot.reply( suspend inline fun TelegramBot.reply(
to: Message, to: Message,
latitude: Double, latitude: Double,

View File

@ -1,5 +1,6 @@
package dev.inmo.tgbotapi.extensions.api.send package dev.inmo.tgbotapi.extensions.api.send
import dev.inmo.tgbotapi.CommonAbstracts.TextSource
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.send.SendTextMessage import dev.inmo.tgbotapi.requests.send.SendTextMessage
import dev.inmo.tgbotapi.types.ChatIdentifier import dev.inmo.tgbotapi.types.ChatIdentifier
@ -16,9 +17,10 @@ suspend fun TelegramBot.sendMessage(
disableWebPagePreview: Boolean? = null, disableWebPagePreview: Boolean? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = execute( ) = execute(
SendTextMessage(chatId, text, parseMode, disableWebPagePreview, disableNotification, replyToMessageId, replyMarkup) SendTextMessage(chatId, text, parseMode, disableWebPagePreview, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) )
suspend fun TelegramBot.sendTextMessage( suspend fun TelegramBot.sendTextMessage(
@ -28,9 +30,10 @@ suspend fun TelegramBot.sendTextMessage(
disableWebPagePreview: Boolean? = null, disableWebPagePreview: Boolean? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendMessage( ) = sendMessage(
chatId, text, parseMode, disableWebPagePreview, disableNotification, replyToMessageId, replyMarkup chatId, text, parseMode, disableWebPagePreview, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
suspend fun TelegramBot.sendMessage( suspend fun TelegramBot.sendMessage(
@ -40,8 +43,9 @@ suspend fun TelegramBot.sendMessage(
disableWebPagePreview: Boolean? = null, disableWebPagePreview: Boolean? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendMessage(chat.id, text, parseMode, disableWebPagePreview, disableNotification, replyToMessageId, replyMarkup) ) = sendMessage(chat.id, text, parseMode, disableWebPagePreview, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
suspend fun TelegramBot.sendTextMessage( suspend fun TelegramBot.sendTextMessage(
@ -51,8 +55,54 @@ suspend fun TelegramBot.sendTextMessage(
disableWebPagePreview: Boolean? = null, disableWebPagePreview: Boolean? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendTextMessage(chat.id, text, parseMode, disableWebPagePreview, disableNotification, replyToMessageId, replyMarkup) ) = sendTextMessage(chat.id, text, parseMode, disableWebPagePreview, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
suspend fun TelegramBot.sendMessage(
chatId: ChatIdentifier,
entities: List<TextSource>,
disableWebPagePreview: Boolean? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendTextMessage(chatId, entities, disableWebPagePreview, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
)
suspend fun TelegramBot.sendTextMessage(
chatId: ChatIdentifier,
entities: List<TextSource>,
disableWebPagePreview: Boolean? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendMessage(
chatId, entities, disableWebPagePreview, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
)
suspend fun TelegramBot.sendMessage(
chat: Chat,
entities: List<TextSource>,
disableWebPagePreview: Boolean? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendMessage(chat.id, entities, disableWebPagePreview, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
suspend fun TelegramBot.sendTextMessage(
chat: Chat,
entities: List<TextSource>,
disableWebPagePreview: Boolean? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendTextMessage(chat.id, entities, disableWebPagePreview, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.reply( suspend inline fun TelegramBot.reply(
to: Message, to: Message,
@ -60,6 +110,7 @@ suspend inline fun TelegramBot.reply(
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
disableWebPagePreview: Boolean? = null, disableWebPagePreview: Boolean? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendTextMessage( ) = sendTextMessage(
to.chat, to.chat,
@ -68,5 +119,22 @@ suspend inline fun TelegramBot.reply(
disableWebPagePreview, disableWebPagePreview,
disableNotification, disableNotification,
to.messageId, to.messageId,
allowSendingWithoutReply,
replyMarkup
)
suspend inline fun TelegramBot.reply(
to: Message,
entities: List<TextSource>,
disableWebPagePreview: Boolean? = null,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendTextMessage(
to.chat,
entities,
disableWebPagePreview,
disableNotification,
to.messageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )

View File

@ -18,10 +18,11 @@ suspend fun TelegramBot.sendVenue(
foursquareId: String? = null, foursquareId: String? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = execute( ) = execute(
SendVenue( SendVenue(
chatId, latitude, longitude, title, address, foursquareId, disableNotification, replyToMessageId, replyMarkup chatId, latitude, longitude, title, address, foursquareId, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
) )
@ -34,9 +35,10 @@ suspend fun TelegramBot.sendVenue(
foursquareId: String? = null, foursquareId: String? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVenue( ) = sendVenue(
chat.id, latitude, longitude, title, address, foursquareId, disableNotification, replyToMessageId, replyMarkup chat.id, latitude, longitude, title, address, foursquareId, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
suspend fun TelegramBot.sendVenue( suspend fun TelegramBot.sendVenue(
@ -47,9 +49,10 @@ suspend fun TelegramBot.sendVenue(
foursquareId: String? = null, foursquareId: String? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVenue( ) = sendVenue(
chatId, location.latitude, location.longitude, title, address, foursquareId, disableNotification, replyToMessageId, replyMarkup chatId, location.latitude, location.longitude, title, address, foursquareId, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
suspend fun TelegramBot.sendVenue( suspend fun TelegramBot.sendVenue(
@ -60,9 +63,10 @@ suspend fun TelegramBot.sendVenue(
foursquareId: String? = null, foursquareId: String? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVenue( ) = sendVenue(
chat.id, location.latitude, location.longitude, title, address, foursquareId, disableNotification, replyToMessageId, replyMarkup chat.id, location.latitude, location.longitude, title, address, foursquareId, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
suspend fun TelegramBot.sendVenue( suspend fun TelegramBot.sendVenue(
@ -70,10 +74,11 @@ suspend fun TelegramBot.sendVenue(
venue: Venue, venue: Venue,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = execute( ) = execute(
SendVenue( SendVenue(
chatId, venue, disableNotification, replyToMessageId, replyMarkup chatId, venue, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
) )
@ -82,9 +87,10 @@ suspend fun TelegramBot.sendVenue(
venue: Venue, venue: Venue,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVenue( ) = sendVenue(
chat.id, venue, disableNotification, replyToMessageId, replyMarkup chat.id, venue, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
suspend inline fun TelegramBot.reply( suspend inline fun TelegramBot.reply(
@ -95,9 +101,10 @@ suspend inline fun TelegramBot.reply(
address: String, address: String,
foursquareId: String? = null, foursquareId: String? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVenue( ) = sendVenue(
to.chat, latitude, longitude, title, address, foursquareId, disableNotification, to.messageId, replyMarkup to.chat, latitude, longitude, title, address, foursquareId, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup
) )
suspend inline fun TelegramBot.reply( suspend inline fun TelegramBot.reply(
@ -107,16 +114,18 @@ suspend inline fun TelegramBot.reply(
address: String, address: String,
foursquareId: String? = null, foursquareId: String? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVenue( ) = sendVenue(
to.chat, location, title, address, foursquareId, disableNotification, to.messageId, replyMarkup to.chat, location, title, address, foursquareId, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup
) )
suspend inline fun TelegramBot.reply( suspend inline fun TelegramBot.reply(
to: Message, to: Message,
venue: Venue, venue: Venue,
disableNotification: Boolean = false, disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVenue( ) = sendVenue(
to.chat, venue, disableNotification, to.messageId, replyMarkup to.chat, venue, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup
) )

View File

@ -14,10 +14,11 @@ suspend fun TelegramBot.sendGame(
gameShortName: String, gameShortName: String,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = execute( ) = execute(
SendGame( SendGame(
chatId, gameShortName, disableNotification, replyToMessageId, replyMarkup chatId, gameShortName, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
) )
@ -26,9 +27,10 @@ suspend fun TelegramBot.sendGame(
gameShortName: String, gameShortName: String,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendGame( ) = sendGame(
chat.id, gameShortName, disableNotification, replyToMessageId, replyMarkup chat.id, gameShortName, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
suspend fun TelegramBot.sendGame( suspend fun TelegramBot.sendGame(
@ -36,9 +38,10 @@ suspend fun TelegramBot.sendGame(
game: Game, game: Game,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendGame( ) = sendGame(
chatId, game.title, disableNotification, replyToMessageId, replyMarkup chatId, game.title, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
suspend fun TelegramBot.sendGame( suspend fun TelegramBot.sendGame(
@ -46,32 +49,36 @@ suspend fun TelegramBot.sendGame(
game: Game, game: Game,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendGame( ) = sendGame(
chat.id, game.title, disableNotification, replyToMessageId, replyMarkup chat.id, game.title, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
suspend inline fun TelegramBot.replyWithGame( suspend inline fun TelegramBot.replyWithGame(
to: Message, to: Message,
gameShortName: String, gameShortName: String,
disableNotification: Boolean = false, disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendGame( ) = sendGame(
to.chat, gameShortName, disableNotification, to.messageId, replyMarkup to.chat, gameShortName, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup
) )
suspend inline fun TelegramBot.replyWithGame( suspend inline fun TelegramBot.replyWithGame(
to: Message, to: Message,
game: Game, game: Game,
disableNotification: Boolean = false, disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendGame( ) = sendGame(
to.chat, game.title, disableNotification, to.messageId, replyMarkup to.chat, game.title, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup
) )
suspend inline fun TelegramBot.reply( suspend inline fun TelegramBot.reply(
to: Message, to: Message,
game: Game, game: Game,
disableNotification: Boolean = false, disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = replyWithGame(to, game, disableNotification, replyMarkup) ) = replyWithGame(to, game, disableNotification, allowSendingWithoutReply, replyMarkup)

View File

@ -1,5 +1,6 @@
package dev.inmo.tgbotapi.extensions.api.send.media package dev.inmo.tgbotapi.extensions.api.send.media
import dev.inmo.tgbotapi.CommonAbstracts.TextSource
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.abstracts.InputFile import dev.inmo.tgbotapi.requests.abstracts.InputFile
import dev.inmo.tgbotapi.requests.send.media.SendAnimation import dev.inmo.tgbotapi.requests.send.media.SendAnimation
@ -22,6 +23,7 @@ suspend fun TelegramBot.sendAnimation(
height: Int? = null, height: Int? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = execute( ) = execute(
SendAnimation( SendAnimation(
@ -35,6 +37,7 @@ suspend fun TelegramBot.sendAnimation(
height, height,
disableNotification, disableNotification,
replyToMessageId, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )
) )
@ -49,9 +52,10 @@ suspend fun TelegramBot.sendAnimation(
height: Int? = null, height: Int? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendAnimation( ) = sendAnimation(
chatId, animation.fileId, animation.thumb ?.fileId, text, parseMode, duration, width, height, disableNotification, replyToMessageId, replyMarkup chatId, animation.fileId, animation.thumb ?.fileId, text, parseMode, duration, width, height, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
suspend fun TelegramBot.sendAnimation( suspend fun TelegramBot.sendAnimation(
@ -65,8 +69,9 @@ suspend fun TelegramBot.sendAnimation(
height: Int? = null, height: Int? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendAnimation(chat.id, animation, thumb, text, parseMode, duration, width, height, disableNotification, replyToMessageId, replyMarkup) ) = sendAnimation(chat.id, animation, thumb, text, parseMode, duration, width, height, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
suspend fun TelegramBot.sendAnimation( suspend fun TelegramBot.sendAnimation(
chat: Chat, chat: Chat,
@ -78,8 +83,9 @@ suspend fun TelegramBot.sendAnimation(
height: Int? = null, height: Int? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendAnimation(chat.id, animation, text, parseMode, duration, width, height, disableNotification, replyToMessageId, replyMarkup) ) = sendAnimation(chat.id, animation, text, parseMode, duration, width, height, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.replyWithAnimation( suspend inline fun TelegramBot.replyWithAnimation(
to: Message, to: Message,
@ -91,6 +97,7 @@ suspend inline fun TelegramBot.replyWithAnimation(
width: Int? = null, width: Int? = null,
height: Int? = null, height: Int? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendAnimation( ) = sendAnimation(
to.chat, to.chat,
@ -103,6 +110,7 @@ suspend inline fun TelegramBot.replyWithAnimation(
height, height,
disableNotification, disableNotification,
to.messageId, to.messageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )
@ -115,8 +123,9 @@ suspend inline fun TelegramBot.replyWithAnimation(
width: Int? = null, width: Int? = null,
height: Int? = null, height: Int? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendAnimation(to.chat, animation, text, parseMode, duration, width, height, disableNotification, to.messageId, replyMarkup) ) = sendAnimation(to.chat, animation, text, parseMode, duration, width, height, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.reply( suspend inline fun TelegramBot.reply(
to: Message, to: Message,
@ -127,5 +136,126 @@ suspend inline fun TelegramBot.reply(
width: Int? = null, width: Int? = null,
height: Int? = null, height: Int? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = replyWithAnimation(to, animation, text, parseMode, duration, width, height, disableNotification, replyMarkup) ) = replyWithAnimation(to, animation, text, parseMode, duration, width, height, disableNotification, allowSendingWithoutReply, replyMarkup)
suspend fun TelegramBot.sendAnimation(
chatId: ChatIdentifier,
animation: InputFile,
thumb: InputFile? = null,
entities: List<TextSource>,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendAnimation(
chatId,
animation,
thumb,
entities,
duration,
width,
height,
disableNotification,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup
)
)
suspend fun TelegramBot.sendAnimation(
chatId: ChatIdentifier,
animation: AnimationFile,
entities: List<TextSource>,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendAnimation(
chatId, animation.fileId, animation.thumb ?.fileId, entities, duration, width, height, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
)
suspend fun TelegramBot.sendAnimation(
chat: Chat,
animation: InputFile,
thumb: InputFile? = null,
entities: List<TextSource>,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendAnimation(chat.id, animation, thumb, entities, duration, width, height, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
suspend fun TelegramBot.sendAnimation(
chat: Chat,
animation: AnimationFile,
entities: List<TextSource>,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendAnimation(chat.id, animation, entities, duration, width, height, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.replyWithAnimation(
to: Message,
animation: InputFile,
thumb: InputFile? = null,
entities: List<TextSource>,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendAnimation(
to.chat,
animation,
thumb,
entities,
duration,
width,
height,
disableNotification,
to.messageId,
allowSendingWithoutReply,
replyMarkup
)
suspend inline fun TelegramBot.replyWithAnimation(
to: Message,
animation: AnimationFile,
entities: List<TextSource>,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendAnimation(to.chat, animation, entities, duration, width, height, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.reply(
to: Message,
animation: AnimationFile,
entities: List<TextSource>,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = replyWithAnimation(to, animation, entities, duration, width, height, disableNotification, allowSendingWithoutReply, replyMarkup)

View File

@ -1,5 +1,6 @@
package dev.inmo.tgbotapi.extensions.api.send.media package dev.inmo.tgbotapi.extensions.api.send.media
import dev.inmo.tgbotapi.CommonAbstracts.TextSource
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.abstracts.InputFile import dev.inmo.tgbotapi.requests.abstracts.InputFile
import dev.inmo.tgbotapi.requests.send.media.SendAudio import dev.inmo.tgbotapi.requests.send.media.SendAudio
@ -23,6 +24,7 @@ suspend fun TelegramBot.sendAudio(
title: String? = null, title: String? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = execute( ) = execute(
SendAudio( SendAudio(
@ -36,6 +38,7 @@ suspend fun TelegramBot.sendAudio(
title, title,
disableNotification, disableNotification,
replyToMessageId, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )
) )
@ -51,8 +54,9 @@ suspend fun TelegramBot.sendAudio(
title: String? = null, title: String? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendAudio(chat.id, audio, thumb, text, parseMode, duration, performer, title, disableNotification, replyToMessageId, replyMarkup) ) = sendAudio(chat.id, audio, thumb, text, parseMode, duration, performer, title, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
suspend fun TelegramBot.sendAudio( suspend fun TelegramBot.sendAudio(
chatId: ChatIdentifier, chatId: ChatIdentifier,
@ -62,8 +66,9 @@ suspend fun TelegramBot.sendAudio(
title: String? = audio.title, title: String? = audio.title,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendAudio(chatId, audio.fileId, audio.thumb ?.fileId, text, parseMode, audio.duration, audio.performer, title, disableNotification, replyToMessageId, replyMarkup) ) = sendAudio(chatId, audio.fileId, audio.thumb ?.fileId, text, parseMode, audio.duration, audio.performer, title, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
suspend fun TelegramBot.sendAudio( suspend fun TelegramBot.sendAudio(
chat: Chat, chat: Chat,
@ -73,8 +78,9 @@ suspend fun TelegramBot.sendAudio(
title: String? = audio.title, title: String? = audio.title,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendAudio(chat.id, audio, text, parseMode, title, disableNotification, replyToMessageId, replyMarkup) ) = sendAudio(chat.id, audio, text, parseMode, title, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.replyWithAudio( suspend inline fun TelegramBot.replyWithAudio(
to: Message, to: Message,
@ -86,8 +92,9 @@ suspend inline fun TelegramBot.replyWithAudio(
performer: String? = null, performer: String? = null,
title: String? = null, title: String? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendAudio(to.chat, audio, thumb, text, parseMode, duration, performer, title, disableNotification, to.messageId, replyMarkup) ) = sendAudio(to.chat, audio, thumb, text, parseMode, duration, performer, title, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.replyWithAudio( suspend inline fun TelegramBot.replyWithAudio(
to: Message, to: Message,
@ -96,8 +103,9 @@ suspend inline fun TelegramBot.replyWithAudio(
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
title: String? = null, title: String? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendAudio(to.chat, audio, text, parseMode, title, disableNotification, to.messageId, replyMarkup) ) = sendAudio(to.chat, audio, text, parseMode, title, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.reply( suspend inline fun TelegramBot.reply(
to: Message, to: Message,
@ -106,5 +114,104 @@ suspend inline fun TelegramBot.reply(
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
title: String? = null, title: String? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = replyWithAudio(to, audio, text, parseMode, title, disableNotification, replyMarkup) ) = replyWithAudio(to, audio, text, parseMode, title, disableNotification, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.sendAudio(
chatId: ChatIdentifier,
audio: InputFile,
thumb: InputFile? = null,
entities: List<TextSource>,
duration: Long? = null,
performer: String? = null,
title: String? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendAudio(
chatId,
audio,
thumb,
entities,
duration,
performer,
title,
disableNotification,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup
)
)
suspend inline fun TelegramBot.sendAudio(
chat: Chat,
audio: InputFile,
thumb: InputFile? = null,
entities: List<TextSource>,
duration: Long? = null,
performer: String? = null,
title: String? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendAudio(chat.id, audio, thumb, entities, duration, performer, title, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.sendAudio(
chatId: ChatIdentifier,
audio: AudioFile,
entities: List<TextSource>,
title: String? = audio.title,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendAudio(chatId, audio.fileId, audio.thumb ?.fileId, entities, audio.duration, audio.performer, title, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.sendAudio(
chat: Chat,
audio: AudioFile,
entities: List<TextSource>,
title: String? = audio.title,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendAudio(chat.id, audio, entities, title, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.replyWithAudio(
to: Message,
audio: InputFile,
thumb: InputFile? = null,
entities: List<TextSource>,
duration: Long? = null,
performer: String? = null,
title: String? = null,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendAudio(to.chat, audio, thumb, entities, duration, performer, title, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.replyWithAudio(
to: Message,
audio: AudioFile,
entities: List<TextSource>,
title: String? = null,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendAudio(to.chat, audio, entities, title, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.reply(
to: Message,
audio: AudioFile,
entities: List<TextSource>,
title: String? = null,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = replyWithAudio(to, audio, entities, title, disableNotification, allowSendingWithoutReply, replyMarkup)

View File

@ -1,5 +1,6 @@
package dev.inmo.tgbotapi.extensions.api.send.media package dev.inmo.tgbotapi.extensions.api.send.media
import dev.inmo.tgbotapi.CommonAbstracts.TextSource
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.abstracts.InputFile import dev.inmo.tgbotapi.requests.abstracts.InputFile
import dev.inmo.tgbotapi.requests.send.media.SendDocument import dev.inmo.tgbotapi.requests.send.media.SendDocument
@ -19,7 +20,9 @@ suspend fun TelegramBot.sendDocument(
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null
) = execute( ) = execute(
SendDocument( SendDocument(
chatId, chatId,
@ -29,7 +32,9 @@ suspend fun TelegramBot.sendDocument(
parseMode, parseMode,
disableNotification, disableNotification,
replyToMessageId, replyToMessageId,
replyMarkup allowSendingWithoutReply,
replyMarkup,
disableContentTypeDetection
) )
) )
@ -41,8 +46,10 @@ suspend fun TelegramBot.sendDocument(
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null allowSendingWithoutReply: Boolean? = null,
) = sendDocument(chat.id, document, thumb, text, parseMode, disableNotification, replyToMessageId, replyMarkup) replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null
) = sendDocument(chat.id, document, thumb, text, parseMode, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
suspend fun TelegramBot.sendDocument( suspend fun TelegramBot.sendDocument(
chatId: ChatIdentifier, chatId: ChatIdentifier,
@ -51,9 +58,11 @@ suspend fun TelegramBot.sendDocument(
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null
) = sendDocument( ) = sendDocument(
chatId, document.fileId, document.thumb ?.fileId, text, parseMode, disableNotification, replyToMessageId, replyMarkup chatId, document.fileId, document.thumb ?.fileId, text, parseMode, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection
) )
suspend fun TelegramBot.sendDocument( suspend fun TelegramBot.sendDocument(
@ -63,8 +72,10 @@ suspend fun TelegramBot.sendDocument(
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null allowSendingWithoutReply: Boolean? = null,
) = sendDocument(chat.id, document, text, parseMode, disableNotification, replyToMessageId, replyMarkup) replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null
) = sendDocument(chat.id, document, text, parseMode, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
suspend inline fun TelegramBot.replyWithDocument( suspend inline fun TelegramBot.replyWithDocument(
to: Message, to: Message,
@ -73,8 +84,10 @@ suspend inline fun TelegramBot.replyWithDocument(
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyMarkup: KeyboardMarkup? = null allowSendingWithoutReply: Boolean? = null,
) = sendDocument(to.chat, document, thumb, text, parseMode, disableNotification, to.messageId, replyMarkup) replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null
) = sendDocument(to.chat, document, thumb, text, parseMode, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
suspend inline fun TelegramBot.replyWithDocument( suspend inline fun TelegramBot.replyWithDocument(
to: Message, to: Message,
@ -82,8 +95,10 @@ suspend inline fun TelegramBot.replyWithDocument(
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyMarkup: KeyboardMarkup? = null allowSendingWithoutReply: Boolean? = null,
) = sendDocument(to.chat, document, text, parseMode, disableNotification, to.messageId, replyMarkup) replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null
) = sendDocument(to.chat, document, text, parseMode, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
suspend inline fun TelegramBot.reply( suspend inline fun TelegramBot.reply(
to: Message, to: Message,
@ -91,5 +106,99 @@ suspend inline fun TelegramBot.reply(
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyMarkup: KeyboardMarkup? = null allowSendingWithoutReply: Boolean? = null,
) = replyWithDocument(to, document, text, parseMode, disableNotification, replyMarkup) replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null
) = replyWithDocument(to, document, text, parseMode, disableNotification, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
suspend inline fun TelegramBot.sendDocument(
chatId: ChatIdentifier,
document: InputFile,
thumb: InputFile? = null,
entities: List<TextSource>,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null
) = execute(
SendDocument(
chatId,
document,
thumb,
entities,
disableNotification,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup,
disableContentTypeDetection
)
)
suspend inline fun TelegramBot.sendDocument(
chat: Chat,
document: InputFile,
thumb: InputFile? = null,
entities: List<TextSource>,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null
) = sendDocument(chat.id, document, thumb, entities, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
suspend inline fun TelegramBot.sendDocument(
chatId: ChatIdentifier,
document: DocumentFile,
entities: List<TextSource>,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null
) = sendDocument(
chatId, document.fileId, document.thumb ?.fileId, entities, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection
)
suspend inline fun TelegramBot.sendDocument(
chat: Chat,
document: DocumentFile,
entities: List<TextSource>,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null
) = sendDocument(chat.id, document, entities, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
suspend inline fun TelegramBot.replyWithDocument(
to: Message,
document: InputFile,
thumb: InputFile? = null,
entities: List<TextSource>,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null
) = sendDocument(to.chat, document, thumb, entities, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
suspend inline fun TelegramBot.replyWithDocument(
to: Message,
document: DocumentFile,
entities: List<TextSource>,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null
) = sendDocument(to.chat, document, entities, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
suspend inline fun TelegramBot.reply(
to: Message,
document: DocumentFile,
entities: List<TextSource>,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null
) = replyWithDocument(to, document, entities, disableNotification, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)

View File

@ -17,10 +17,11 @@ suspend fun TelegramBot.sendMediaGroup(
chatId: ChatIdentifier, chatId: ChatIdentifier,
media: List<MediaGroupMemberInputMedia>, media: List<MediaGroupMemberInputMedia>,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null
) = execute( ) = execute(
SendMediaGroup( SendMediaGroup(
chatId, media, disableNotification, replyToMessageId chatId, media, disableNotification, replyToMessageId, allowSendingWithoutReply
) )
) )
@ -32,9 +33,10 @@ suspend fun TelegramBot.sendMediaGroup(
chat: Chat, chat: Chat,
media: List<MediaGroupMemberInputMedia>, media: List<MediaGroupMemberInputMedia>,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null
) = sendMediaGroup( ) = sendMediaGroup(
chat.id, media, disableNotification, replyToMessageId chat.id, media, disableNotification, replyToMessageId, allowSendingWithoutReply
) )
/** /**
@ -44,10 +46,11 @@ suspend fun TelegramBot.sendPlaylist(
chatId: ChatIdentifier, chatId: ChatIdentifier,
media: List<AudioMediaGroupMemberInputMedia>, media: List<AudioMediaGroupMemberInputMedia>,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null
) = execute( ) = execute(
SendPlaylist( SendPlaylist(
chatId, media, disableNotification, replyToMessageId chatId, media, disableNotification, replyToMessageId, allowSendingWithoutReply
) )
) )
@ -58,9 +61,10 @@ suspend fun TelegramBot.sendPlaylist(
chat: Chat, chat: Chat,
media: List<AudioMediaGroupMemberInputMedia>, media: List<AudioMediaGroupMemberInputMedia>,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null
) = sendPlaylist( ) = sendPlaylist(
chat.id, media, disableNotification, replyToMessageId chat.id, media, disableNotification, replyToMessageId, allowSendingWithoutReply
) )
/** /**
@ -70,10 +74,11 @@ suspend fun TelegramBot.sendDocumentsGroup(
chatId: ChatIdentifier, chatId: ChatIdentifier,
media: List<DocumentMediaGroupMemberInputMedia>, media: List<DocumentMediaGroupMemberInputMedia>,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null
) = execute( ) = execute(
SendDocumentsGroup( SendDocumentsGroup(
chatId, media, disableNotification, replyToMessageId chatId, media, disableNotification, replyToMessageId, allowSendingWithoutReply
) )
) )
@ -84,9 +89,10 @@ suspend fun TelegramBot.sendDocumentsGroup(
chat: Chat, chat: Chat,
media: List<DocumentMediaGroupMemberInputMedia>, media: List<DocumentMediaGroupMemberInputMedia>,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null
) = sendDocumentsGroup( ) = sendDocumentsGroup(
chat.id, media, disableNotification, replyToMessageId chat.id, media, disableNotification, replyToMessageId, allowSendingWithoutReply
) )
/** /**
@ -96,10 +102,11 @@ suspend fun TelegramBot.sendVisualMediaGroup(
chatId: ChatIdentifier, chatId: ChatIdentifier,
media: List<VisualMediaGroupMemberInputMedia>, media: List<VisualMediaGroupMemberInputMedia>,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null
) = execute( ) = execute(
SendVisualMediaGroup( SendVisualMediaGroup(
chatId, media, disableNotification, replyToMessageId chatId, media, disableNotification, replyToMessageId, allowSendingWithoutReply
) )
) )
@ -110,37 +117,44 @@ suspend fun TelegramBot.sendVisualMediaGroup(
chat: Chat, chat: Chat,
media: List<VisualMediaGroupMemberInputMedia>, media: List<VisualMediaGroupMemberInputMedia>,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null
) = sendVisualMediaGroup( ) = sendVisualMediaGroup(
chat.id, media, disableNotification, replyToMessageId chat.id, media, disableNotification, replyToMessageId, allowSendingWithoutReply
) )
@RiskFeature(rawSendingMediaGroupsWarning)
suspend inline fun TelegramBot.replyWithMediaGroup( suspend inline fun TelegramBot.replyWithMediaGroup(
to: Message, to: Message,
media: List<MediaGroupMemberInputMedia>, media: List<MediaGroupMemberInputMedia>,
disableNotification: Boolean = false disableNotification: Boolean = false,
) = sendMediaGroup(to.chat, media, disableNotification, to.messageId) allowSendingWithoutReply: Boolean? = null
) = sendMediaGroup(to.chat, media, disableNotification, to.messageId, allowSendingWithoutReply)
suspend inline fun TelegramBot.replyWithPlaylist( suspend inline fun TelegramBot.replyWithPlaylist(
to: Message, to: Message,
media: List<AudioMediaGroupMemberInputMedia>, media: List<AudioMediaGroupMemberInputMedia>,
disableNotification: Boolean = false disableNotification: Boolean = false,
) = sendPlaylist(to.chat, media, disableNotification, to.messageId) allowSendingWithoutReply: Boolean? = null
) = sendPlaylist(to.chat, media, disableNotification, to.messageId, allowSendingWithoutReply)
suspend inline fun TelegramBot.replyWithDocumentsGroup( suspend inline fun TelegramBot.replyWithDocumentsGroup(
to: Message, to: Message,
media: List<DocumentMediaGroupMemberInputMedia>, media: List<DocumentMediaGroupMemberInputMedia>,
disableNotification: Boolean = false disableNotification: Boolean = false,
) = sendDocumentsGroup(to.chat, media, disableNotification, to.messageId) allowSendingWithoutReply: Boolean? = null
) = sendDocumentsGroup(to.chat, media, disableNotification, to.messageId, allowSendingWithoutReply)
suspend inline fun TelegramBot.replyWithVisualMediaGroup( suspend inline fun TelegramBot.replyWithVisualMediaGroup(
to: Message, to: Message,
media: List<VisualMediaGroupMemberInputMedia>, media: List<VisualMediaGroupMemberInputMedia>,
disableNotification: Boolean = false disableNotification: Boolean = false,
) = sendVisualMediaGroup(to.chat, media, disableNotification, to.messageId) allowSendingWithoutReply: Boolean? = null
) = sendVisualMediaGroup(to.chat, media, disableNotification, to.messageId, allowSendingWithoutReply)
suspend inline fun TelegramBot.reply( suspend inline fun TelegramBot.reply(
to: Message, to: Message,
media: List<MediaGroupMemberInputMedia>, media: List<MediaGroupMemberInputMedia>,
disableNotification: Boolean = false disableNotification: Boolean = false,
) = replyWithMediaGroup(to, media, disableNotification) allowSendingWithoutReply: Boolean? = null
) = replyWithMediaGroup(to, media, disableNotification, allowSendingWithoutReply)

View File

@ -1,5 +1,6 @@
package dev.inmo.tgbotapi.extensions.api.send.media package dev.inmo.tgbotapi.extensions.api.send.media
import dev.inmo.tgbotapi.CommonAbstracts.TextSource
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.abstracts.InputFile import dev.inmo.tgbotapi.requests.abstracts.InputFile
import dev.inmo.tgbotapi.requests.send.media.SendPhoto import dev.inmo.tgbotapi.requests.send.media.SendPhoto
@ -19,6 +20,7 @@ suspend fun TelegramBot.sendPhoto(
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = execute( ) = execute(
SendPhoto( SendPhoto(
@ -28,6 +30,7 @@ suspend fun TelegramBot.sendPhoto(
parseMode, parseMode,
disableNotification, disableNotification,
replyToMessageId, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )
) )
@ -39,8 +42,9 @@ suspend fun TelegramBot.sendPhoto(
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendPhoto(chat.id, fileId, caption, parseMode, disableNotification, replyToMessageId, replyMarkup) ) = sendPhoto(chat.id, fileId, caption, parseMode, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
suspend fun TelegramBot.sendPhoto( suspend fun TelegramBot.sendPhoto(
chatId: ChatIdentifier, chatId: ChatIdentifier,
@ -49,8 +53,9 @@ suspend fun TelegramBot.sendPhoto(
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendPhoto(chatId, photo.biggest() ?.fileId ?: error("Photo content must not be empty"), caption, parseMode, disableNotification, replyToMessageId, replyMarkup) ) = sendPhoto(chatId, photo.biggest() ?.fileId ?: error("Photo content must not be empty"), caption, parseMode, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
suspend fun TelegramBot.sendPhoto( suspend fun TelegramBot.sendPhoto(
chat: Chat, chat: Chat,
@ -59,8 +64,9 @@ suspend fun TelegramBot.sendPhoto(
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendPhoto(chat.id, photo, caption, parseMode, disableNotification, replyToMessageId, replyMarkup) ) = sendPhoto(chat.id, photo, caption, parseMode, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.replyWithPhoto( suspend inline fun TelegramBot.replyWithPhoto(
to: Message, to: Message,
@ -68,8 +74,9 @@ suspend inline fun TelegramBot.replyWithPhoto(
caption: String? = null, caption: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendPhoto(to.chat, fileId, caption, parseMode, disableNotification, to.messageId, replyMarkup) ) = sendPhoto(to.chat, fileId, caption, parseMode, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.replyWithPhoto( suspend inline fun TelegramBot.replyWithPhoto(
to: Message, to: Message,
@ -77,8 +84,9 @@ suspend inline fun TelegramBot.replyWithPhoto(
caption: String? = null, caption: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendPhoto(to.chat, photo, caption, parseMode, disableNotification, to.messageId, replyMarkup) ) = sendPhoto(to.chat, photo, caption, parseMode, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.reply( suspend inline fun TelegramBot.reply(
to: Message, to: Message,
@ -86,5 +94,84 @@ suspend inline fun TelegramBot.reply(
caption: String? = null, caption: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = replyWithPhoto(to, photo, caption, parseMode, disableNotification, replyMarkup) ) = replyWithPhoto(to, photo, caption, parseMode, disableNotification, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.sendPhoto(
chatId: ChatIdentifier,
fileId: InputFile,
entities: List<TextSource>,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendPhoto(
chatId,
fileId,
entities,
disableNotification,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup
)
)
suspend inline fun TelegramBot.sendPhoto(
chat: Chat,
fileId: InputFile,
entities: List<TextSource>,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPhoto(chat.id, fileId, entities, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.sendPhoto(
chatId: ChatIdentifier,
photo: Photo,
entities: List<TextSource>,
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)
suspend inline fun TelegramBot.sendPhoto(
chat: Chat,
photo: Photo,
entities: List<TextSource>,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPhoto(chat.id, photo, entities, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.replyWithPhoto(
to: Message,
fileId: InputFile,
entities: List<TextSource>,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPhoto(to.chat, fileId, entities, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.replyWithPhoto(
to: Message,
photo: Photo,
entities: List<TextSource>,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPhoto(to.chat, photo, entities, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.reply(
to: Message,
photo: Photo,
entities: List<TextSource>,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = replyWithPhoto(to, photo, entities, disableNotification, allowSendingWithoutReply, replyMarkup)

View File

@ -15,9 +15,10 @@ suspend fun TelegramBot.sendSticker(
sticker: InputFile, sticker: InputFile,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = execute( ) = execute(
SendSticker(chatId, sticker, disableNotification, replyToMessageId, replyMarkup) SendSticker(chatId, sticker, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) )
suspend fun TelegramBot.sendSticker( suspend fun TelegramBot.sendSticker(
@ -25,42 +26,48 @@ suspend fun TelegramBot.sendSticker(
sticker: InputFile, sticker: InputFile,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendSticker(chat.id, sticker, disableNotification, replyToMessageId, replyMarkup) ) = sendSticker(chat.id, sticker, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
suspend fun TelegramBot.sendSticker( suspend fun TelegramBot.sendSticker(
chatId: ChatIdentifier, chatId: ChatIdentifier,
sticker: Sticker, sticker: Sticker,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendSticker(chatId, sticker.fileId, disableNotification, replyToMessageId, replyMarkup) ) = sendSticker(chatId, sticker.fileId, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
suspend fun TelegramBot.sendSticker( suspend fun TelegramBot.sendSticker(
chat: Chat, chat: Chat,
sticker: Sticker, sticker: Sticker,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendSticker(chat, sticker.fileId, disableNotification, replyToMessageId, replyMarkup) ) = sendSticker(chat, sticker.fileId, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.replyWithSticker( suspend inline fun TelegramBot.replyWithSticker(
to: Message, to: Message,
sticker: InputFile, sticker: InputFile,
disableNotification: Boolean = false, disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendSticker(to.chat, sticker, disableNotification, to.messageId, replyMarkup) ) = sendSticker(to.chat, sticker, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.replyWithSticker( suspend inline fun TelegramBot.replyWithSticker(
to: Message, to: Message,
sticker: Sticker, sticker: Sticker,
disableNotification: Boolean = false, disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendSticker(to.chat, sticker, disableNotification, to.messageId, replyMarkup) ) = sendSticker(to.chat, sticker, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.reply( suspend inline fun TelegramBot.reply(
to: Message, to: Message,
sticker: Sticker, sticker: Sticker,
disableNotification: Boolean = false, disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = replyWithSticker(to, sticker, disableNotification, replyMarkup) ) = replyWithSticker(to, sticker, disableNotification, allowSendingWithoutReply, replyMarkup)

View File

@ -1,5 +1,6 @@
package dev.inmo.tgbotapi.extensions.api.send.media package dev.inmo.tgbotapi.extensions.api.send.media
import dev.inmo.tgbotapi.CommonAbstracts.TextSource
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.abstracts.InputFile import dev.inmo.tgbotapi.requests.abstracts.InputFile
import dev.inmo.tgbotapi.requests.send.media.SendVideo import dev.inmo.tgbotapi.requests.send.media.SendVideo
@ -22,6 +23,7 @@ suspend fun TelegramBot.sendVideo(
height: Int? = null, height: Int? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = execute( ) = execute(
SendVideo( SendVideo(
@ -36,6 +38,7 @@ suspend fun TelegramBot.sendVideo(
null, null,
disableNotification, disableNotification,
replyToMessageId, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )
) )
@ -47,8 +50,9 @@ suspend fun TelegramBot.sendVideo(
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVideo(chatId, video.fileId, video.thumb ?.fileId, text, parseMode, video.duration, video.width, video.height, disableNotification, replyToMessageId, replyMarkup) ) = sendVideo(chatId, video.fileId, video.thumb ?.fileId, text, parseMode, video.duration, video.width, video.height, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
suspend fun TelegramBot.sendVideo( suspend fun TelegramBot.sendVideo(
chat: Chat, chat: Chat,
@ -61,8 +65,9 @@ suspend fun TelegramBot.sendVideo(
height: Int? = null, height: Int? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVideo(chat.id, video, thumb, text, parseMode, duration, width, height, disableNotification, replyToMessageId, replyMarkup) ) = sendVideo(chat.id, video, thumb, text, parseMode, duration, width, height, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
suspend fun TelegramBot.sendVideo( suspend fun TelegramBot.sendVideo(
@ -72,8 +77,9 @@ suspend fun TelegramBot.sendVideo(
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVideo(chat.id, video, text, parseMode, disableNotification, replyToMessageId, replyMarkup) ) = sendVideo(chat.id, video, text, parseMode, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.replyWithVideo( suspend inline fun TelegramBot.replyWithVideo(
to: Message, to: Message,
@ -85,8 +91,9 @@ suspend inline fun TelegramBot.replyWithVideo(
width: Int? = null, width: Int? = null,
height: Int? = null, height: Int? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVideo(to.chat, video, thumb, text, parseMode, duration, width, height, disableNotification, to.messageId, replyMarkup) ) = sendVideo(to.chat, video, thumb, text, parseMode, duration, width, height, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.replyWithVideo( suspend inline fun TelegramBot.replyWithVideo(
to: Message, to: Message,
@ -94,8 +101,9 @@ suspend inline fun TelegramBot.replyWithVideo(
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVideo(to.chat, video, text, parseMode, disableNotification, to.messageId, replyMarkup) ) = sendVideo(to.chat, video, text, parseMode, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.reply( suspend inline fun TelegramBot.reply(
to: Message, to: Message,
@ -103,5 +111,102 @@ suspend inline fun TelegramBot.reply(
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = replyWithVideo(to, video, text, parseMode, disableNotification, replyMarkup) ) = replyWithVideo(to, video, text, parseMode, disableNotification, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.sendVideo(
chatId: ChatIdentifier,
video: InputFile,
thumb: InputFile? = null,
entities: List<TextSource>,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendVideo(
chatId,
video,
thumb,
entities,
duration,
width,
height,
null,
disableNotification,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup
)
)
suspend inline fun TelegramBot.sendVideo(
chatId: ChatIdentifier,
video: VideoFile,
entities: List<TextSource>,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVideo(chatId, video.fileId, video.thumb ?.fileId, entities, video.duration, video.width, video.height, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.sendVideo(
chat: Chat,
video: InputFile,
thumb: InputFile? = null,
entities: List<TextSource>,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVideo(chat.id, video, thumb, entities, duration, width, height, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.sendVideo(
chat: Chat,
video: VideoFile,
entities: List<TextSource>,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVideo(chat.id, video, entities, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.replyWithVideo(
to: Message,
video: InputFile,
thumb: InputFile? = null,
entities: List<TextSource>,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVideo(to.chat, video, thumb, entities, duration, width, height, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.replyWithVideo(
to: Message,
video: VideoFile,
entities: List<TextSource>,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVideo(to.chat, video, entities, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.reply(
to: Message,
video: VideoFile,
entities: List<TextSource>,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = replyWithVideo(to, video, entities, disableNotification, allowSendingWithoutReply, replyMarkup)

View File

@ -16,24 +16,22 @@ suspend fun TelegramBot.sendVideoNote(
chatId: ChatIdentifier, chatId: ChatIdentifier,
videoNote: InputFile, videoNote: InputFile,
thumb: InputFile? = null, thumb: InputFile? = null,
text: String? = null,
parseMode: ParseMode? = null,
duration: Long? = null, duration: Long? = null,
size: Int? = null, size: Int? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = execute( ) = execute(
SendVideoNote( SendVideoNote(
chatId, chatId,
videoNote, videoNote,
thumb, thumb,
text,
parseMode,
duration, duration,
size, size,
disableNotification, disableNotification,
replyToMessageId, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )
) )
@ -41,64 +39,58 @@ suspend fun TelegramBot.sendVideoNote(
suspend fun TelegramBot.sendVideoNote( suspend fun TelegramBot.sendVideoNote(
chatId: ChatIdentifier, chatId: ChatIdentifier,
videoNote: VideoNoteFile, videoNote: VideoNoteFile,
text: String? = null,
parseMode: ParseMode? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVideoNote( ) = sendVideoNote(
chatId, videoNote.fileId, videoNote.thumb ?.fileId, text, parseMode, videoNote.duration, videoNote.width, disableNotification, replyToMessageId, replyMarkup chatId, videoNote.fileId, videoNote.thumb ?.fileId, videoNote.duration, videoNote.width, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
suspend fun TelegramBot.sendVideoNote( suspend fun TelegramBot.sendVideoNote(
chat: Chat, chat: Chat,
videoNote: InputFile, videoNote: InputFile,
thumb: InputFile? = null, thumb: InputFile? = null,
text: String? = null,
parseMode: ParseMode? = null,
duration: Long? = null, duration: Long? = null,
size: Int? = null, size: Int? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVideoNote(chat.id, videoNote, thumb, text, parseMode, duration, size, disableNotification, replyToMessageId, replyMarkup) ) = sendVideoNote(chat.id, videoNote, thumb, duration, size, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
suspend fun TelegramBot.sendVideoNote( suspend fun TelegramBot.sendVideoNote(
chat: Chat, chat: Chat,
videoNote: VideoNoteFile, videoNote: VideoNoteFile,
text: String? = null,
parseMode: ParseMode? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVideoNote(chat.id, videoNote, text, parseMode, disableNotification, replyToMessageId, replyMarkup) ) = sendVideoNote(chat.id, videoNote, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.replyWithVideoNote( suspend inline fun TelegramBot.replyWithVideoNote(
to: Message, to: Message,
videoNote: InputFile, videoNote: InputFile,
thumb: InputFile? = null, thumb: InputFile? = null,
text: String? = null,
parseMode: ParseMode? = null,
duration: Long? = null, duration: Long? = null,
size: Int? = null, size: Int? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVideoNote(to.chat, videoNote, thumb, text, parseMode, duration, size, disableNotification, to.messageId, replyMarkup) ) = sendVideoNote(to.chat, videoNote, thumb, duration, size, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.replyWithVideoNote( suspend inline fun TelegramBot.replyWithVideoNote(
to: Message, to: Message,
videoNote: VideoNoteFile, videoNote: VideoNoteFile,
text: String? = null,
parseMode: ParseMode? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVideoNote(to.chat, videoNote, text, parseMode, disableNotification, to.messageId, replyMarkup) ) = sendVideoNote(to.chat, videoNote, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.reply( suspend inline fun TelegramBot.reply(
to: Message, to: Message,
videoNote: VideoNoteFile, videoNote: VideoNoteFile,
text: String? = null,
parseMode: ParseMode? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = replyWithVideoNote(to, videoNote, text, parseMode, disableNotification, replyMarkup) ) = replyWithVideoNote(to, videoNote, disableNotification, allowSendingWithoutReply, replyMarkup)

View File

@ -1,5 +1,6 @@
package dev.inmo.tgbotapi.extensions.api.send.media package dev.inmo.tgbotapi.extensions.api.send.media
import dev.inmo.tgbotapi.CommonAbstracts.TextSource
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.abstracts.InputFile import dev.inmo.tgbotapi.requests.abstracts.InputFile
import dev.inmo.tgbotapi.requests.send.media.SendVoice import dev.inmo.tgbotapi.requests.send.media.SendVoice
@ -20,6 +21,7 @@ suspend fun TelegramBot.sendVoice(
duration: Long? = null, duration: Long? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = execute( ) = execute(
SendVoice( SendVoice(
@ -30,6 +32,7 @@ suspend fun TelegramBot.sendVoice(
duration, duration,
disableNotification, disableNotification,
replyToMessageId, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )
) )
@ -42,8 +45,9 @@ suspend fun TelegramBot.sendVoice(
duration: Long? = null, duration: Long? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVoice(chat.id, voice, text, parseMode, duration, disableNotification, replyToMessageId, replyMarkup) ) = sendVoice(chat.id, voice, text, parseMode, duration, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
suspend fun TelegramBot.sendVoice( suspend fun TelegramBot.sendVoice(
chatId: ChatIdentifier, chatId: ChatIdentifier,
@ -52,9 +56,10 @@ suspend fun TelegramBot.sendVoice(
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVoice( ) = sendVoice(
chatId, voice.fileId, text, parseMode, voice.duration, disableNotification, replyToMessageId, replyMarkup chatId, voice.fileId, text, parseMode, voice.duration, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
suspend fun TelegramBot.sendVoice( suspend fun TelegramBot.sendVoice(
@ -64,8 +69,9 @@ suspend fun TelegramBot.sendVoice(
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVoice(chat.id, voice, text, parseMode, disableNotification, replyToMessageId, replyMarkup) ) = sendVoice(chat.id, voice, text, parseMode, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.replyWithVoice( suspend inline fun TelegramBot.replyWithVoice(
to: Message, to: Message,
@ -74,8 +80,9 @@ suspend inline fun TelegramBot.replyWithVoice(
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
duration: Long? = null, duration: Long? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVoice(to.chat, voice, text, parseMode, duration, disableNotification, to.messageId, replyMarkup) ) = sendVoice(to.chat, voice, text, parseMode, duration, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.replyWithVoice( suspend inline fun TelegramBot.replyWithVoice(
to: Message, to: Message,
@ -83,8 +90,9 @@ suspend inline fun TelegramBot.replyWithVoice(
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVoice(to.chat, voice, text, parseMode, disableNotification, to.messageId, replyMarkup) ) = sendVoice(to.chat, voice, text, parseMode, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.reply( suspend inline fun TelegramBot.reply(
to: Message, to: Message,
@ -92,5 +100,90 @@ suspend inline fun TelegramBot.reply(
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = replyWithVoice(to, voice, text, parseMode, disableNotification, replyMarkup) ) = replyWithVoice(to, voice, text, parseMode, disableNotification, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.sendVoice(
chatId: ChatIdentifier,
voice: InputFile,
entities: List<TextSource>,
duration: Long? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendVoice(
chatId,
voice,
entities,
duration,
disableNotification,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup
)
)
suspend inline fun TelegramBot.sendVoice(
chat: Chat,
voice: InputFile,
entities: List<TextSource>,
duration: Long? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVoice(chat.id, voice, entities, duration, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.sendVoice(
chatId: ChatIdentifier,
voice: VoiceFile,
entities: List<TextSource>,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVoice(
chatId, voice.fileId, entities, voice.duration, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
)
suspend inline fun TelegramBot.sendVoice(
chat: Chat,
voice: VoiceFile,
entities: List<TextSource>,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVoice(chat.id, voice, entities, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.replyWithVoice(
to: Message,
voice: InputFile,
entities: List<TextSource>,
duration: Long? = null,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVoice(to.chat, voice, entities, duration, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.replyWithVoice(
to: Message,
voice: VoiceFile,
entities: List<TextSource>,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVoice(to.chat, voice, entities, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.reply(
to: Message,
voice: VoiceFile,
entities: List<TextSource>,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = replyWithVoice(to, voice, entities, disableNotification, allowSendingWithoutReply, replyMarkup)

View File

@ -27,9 +27,10 @@ suspend fun TelegramBot.sendInvoice(
priceDependOnShipAddress: Boolean = false, priceDependOnShipAddress: Boolean = false,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = execute( ) = execute(
SendInvoice(chatId, title, description, payload, providerToken, startParameter, currency, prices, providerData, requireName, requirePhoneNumber, requireEmail, requireShippingAddress, shouldSendPhoneNumberToProvider, shouldSendEmailToProvider, priceDependOnShipAddress, disableNotification, replyToMessageId, replyMarkup) SendInvoice(chatId, title, description, payload, providerToken, startParameter, currency, prices, providerData, requireName, requirePhoneNumber, requireEmail, requireShippingAddress, shouldSendPhoneNumberToProvider, shouldSendEmailToProvider, priceDependOnShipAddress, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) )
suspend fun TelegramBot.sendInvoice( suspend fun TelegramBot.sendInvoice(
@ -51,8 +52,9 @@ suspend fun TelegramBot.sendInvoice(
priceDependOnShipAddress: Boolean = false, priceDependOnShipAddress: Boolean = false,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = sendInvoice(user.id, title, description, payload, providerToken, startParameter, currency, prices, providerData, requireName, requirePhoneNumber, requireEmail, requireShippingAddress, shouldSendPhoneNumberToProvider, shouldSendEmailToProvider, priceDependOnShipAddress, disableNotification, replyToMessageId, replyMarkup) ) = sendInvoice(user.id, title, description, payload, providerToken, startParameter, currency, prices, providerData, requireName, requirePhoneNumber, requireEmail, requireShippingAddress, shouldSendPhoneNumberToProvider, shouldSendEmailToProvider, priceDependOnShipAddress, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.replyWithInvoice( suspend inline fun TelegramBot.replyWithInvoice(
to: Message, to: Message,
@ -72,5 +74,6 @@ suspend inline fun TelegramBot.replyWithInvoice(
shouldSendEmailToProvider: Boolean = false, shouldSendEmailToProvider: Boolean = false,
priceDependOnShipAddress: Boolean = false, priceDependOnShipAddress: Boolean = false,
disableNotification: Boolean = false, disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = sendInvoice(to.chat.id, title, description, payload, providerToken, startParameter, currency, prices, providerData, requireName, requirePhoneNumber, requireEmail, requireShippingAddress, shouldSendPhoneNumberToProvider, shouldSendEmailToProvider, priceDependOnShipAddress, disableNotification, to.messageId, replyMarkup) ) = sendInvoice(to.chat.id, title, description, payload, providerToken, startParameter, currency, prices, providerData, requireName, requirePhoneNumber, requireEmail, requireShippingAddress, shouldSendPhoneNumberToProvider, shouldSendEmailToProvider, priceDependOnShipAddress, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)

View File

@ -1,5 +1,6 @@
package dev.inmo.tgbotapi.extensions.api.send.polls package dev.inmo.tgbotapi.extensions.api.send.polls
import dev.inmo.tgbotapi.CommonAbstracts.TextSource
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.send.polls.SendQuizPoll import dev.inmo.tgbotapi.requests.send.polls.SendQuizPoll
import dev.inmo.tgbotapi.requests.send.polls.SendRegularPoll import dev.inmo.tgbotapi.requests.send.polls.SendRegularPoll
@ -21,10 +22,11 @@ suspend fun TelegramBot.sendRegularPoll(
closeInfo: ScheduledCloseInfo? = null, closeInfo: ScheduledCloseInfo? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = execute( ) = execute(
SendRegularPoll( SendRegularPoll(
chatId, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, disableNotification, replyToMessageId, replyMarkup chatId, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
) )
suspend fun TelegramBot.sendRegularPoll( suspend fun TelegramBot.sendRegularPoll(
@ -38,8 +40,9 @@ suspend fun TelegramBot.sendRegularPoll(
closeInfo: ScheduledCloseInfo? = null, closeInfo: ScheduledCloseInfo? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendRegularPoll(chatId, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, disableNotification, replyToMessageId, replyMarkup) ) = sendRegularPoll(chatId, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup)
suspend fun TelegramBot.sendRegularPoll( suspend fun TelegramBot.sendRegularPoll(
chat: Chat, chat: Chat,
@ -51,9 +54,10 @@ suspend fun TelegramBot.sendRegularPoll(
closeInfo: ScheduledCloseInfo? = null, closeInfo: ScheduledCloseInfo? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendRegularPoll( ) = sendRegularPoll(
chat.id, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, disableNotification, replyToMessageId, replyMarkup chat.id, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
suspend fun TelegramBot.sendRegularPoll( suspend fun TelegramBot.sendRegularPoll(
@ -67,9 +71,10 @@ suspend fun TelegramBot.sendRegularPoll(
closeInfo: ScheduledCloseInfo? = null, closeInfo: ScheduledCloseInfo? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendRegularPoll( ) = sendRegularPoll(
chat.id, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, disableNotification, replyToMessageId, replyMarkup chat.id, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
@ -85,10 +90,11 @@ suspend fun TelegramBot.sendQuizPoll(
closeInfo: ScheduledCloseInfo? = null, closeInfo: ScheduledCloseInfo? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = execute( ) = execute(
SendQuizPoll( SendQuizPoll(
chatId, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, disableNotification, replyToMessageId, replyMarkup chatId, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
) )
@ -104,9 +110,10 @@ suspend fun TelegramBot.sendQuizPoll(
closeInfo: ScheduledCloseInfo? = null, closeInfo: ScheduledCloseInfo? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendQuizPoll( ) = sendQuizPoll(
chat.id, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, disableNotification, replyToMessageId, replyMarkup chat.id, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
suspend fun TelegramBot.sendQuizPoll( suspend fun TelegramBot.sendQuizPoll(
@ -122,9 +129,10 @@ suspend fun TelegramBot.sendQuizPoll(
closeInfo: ScheduledCloseInfo? = null, closeInfo: ScheduledCloseInfo? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendQuizPoll( ) = sendQuizPoll(
chatId, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, disableNotification, replyToMessageId, replyMarkup chatId, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
suspend fun TelegramBot.sendQuizPoll( suspend fun TelegramBot.sendQuizPoll(
@ -140,9 +148,83 @@ suspend fun TelegramBot.sendQuizPoll(
closeInfo: ScheduledCloseInfo? = null, closeInfo: ScheduledCloseInfo? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendQuizPoll( ) = sendQuizPoll(
chat.id, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, disableNotification, replyToMessageId, replyMarkup chat.id, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
)
suspend inline fun TelegramBot.sendQuizPoll(
chatId: ChatIdentifier,
question: String,
options: List<String>,
correctOptionId: Int,
isAnonymous: Boolean = true,
isClosed: Boolean = false,
entities: List<TextSource>,
closeInfo: ScheduledCloseInfo? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendQuizPoll(
chatId, question, options, correctOptionId, isAnonymous, isClosed, entities, closeInfo, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
)
)
suspend inline fun TelegramBot.sendQuizPoll(
chat: Chat,
question: String,
options: List<String>,
correctOptionId: Int,
isAnonymous: Boolean = true,
isClosed: Boolean = false,
entities: List<TextSource>,
closeInfo: ScheduledCloseInfo? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendQuizPoll(
chat.id, question, options, correctOptionId, isAnonymous, isClosed, entities, closeInfo, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
)
suspend inline fun TelegramBot.sendQuizPoll(
chatId: ChatIdentifier,
isClosed: Boolean = false,
quizPoll: QuizPoll,
question: String = quizPoll.question,
options: List<String> = quizPoll.options.map { it.text },
correctOptionId: Int = quizPoll.correctOptionId ?: error("Correct option ID must be provided by income QuizPoll or by developer"),
isAnonymous: Boolean = quizPoll.isAnonymous,
entities: List<TextSource>,
closeInfo: ScheduledCloseInfo? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendQuizPoll(
chatId, question, options, correctOptionId, isAnonymous, isClosed, entities, closeInfo, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
)
suspend inline fun TelegramBot.sendQuizPoll(
chat: Chat,
isClosed: Boolean = false,
quizPoll: QuizPoll,
question: String = quizPoll.question,
options: List<String> = quizPoll.options.map { it.text },
correctOptionId: Int = quizPoll.correctOptionId ?: error("Correct option ID must be provided by income QuizPoll or by developer"),
isAnonymous: Boolean = quizPoll.isAnonymous,
entities: List<TextSource>,
closeInfo: ScheduledCloseInfo? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendQuizPoll(
chat.id, question, options, correctOptionId, isAnonymous, isClosed, entities, closeInfo, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
suspend inline fun TelegramBot.replyWithRegularPoll( suspend inline fun TelegramBot.replyWithRegularPoll(
@ -154,8 +236,9 @@ suspend inline fun TelegramBot.replyWithRegularPoll(
allowMultipleAnswers: Boolean = false, allowMultipleAnswers: Boolean = false,
closeInfo: ScheduledCloseInfo? = null, closeInfo: ScheduledCloseInfo? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendRegularPoll(to.chat, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, disableNotification, to.messageId, replyMarkup) ) = sendRegularPoll(to.chat, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.replyWithRegularPoll( suspend inline fun TelegramBot.replyWithRegularPoll(
to: Message, to: Message,
@ -167,8 +250,9 @@ suspend inline fun TelegramBot.replyWithRegularPoll(
allowMultipleAnswers: Boolean = poll.allowMultipleAnswers, allowMultipleAnswers: Boolean = poll.allowMultipleAnswers,
closeInfo: ScheduledCloseInfo? = null, closeInfo: ScheduledCloseInfo? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendRegularPoll(to.chat, poll, isClosed, question, options, isAnonymous, allowMultipleAnswers, closeInfo, disableNotification, to.messageId, replyMarkup) ) = sendRegularPoll(to.chat, poll, isClosed, question, options, isAnonymous, allowMultipleAnswers, closeInfo, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.replyWithQuizPoll( suspend inline fun TelegramBot.replyWithQuizPoll(
to: Message, to: Message,
@ -181,8 +265,9 @@ suspend inline fun TelegramBot.replyWithQuizPoll(
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
closeInfo: ScheduledCloseInfo? = null, closeInfo: ScheduledCloseInfo? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendQuizPoll(to.chat, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, disableNotification, to.messageId, replyMarkup) ) = sendQuizPoll(to.chat, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.replyWithQuizPoll( suspend inline fun TelegramBot.replyWithQuizPoll(
to: Message, to: Message,
@ -196,6 +281,35 @@ suspend inline fun TelegramBot.replyWithQuizPoll(
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
closeInfo: ScheduledCloseInfo? = null, closeInfo: ScheduledCloseInfo? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendQuizPoll(to.chat, isClosed, quizPoll, question, options, correctOptionId, isAnonymous, explanation, parseMode, closeInfo, disableNotification, to.messageId, replyMarkup) ) = sendQuizPoll(to.chat, isClosed, quizPoll, question, options, correctOptionId, isAnonymous, explanation, parseMode, closeInfo, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.replyWithQuizPoll(
to: Message,
question: String,
options: List<String>,
correctOptionId: Int,
isAnonymous: Boolean = true,
isClosed: Boolean = false,
entities: List<TextSource>,
closeInfo: ScheduledCloseInfo? = null,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendQuizPoll(to.chat, question, options, correctOptionId, isAnonymous, isClosed, entities, closeInfo, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.replyWithQuizPoll(
to: Message,
isClosed: Boolean = false,
quizPoll: QuizPoll,
question: String = quizPoll.question,
options: List<String> = quizPoll.options.map { it.text },
correctOptionId: Int = quizPoll.correctOptionId ?: error("Correct option ID must be provided by income QuizPoll or by developer"),
isAnonymous: Boolean = quizPoll.isAnonymous,
entities: List<TextSource>,
closeInfo: ScheduledCloseInfo? = null,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendQuizPoll(to.chat, isClosed, quizPoll, question, options, correctOptionId, isAnonymous, entities, closeInfo, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup)

View File

@ -10,11 +10,13 @@ import dev.inmo.tgbotapi.requests.webhook.SetWebhook
*/ */
suspend fun TelegramBot.setWebhookInfo( suspend fun TelegramBot.setWebhookInfo(
url: String, url: String,
ipAddress: String? = null,
maxAllowedConnections: Int? = null, maxAllowedConnections: Int? = null,
allowedUpdates: List<String>? = null allowedUpdates: List<String>? = null,
dropPendingUpdates: Boolean? = null
) = execute( ) = execute(
SetWebhook( SetWebhook(
url, maxAllowedConnections, allowedUpdates url, ipAddress, maxAllowedConnections, allowedUpdates, dropPendingUpdates
) )
) )
@ -24,11 +26,13 @@ suspend fun TelegramBot.setWebhookInfo(
suspend fun TelegramBot.setWebhookInfo( suspend fun TelegramBot.setWebhookInfo(
url: String, url: String,
certificate: FileId, certificate: FileId,
ipAddress: String? = null,
maxAllowedConnections: Int? = null, maxAllowedConnections: Int? = null,
allowedUpdates: List<String>? = null allowedUpdates: List<String>? = null,
dropPendingUpdates: Boolean? = null
) = execute( ) = execute(
SetWebhook( SetWebhook(
url, certificate, maxAllowedConnections, allowedUpdates url, certificate, ipAddress, maxAllowedConnections, allowedUpdates, dropPendingUpdates
) )
) )
@ -38,10 +42,12 @@ suspend fun TelegramBot.setWebhookInfo(
suspend fun TelegramBot.setWebhookInfo( suspend fun TelegramBot.setWebhookInfo(
url: String, url: String,
certificate: MultipartFile, certificate: MultipartFile,
ipAddress: String? = null,
maxAllowedConnections: Int? = null, maxAllowedConnections: Int? = null,
allowedUpdates: List<String>? = null allowedUpdates: List<String>? = null,
dropPendingUpdates: Boolean? = null
) = execute( ) = execute(
SetWebhook( SetWebhook(
url, certificate, maxAllowedConnections, allowedUpdates url, certificate, ipAddress, maxAllowedConnections, allowedUpdates, dropPendingUpdates
) )
) )