mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2025-09-15 05:09:30 +00:00
update extnsions.api
This commit is contained in:
@@ -3,6 +3,7 @@ package dev.inmo.tgbotapi.requests.edit.LiveLocation
|
||||
import dev.inmo.tgbotapi.requests.edit.abstracts.*
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
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.TelegramBotAPIMessageDeserializationStrategyClass
|
||||
import dev.inmo.tgbotapi.types.message.content.LocationContent
|
||||
|
@@ -16,7 +16,7 @@ import kotlinx.serialization.builtins.serializer
|
||||
@Serializable
|
||||
object Close : SimpleRequest<Boolean> {
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = LogOut.serializer()
|
||||
get() = serializer()
|
||||
|
||||
override fun method(): String = "close"
|
||||
|
||||
|
@@ -46,6 +46,7 @@ fun SendPoll(
|
||||
isClosed: Boolean = false,
|
||||
disableNotification: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = SendRegularPoll(
|
||||
chatId,
|
||||
@@ -53,6 +54,7 @@ fun SendPoll(
|
||||
options,
|
||||
isAnonymous,
|
||||
isClosed,
|
||||
allowSendingWithoutReply = allowSendingWithoutReply,
|
||||
disableNotification = disableNotification,
|
||||
replyToMessageId = replyToMessageId,
|
||||
replyMarkup = replyMarkup
|
||||
|
@@ -2,6 +2,7 @@ package dev.inmo.tgbotapi.types.InlineQueries.query
|
||||
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.InlineQuery
|
||||
import dev.inmo.tgbotapi.types.location.Location
|
||||
import dev.inmo.tgbotapi.types.location.StaticLocation
|
||||
|
||||
data class LocationInlineQuery(
|
||||
@@ -9,5 +10,5 @@ data class LocationInlineQuery(
|
||||
override val from: User,
|
||||
override val query: String,
|
||||
override val offset: String,
|
||||
val location: StaticLocation
|
||||
val location: Location
|
||||
) : InlineQuery
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package dev.inmo.tgbotapi.types.InlineQueries.query
|
||||
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.location.Location
|
||||
import dev.inmo.tgbotapi.types.location.StaticLocation
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
@@ -16,7 +17,7 @@ internal data class RawInlineQuery(
|
||||
@SerialName(offsetField)
|
||||
val offset: String,
|
||||
@SerialName(locationField)
|
||||
val location: StaticLocation? = null
|
||||
val location: Location? = null
|
||||
) {
|
||||
val asInlineQuery by lazy {
|
||||
location ?.let {
|
||||
|
@@ -14,8 +14,9 @@ data class ContactContent(
|
||||
chatId: ChatIdentifier,
|
||||
disableNotification: Boolean,
|
||||
replyToMessageId: MessageIdentifier?,
|
||||
allowSendingWithoutReply: Boolean?,
|
||||
replyMarkup: KeyboardMarkup?
|
||||
): Request<ContentMessage<ContactContent>> = SendContact(
|
||||
chatId, contact, disableNotification, replyToMessageId, replyMarkup
|
||||
chatId, contact, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
||||
)
|
||||
}
|
@@ -16,12 +16,14 @@ data class DiceContent(
|
||||
chatId: ChatIdentifier,
|
||||
disableNotification: Boolean,
|
||||
replyToMessageId: MessageIdentifier?,
|
||||
allowSendingWithoutReply: Boolean?,
|
||||
replyMarkup: KeyboardMarkup?
|
||||
): Request<ContentMessage<DiceContent>> = SendDice(
|
||||
chatId,
|
||||
dice.animationType,
|
||||
disableNotification,
|
||||
replyToMessageId,
|
||||
allowSendingWithoutReply,
|
||||
replyMarkup
|
||||
)
|
||||
}
|
||||
|
@@ -16,12 +16,14 @@ data class GameContent(
|
||||
chatId: ChatIdentifier,
|
||||
disableNotification: Boolean,
|
||||
replyToMessageId: MessageIdentifier?,
|
||||
allowSendingWithoutReply: Boolean?,
|
||||
replyMarkup: KeyboardMarkup?
|
||||
): Request<ContentMessage<GameContent>> = SendGame(
|
||||
chatId,
|
||||
game.title,
|
||||
disableNotification,
|
||||
replyToMessageId,
|
||||
allowSendingWithoutReply,
|
||||
replyMarkup
|
||||
)
|
||||
}
|
@@ -7,7 +7,9 @@ import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.location.*
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||
import dev.inmo.tgbotapi.types.message.content.abstracts.MessageContent
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class LocationContent(
|
||||
val location: Location
|
||||
) : MessageContent {
|
||||
@@ -23,6 +25,7 @@ data class LocationContent(
|
||||
location.longitude,
|
||||
disableNotification,
|
||||
replyToMessageId,
|
||||
allowSendingWithoutReply,
|
||||
replyMarkup
|
||||
)
|
||||
is LiveLocation -> SendLiveLocation(
|
||||
@@ -35,6 +38,7 @@ data class LocationContent(
|
||||
location.proximityAlertRadius,
|
||||
disableNotification,
|
||||
replyToMessageId,
|
||||
allowSendingWithoutReply,
|
||||
replyMarkup
|
||||
)
|
||||
}
|
||||
|
@@ -16,11 +16,13 @@ data class PollContent(
|
||||
chatId: ChatIdentifier,
|
||||
disableNotification: Boolean,
|
||||
replyToMessageId: MessageIdentifier?,
|
||||
allowSendingWithoutReply: Boolean?,
|
||||
replyMarkup: KeyboardMarkup?
|
||||
): Request<ContentMessage<PollContent>> = poll.createRequest(
|
||||
chatId,
|
||||
disableNotification,
|
||||
replyToMessageId,
|
||||
allowSendingWithoutReply,
|
||||
replyMarkup
|
||||
)
|
||||
}
|
||||
|
@@ -24,6 +24,7 @@ data class TextContent(
|
||||
chatId: ChatIdentifier,
|
||||
disableNotification: Boolean,
|
||||
replyToMessageId: MessageIdentifier?,
|
||||
allowSendingWithoutReply: Boolean?,
|
||||
replyMarkup: KeyboardMarkup?
|
||||
): Request<ContentMessage<TextContent>> = SendTextMessage(
|
||||
chatId,
|
||||
@@ -32,6 +33,7 @@ data class TextContent(
|
||||
false,
|
||||
disableNotification,
|
||||
replyToMessageId,
|
||||
allowSendingWithoutReply,
|
||||
replyMarkup
|
||||
)
|
||||
|
||||
@@ -39,11 +41,13 @@ data class TextContent(
|
||||
chatId: ChatIdentifier,
|
||||
disableNotification: Boolean,
|
||||
replyToMessageId: MessageIdentifier?,
|
||||
allowSendingWithoutReply: Boolean?,
|
||||
replyMarkup: KeyboardMarkup?
|
||||
): List<Request<ContentMessage<TextContent>>> = createResends(
|
||||
chatId,
|
||||
disableNotification,
|
||||
replyToMessageId,
|
||||
allowSendingWithoutReply,
|
||||
replyMarkup,
|
||||
HTMLParseMode
|
||||
)
|
||||
@@ -52,6 +56,7 @@ data class TextContent(
|
||||
chatId: ChatIdentifier,
|
||||
disableNotification: Boolean,
|
||||
replyToMessageId: MessageIdentifier?,
|
||||
allowSendingWithoutReply: Boolean?,
|
||||
replyMarkup: KeyboardMarkup?,
|
||||
parseMode: ParseMode = HTMLParseMode
|
||||
): List<Request<ContentMessage<TextContent>>> = when (parseMode) {
|
||||
@@ -66,6 +71,7 @@ data class TextContent(
|
||||
false,
|
||||
disableNotification,
|
||||
replyToMessageId,
|
||||
allowSendingWithoutReply,
|
||||
replyMarkup
|
||||
)
|
||||
}
|
||||
|
@@ -16,8 +16,9 @@ data class VenueContent(
|
||||
chatId: ChatIdentifier,
|
||||
disableNotification: Boolean,
|
||||
replyToMessageId: MessageIdentifier?,
|
||||
allowSendingWithoutReply: Boolean?,
|
||||
replyMarkup: KeyboardMarkup?
|
||||
): Request<ContentMessage<VenueContent>> = SendVenue(
|
||||
chatId, venue, disableNotification, replyToMessageId, replyMarkup
|
||||
chatId, venue, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
||||
)
|
||||
}
|
@@ -11,6 +11,7 @@ interface ResendableContent {
|
||||
chatId: ChatIdentifier,
|
||||
disableNotification: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
): Request<out Message>
|
||||
|
||||
@@ -18,6 +19,7 @@ interface ResendableContent {
|
||||
chatId: ChatIdentifier,
|
||||
disableNotification: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
allowSendingWithoutReply: Boolean? = 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))
|
||||
}
|
@@ -27,6 +27,7 @@ data class AnimationContent(
|
||||
chatId: ChatIdentifier,
|
||||
disableNotification: Boolean,
|
||||
replyToMessageId: MessageIdentifier?,
|
||||
allowSendingWithoutReply: Boolean?,
|
||||
replyMarkup: KeyboardMarkup?
|
||||
): Request<ContentMessage<AnimationContent>> = SendAnimation(
|
||||
chatId,
|
||||
@@ -39,6 +40,7 @@ data class AnimationContent(
|
||||
media.height,
|
||||
disableNotification,
|
||||
replyToMessageId,
|
||||
allowSendingWithoutReply,
|
||||
replyMarkup
|
||||
)
|
||||
|
||||
|
@@ -24,6 +24,7 @@ data class AudioContent(
|
||||
chatId: ChatIdentifier,
|
||||
disableNotification: Boolean,
|
||||
replyToMessageId: MessageIdentifier?,
|
||||
allowSendingWithoutReply: Boolean?,
|
||||
replyMarkup: KeyboardMarkup?
|
||||
): Request<ContentMessage<AudioContent>> = SendAudio(
|
||||
chatId,
|
||||
@@ -36,6 +37,7 @@ data class AudioContent(
|
||||
media.title,
|
||||
disableNotification,
|
||||
replyToMessageId,
|
||||
allowSendingWithoutReply,
|
||||
replyMarkup
|
||||
)
|
||||
|
||||
|
@@ -26,6 +26,7 @@ data class DocumentContent(
|
||||
chatId: ChatIdentifier,
|
||||
disableNotification: Boolean,
|
||||
replyToMessageId: MessageIdentifier?,
|
||||
allowSendingWithoutReply: Boolean?,
|
||||
replyMarkup: KeyboardMarkup?
|
||||
): Request<ContentMessage<DocumentContent>> = SendDocument(
|
||||
chatId,
|
||||
@@ -35,6 +36,7 @@ data class DocumentContent(
|
||||
HTMLParseMode,
|
||||
disableNotification,
|
||||
replyToMessageId,
|
||||
allowSendingWithoutReply,
|
||||
replyMarkup
|
||||
)
|
||||
|
||||
|
@@ -26,6 +26,7 @@ data class PhotoContent(
|
||||
chatId: ChatIdentifier,
|
||||
disableNotification: Boolean,
|
||||
replyToMessageId: MessageIdentifier?,
|
||||
allowSendingWithoutReply: Boolean?,
|
||||
replyMarkup: KeyboardMarkup?
|
||||
): Request<ContentMessage<PhotoContent>> = SendPhoto(
|
||||
chatId,
|
||||
@@ -34,6 +35,7 @@ data class PhotoContent(
|
||||
HTMLParseMode,
|
||||
disableNotification,
|
||||
replyToMessageId,
|
||||
allowSendingWithoutReply,
|
||||
replyMarkup
|
||||
)
|
||||
|
||||
|
@@ -17,12 +17,14 @@ data class StickerContent(
|
||||
chatId: ChatIdentifier,
|
||||
disableNotification: Boolean,
|
||||
replyToMessageId: MessageIdentifier?,
|
||||
allowSendingWithoutReply: Boolean?,
|
||||
replyMarkup: KeyboardMarkup?
|
||||
): Request<ContentMessage<StickerContent>> = SendSticker(
|
||||
chatId,
|
||||
media.fileId,
|
||||
disableNotification,
|
||||
replyToMessageId,
|
||||
allowSendingWithoutReply,
|
||||
replyMarkup
|
||||
)
|
||||
|
||||
|
@@ -27,6 +27,7 @@ data class VideoContent(
|
||||
chatId: ChatIdentifier,
|
||||
disableNotification: Boolean,
|
||||
replyToMessageId: MessageIdentifier?,
|
||||
allowSendingWithoutReply: Boolean?,
|
||||
replyMarkup: KeyboardMarkup?
|
||||
): Request<ContentMessage<VideoContent>> = SendVideo(
|
||||
chatId,
|
||||
@@ -40,6 +41,7 @@ data class VideoContent(
|
||||
null,
|
||||
disableNotification,
|
||||
replyToMessageId,
|
||||
allowSendingWithoutReply,
|
||||
replyMarkup
|
||||
)
|
||||
|
||||
|
@@ -18,26 +18,17 @@ data class VideoNoteContent(
|
||||
chatId: ChatIdentifier,
|
||||
disableNotification: Boolean,
|
||||
replyToMessageId: MessageIdentifier?,
|
||||
allowSendingWithoutReply: Boolean?,
|
||||
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(
|
||||
chatId,
|
||||
media.fileId,
|
||||
media.thumb ?.fileId,
|
||||
caption,
|
||||
parseMode,
|
||||
media.duration,
|
||||
media.width,
|
||||
disableNotification,
|
||||
replyToMessageId,
|
||||
allowSendingWithoutReply,
|
||||
replyMarkup
|
||||
)
|
||||
|
||||
|
@@ -25,6 +25,7 @@ data class VoiceContent(
|
||||
chatId: ChatIdentifier,
|
||||
disableNotification: Boolean,
|
||||
replyToMessageId: MessageIdentifier?,
|
||||
allowSendingWithoutReply: Boolean?,
|
||||
replyMarkup: KeyboardMarkup?
|
||||
): Request<ContentMessage<VoiceContent>> = SendVoice(
|
||||
chatId,
|
||||
@@ -34,6 +35,7 @@ data class VoiceContent(
|
||||
media.duration,
|
||||
disableNotification,
|
||||
replyToMessageId,
|
||||
allowSendingWithoutReply,
|
||||
replyMarkup
|
||||
)
|
||||
|
||||
|
@@ -15,6 +15,7 @@ data class InvoiceContent(
|
||||
chatId: ChatIdentifier,
|
||||
disableNotification: Boolean,
|
||||
replyToMessageId: MessageIdentifier?,
|
||||
allowSendingWithoutReply: Boolean?,
|
||||
replyMarkup: KeyboardMarkup?
|
||||
): Request<ContentMessage<InvoiceContent>> {
|
||||
error("Unfortunately, currently InvoiceOfPayment can not be resend due to requirement of additional parameters," +
|
||||
|
Reference in New Issue
Block a user