mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-12-23 00:57:13 +00:00
add support of threads in send requests of core module
This commit is contained in:
parent
8654437293
commit
9df258805d
@ -3,6 +3,7 @@ package dev.inmo.tgbotapi.requests
|
||||
import dev.inmo.tgbotapi.abstracts.types.MessageAction
|
||||
import dev.inmo.tgbotapi.abstracts.types.ProtectContent
|
||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||
import dev.inmo.tgbotapi.requests.send.abstracts.OptionallyMessageThreadRequest
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.PossiblyForwardedMessage
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
||||
@ -16,13 +17,15 @@ data class ForwardMessage(
|
||||
val fromChatId: ChatIdentifier,
|
||||
@SerialName(chatIdField)
|
||||
val toChatId: ChatIdentifier,
|
||||
@SerialName(messageThreadIdField)
|
||||
override val threadId: MessageThreadId? = null,
|
||||
@SerialName(messageIdField)
|
||||
override val messageId: MessageId,
|
||||
@SerialName(disableNotificationField)
|
||||
val disableNotification: Boolean = false,
|
||||
@SerialName(protectContentField)
|
||||
override val protectContent: Boolean = false
|
||||
): SimpleRequest<PossiblyForwardedMessage>, MessageAction, ProtectContent {
|
||||
): SimpleRequest<PossiblyForwardedMessage>, MessageAction, ProtectContent, OptionallyMessageThreadRequest {
|
||||
override val chatId: ChatIdentifier
|
||||
get() = fromChatId
|
||||
|
||||
|
@ -4,6 +4,7 @@ import dev.inmo.tgbotapi.abstracts.TextedOutput
|
||||
import dev.inmo.tgbotapi.abstracts.types.MessageAction
|
||||
import dev.inmo.tgbotapi.abstracts.types.ProtectContent
|
||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||
import dev.inmo.tgbotapi.requests.send.abstracts.OptionallyMessageThreadRequest
|
||||
import dev.inmo.tgbotapi.requests.send.abstracts.ReplyingMarkupSendMessageRequest
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSource
|
||||
@ -26,6 +27,7 @@ fun CopyMessage(
|
||||
messageId: MessageId,
|
||||
text: String? = null,
|
||||
parseMode: ParseMode? = null,
|
||||
threadId: MessageThreadId? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageId? = null,
|
||||
@ -38,6 +40,7 @@ fun CopyMessage(
|
||||
text,
|
||||
parseMode,
|
||||
null,
|
||||
threadId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
@ -50,6 +53,7 @@ fun CopyMessage(
|
||||
fromChatId: ChatIdentifier,
|
||||
messageId: MessageId,
|
||||
entities: List<TextSource>,
|
||||
threadId: MessageThreadId? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageId? = null,
|
||||
@ -62,6 +66,7 @@ fun CopyMessage(
|
||||
entities.makeString(),
|
||||
null,
|
||||
entities.toRawMessageEntities(),
|
||||
threadId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
@ -75,6 +80,7 @@ fun CopyMessage(
|
||||
toChatId: ChatIdentifier,
|
||||
text: String? = null,
|
||||
parseMode: ParseMode? = null,
|
||||
threadId: MessageThreadId? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageId? = null,
|
||||
@ -87,6 +93,7 @@ fun CopyMessage(
|
||||
text,
|
||||
parseMode,
|
||||
null,
|
||||
threadId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
@ -99,6 +106,7 @@ fun CopyMessage(
|
||||
messageId: MessageId,
|
||||
toChatId: ChatIdentifier,
|
||||
entities: List<TextSource>,
|
||||
threadId: MessageThreadId? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageId? = null,
|
||||
@ -111,6 +119,7 @@ fun CopyMessage(
|
||||
entities.makeString(),
|
||||
null,
|
||||
entities.toRawMessageEntities(),
|
||||
threadId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
@ -132,6 +141,8 @@ data class CopyMessage internal constructor(
|
||||
override val parseMode: ParseMode? = null,
|
||||
@SerialName(captionEntitiesField)
|
||||
private val rawEntities: List<RawMessageEntity>? = null,
|
||||
@SerialName(messageThreadIdField)
|
||||
override val threadId: MessageThreadId? = null,
|
||||
@SerialName(disableNotificationField)
|
||||
override val disableNotification: Boolean = false,
|
||||
@SerialName(protectContentField)
|
||||
@ -146,7 +157,8 @@ data class CopyMessage internal constructor(
|
||||
ReplyingMarkupSendMessageRequest<MessageId>,
|
||||
MessageAction,
|
||||
TextedOutput,
|
||||
ProtectContent {
|
||||
ProtectContent,
|
||||
OptionallyMessageThreadRequest {
|
||||
override val chatId: ChatIdentifier
|
||||
get() = fromChatId
|
||||
override val textSources: List<TextSource>? by lazy {
|
||||
|
@ -22,6 +22,8 @@ data class SendContact(
|
||||
val firstName: String,
|
||||
@SerialName(lastNameField)
|
||||
val lastName: String? = null,
|
||||
@SerialName(messageThreadIdField)
|
||||
override val threadId: MessageThreadId? = null,
|
||||
@SerialName(disableNotificationField)
|
||||
override val disableNotification: Boolean = false,
|
||||
@SerialName(protectContentField)
|
||||
@ -38,6 +40,7 @@ data class SendContact(
|
||||
constructor(
|
||||
chatId: ChatIdentifier,
|
||||
contact: Contact,
|
||||
threadId: MessageThreadId? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageId? = null,
|
||||
@ -48,6 +51,7 @@ data class SendContact(
|
||||
contact.phoneNumber,
|
||||
contact.firstName,
|
||||
contact.lastName,
|
||||
threadId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
@ -64,6 +68,7 @@ data class SendContact(
|
||||
|
||||
fun Contact.toRequest(
|
||||
chatId: ChatIdentifier,
|
||||
threadId: MessageThreadId? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageId? = null,
|
||||
@ -72,6 +77,7 @@ fun Contact.toRequest(
|
||||
): SendContact = SendContact(
|
||||
chatId,
|
||||
this,
|
||||
threadId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
|
@ -20,6 +20,8 @@ data class SendDice(
|
||||
override val chatId: ChatIdentifier,
|
||||
@SerialName(emojiField)
|
||||
val animationType: DiceAnimationType? = null,
|
||||
@SerialName(messageThreadIdField)
|
||||
override val threadId: MessageThreadId?,
|
||||
@SerialName(disableNotificationField)
|
||||
override val disableNotification: Boolean = false,
|
||||
@SerialName(protectContentField)
|
||||
|
@ -18,6 +18,7 @@ fun SendLocation(
|
||||
chatId: ChatIdentifier,
|
||||
latitude: Double,
|
||||
longitude: Double,
|
||||
threadId: MessageThreadId? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageId? = null,
|
||||
@ -31,6 +32,7 @@ fun SendLocation(
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
threadId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
@ -42,12 +44,13 @@ fun SendStaticLocation(
|
||||
chatId: ChatIdentifier,
|
||||
latitude: Double,
|
||||
longitude: Double,
|
||||
threadId: MessageThreadId? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageId? = null,
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = SendLocation(chatId, latitude, longitude, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||
) = SendLocation(chatId, latitude, longitude, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||
|
||||
fun SendLiveLocation(
|
||||
chatId: ChatIdentifier,
|
||||
@ -57,6 +60,7 @@ fun SendLiveLocation(
|
||||
horizontalAccuracy: Meters? = null,
|
||||
heading: Degrees? = null,
|
||||
proximityAlertRadius: Meters? = null,
|
||||
threadId: MessageThreadId? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageId? = null,
|
||||
@ -70,6 +74,7 @@ fun SendLiveLocation(
|
||||
horizontalAccuracy,
|
||||
heading,
|
||||
proximityAlertRadius,
|
||||
threadId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
@ -93,6 +98,8 @@ data class SendLocation internal constructor(
|
||||
override val heading: Degrees? = null,
|
||||
@SerialName(proximityAlertRadiusField)
|
||||
override val proximityAlertRadius: Meters? = null,
|
||||
@SerialName(messageThreadIdField)
|
||||
override val threadId: MessageThreadId? = null,
|
||||
@SerialName(disableNotificationField)
|
||||
override val disableNotification: Boolean = false,
|
||||
@SerialName(protectContentField)
|
||||
|
@ -24,6 +24,7 @@ fun SendTextMessage(
|
||||
chatId: ChatIdentifier,
|
||||
text: String,
|
||||
parseMode: ParseMode? = null,
|
||||
threadId: MessageThreadId? = null,
|
||||
disableWebPagePreview: Boolean? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
@ -35,6 +36,7 @@ fun SendTextMessage(
|
||||
text,
|
||||
parseMode,
|
||||
null,
|
||||
threadId,
|
||||
disableWebPagePreview,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
@ -46,6 +48,7 @@ fun SendTextMessage(
|
||||
fun SendTextMessage(
|
||||
chatId: ChatIdentifier,
|
||||
entities: TextSourcesList,
|
||||
threadId: MessageThreadId? = null,
|
||||
disableWebPagePreview: Boolean? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
@ -57,6 +60,7 @@ fun SendTextMessage(
|
||||
entities.makeString(),
|
||||
null,
|
||||
entities.toRawMessageEntities(),
|
||||
threadId,
|
||||
disableWebPagePreview,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
@ -75,6 +79,8 @@ data class SendTextMessage internal constructor(
|
||||
override val parseMode: ParseMode? = null,
|
||||
@SerialName(entitiesField)
|
||||
private val rawEntities: List<RawMessageEntity>? = null,
|
||||
@SerialName(messageThreadIdField)
|
||||
override val threadId: MessageThreadId? = null,
|
||||
@SerialName(disableWebPagePreviewField)
|
||||
override val disableWebPagePreview: Boolean? = null,
|
||||
@SerialName(disableNotificationField)
|
||||
|
@ -32,6 +32,8 @@ data class SendVenue(
|
||||
val googlePlaceId: GooglePlaceId? = null,
|
||||
@SerialName(googlePlaceTypeField)
|
||||
val googlePlaceType: GooglePlaceType? = null,
|
||||
@SerialName(messageThreadIdField)
|
||||
override val threadId: MessageThreadId? = null,
|
||||
@SerialName(disableNotificationField)
|
||||
override val disableNotification: Boolean = false,
|
||||
@SerialName(protectContentField)
|
||||
|
@ -0,0 +1,7 @@
|
||||
package dev.inmo.tgbotapi.requests.send.abstracts
|
||||
|
||||
import dev.inmo.tgbotapi.types.MessageThreadId
|
||||
|
||||
interface OptionallyMessageThreadRequest {
|
||||
val threadId: MessageThreadId?
|
||||
}
|
@ -2,5 +2,6 @@ package dev.inmo.tgbotapi.requests.send.abstracts
|
||||
|
||||
import dev.inmo.tgbotapi.abstracts.types.ChatRequest
|
||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||
import dev.inmo.tgbotapi.types.MessageThreadId
|
||||
|
||||
interface SendChatMessageRequest<T: Any> : SimpleRequest<T>, ChatRequest
|
||||
|
@ -2,4 +2,8 @@ package dev.inmo.tgbotapi.requests.send.abstracts
|
||||
|
||||
import dev.inmo.tgbotapi.abstracts.types.*
|
||||
|
||||
interface SendMessageRequest<T: Any> : SendChatMessageRequest<T>, ReplyMessageId, DisableNotification, ProtectContent
|
||||
interface SendMessageRequest<T: Any> : SendChatMessageRequest<T>,
|
||||
ReplyMessageId,
|
||||
DisableNotification,
|
||||
ProtectContent,
|
||||
OptionallyMessageThreadRequest
|
||||
|
@ -18,6 +18,8 @@ data class SendGame (
|
||||
override val chatId: ChatIdentifier,
|
||||
@SerialName(gameShortNameField)
|
||||
val gameShortName: String,
|
||||
@SerialName(messageThreadIdField)
|
||||
override val threadId: MessageThreadId? = null,
|
||||
@SerialName(disableNotificationField)
|
||||
override val disableNotification: Boolean = false,
|
||||
@SerialName(protectContentField)
|
||||
|
@ -25,6 +25,7 @@ fun SendAnimation(
|
||||
thumb: InputFile? = null,
|
||||
text: String? = null,
|
||||
parseMode: ParseMode? = null,
|
||||
threadId: MessageThreadId? = null,
|
||||
duration: Long? = null,
|
||||
width: Int? = null,
|
||||
height: Int? = null,
|
||||
@ -46,6 +47,7 @@ fun SendAnimation(
|
||||
text,
|
||||
parseMode,
|
||||
null,
|
||||
threadId,
|
||||
duration,
|
||||
width,
|
||||
height,
|
||||
@ -71,6 +73,7 @@ fun SendAnimation(
|
||||
animation: InputFile,
|
||||
thumb: InputFile? = null,
|
||||
entities: TextSourcesList,
|
||||
threadId: MessageThreadId? = null,
|
||||
duration: Long? = null,
|
||||
width: Int? = null,
|
||||
height: Int? = null,
|
||||
@ -92,6 +95,7 @@ fun SendAnimation(
|
||||
entities.makeString(),
|
||||
null,
|
||||
entities.toRawMessageEntities(),
|
||||
threadId,
|
||||
duration,
|
||||
width,
|
||||
height,
|
||||
@ -129,6 +133,8 @@ data class SendAnimationData internal constructor(
|
||||
override val parseMode: ParseMode? = null,
|
||||
@SerialName(captionEntitiesField)
|
||||
private val rawEntities: List<RawMessageEntity>? = null,
|
||||
@SerialName(messageThreadIdField)
|
||||
override val threadId: MessageThreadId? = null,
|
||||
@SerialName(durationField)
|
||||
override val duration: Long? = null,
|
||||
@SerialName(widthField)
|
||||
|
@ -26,6 +26,7 @@ fun SendAudio(
|
||||
thumb: InputFile? = null,
|
||||
text: String? = null,
|
||||
parseMode: ParseMode? = null,
|
||||
threadId: MessageThreadId? = null,
|
||||
duration: Long? = null,
|
||||
performer: String? = null,
|
||||
title: String? = null,
|
||||
@ -47,6 +48,7 @@ fun SendAudio(
|
||||
text,
|
||||
parseMode,
|
||||
null,
|
||||
threadId,
|
||||
duration,
|
||||
performer,
|
||||
title,
|
||||
@ -72,6 +74,7 @@ fun SendAudio(
|
||||
audio: InputFile,
|
||||
thumb: InputFile? = null,
|
||||
entities: List<TextSource>,
|
||||
threadId: MessageThreadId? = null,
|
||||
duration: Long? = null,
|
||||
performer: String? = null,
|
||||
title: String? = null,
|
||||
@ -93,6 +96,7 @@ fun SendAudio(
|
||||
entities.makeString(),
|
||||
null,
|
||||
entities.toRawMessageEntities(),
|
||||
threadId,
|
||||
duration,
|
||||
performer,
|
||||
title,
|
||||
@ -130,6 +134,8 @@ data class SendAudioData internal constructor(
|
||||
override val parseMode: ParseMode? = null,
|
||||
@SerialName(captionEntitiesField)
|
||||
private val rawEntities: List<RawMessageEntity>? = null,
|
||||
@SerialName(messageThreadIdField)
|
||||
override val threadId: MessageThreadId? = null,
|
||||
@SerialName(durationField)
|
||||
override val duration: Long? = null,
|
||||
@SerialName(performerField)
|
||||
|
@ -34,6 +34,7 @@ fun SendDocument(
|
||||
thumb: InputFile? = null,
|
||||
text: String? = null,
|
||||
parseMode: ParseMode? = null,
|
||||
threadId: MessageThreadId? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageId? = null,
|
||||
@ -53,6 +54,7 @@ fun SendDocument(
|
||||
text,
|
||||
parseMode,
|
||||
null,
|
||||
threadId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
@ -85,6 +87,7 @@ fun SendDocument(
|
||||
document: InputFile,
|
||||
thumb: InputFile? = null,
|
||||
entities: TextSourcesList,
|
||||
threadId: MessageThreadId? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageId? = null,
|
||||
@ -104,6 +107,7 @@ fun SendDocument(
|
||||
entities.makeString(),
|
||||
null,
|
||||
entities.toRawMessageEntities(),
|
||||
threadId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
@ -148,6 +152,8 @@ data class SendDocumentData internal constructor(
|
||||
override val parseMode: ParseMode? = null,
|
||||
@SerialName(captionEntitiesField)
|
||||
private val rawEntities: List<RawMessageEntity>? = null,
|
||||
@SerialName(messageThreadIdField)
|
||||
override val threadId: MessageThreadId? = null,
|
||||
@SerialName(disableNotificationField)
|
||||
override val disableNotification: Boolean = false,
|
||||
@SerialName(protectContentField)
|
||||
|
@ -24,6 +24,7 @@ const val rawSendingMediaGroupsWarning = "Media groups contains restrictions rel
|
||||
fun <T : MediaGroupContent> SendMediaGroup(
|
||||
chatId: ChatIdentifier,
|
||||
media: List<MediaGroupMemberTelegramMedia>,
|
||||
threadId: MessageThreadId? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageId? = null,
|
||||
@ -47,6 +48,7 @@ fun <T : MediaGroupContent> SendMediaGroup(
|
||||
val data = SendMediaGroupData(
|
||||
chatId,
|
||||
media,
|
||||
threadId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
@ -72,11 +74,12 @@ fun <T : MediaGroupContent> SendMediaGroup(
|
||||
inline fun SendPlaylist(
|
||||
chatId: ChatIdentifier,
|
||||
media: List<AudioMediaGroupMemberTelegramMedia>,
|
||||
threadId: MessageThreadId? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageId? = null,
|
||||
allowSendingWithoutReply: Boolean? = null
|
||||
) = SendMediaGroup<AudioContent>(chatId, media, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply)
|
||||
) = SendMediaGroup<AudioContent>(chatId, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply)
|
||||
|
||||
/**
|
||||
* Use this method to be sure that you are correctly sending documents media group
|
||||
@ -87,11 +90,12 @@ inline fun SendPlaylist(
|
||||
inline fun SendDocumentsGroup(
|
||||
chatId: ChatIdentifier,
|
||||
media: List<DocumentMediaGroupMemberTelegramMedia>,
|
||||
threadId: MessageThreadId? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageId? = null,
|
||||
allowSendingWithoutReply: Boolean? = null
|
||||
) = SendMediaGroup<DocumentContent>(chatId, media, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply)
|
||||
) = SendMediaGroup<DocumentContent>(chatId, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply)
|
||||
|
||||
/**
|
||||
* Use this method to be sure that you are correctly sending visual media group
|
||||
@ -103,11 +107,12 @@ inline fun SendDocumentsGroup(
|
||||
inline fun SendVisualMediaGroup(
|
||||
chatId: ChatIdentifier,
|
||||
media: List<VisualMediaGroupMemberTelegramMedia>,
|
||||
threadId: MessageThreadId? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageId? = null,
|
||||
allowSendingWithoutReply: Boolean? = null
|
||||
) = SendMediaGroup<VisualMediaGroupContent>(chatId, media, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply)
|
||||
) = SendMediaGroup<VisualMediaGroupContent>(chatId, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply)
|
||||
|
||||
private val messagesListSerializer: KSerializer<List<MediaGroupMessage<MediaGroupContent>>>
|
||||
= ListSerializer(TelegramBotAPIMessageDeserializeOnlySerializerClass())
|
||||
@ -117,6 +122,8 @@ data class SendMediaGroupData internal constructor(
|
||||
@SerialName(chatIdField)
|
||||
override val chatId: ChatIdentifier,
|
||||
val media: List<MediaGroupMemberTelegramMedia> = emptyList(),
|
||||
@SerialName(messageThreadIdField)
|
||||
override val threadId: MessageThreadId? = null,
|
||||
@SerialName(disableNotificationField)
|
||||
override val disableNotification: Boolean = false,
|
||||
@SerialName(protectContentField)
|
||||
|
@ -23,6 +23,7 @@ fun SendPhoto(
|
||||
photo: InputFile,
|
||||
text: String? = null,
|
||||
parseMode: ParseMode? = null,
|
||||
threadId: MessageThreadId? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageId? = null,
|
||||
@ -35,6 +36,7 @@ fun SendPhoto(
|
||||
text,
|
||||
parseMode,
|
||||
null,
|
||||
threadId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
@ -53,6 +55,7 @@ fun SendPhoto(
|
||||
chatId: ChatIdentifier,
|
||||
photo: InputFile,
|
||||
entities: TextSourcesList,
|
||||
threadId: MessageThreadId? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageId? = null,
|
||||
@ -65,6 +68,7 @@ fun SendPhoto(
|
||||
entities.makeString(),
|
||||
null,
|
||||
entities.toRawMessageEntities(),
|
||||
threadId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
@ -94,6 +98,8 @@ data class SendPhotoData internal constructor(
|
||||
override val parseMode: ParseMode? = null,
|
||||
@SerialName(captionEntitiesField)
|
||||
private val rawEntities: List<RawMessageEntity>? = null,
|
||||
@SerialName(messageThreadIdField)
|
||||
override val threadId: MessageThreadId? = null,
|
||||
@SerialName(disableNotificationField)
|
||||
override val disableNotification: Boolean = false,
|
||||
@SerialName(protectContentField)
|
||||
|
@ -15,6 +15,7 @@ import kotlinx.serialization.json.JsonObject
|
||||
fun SendSticker(
|
||||
chatId: ChatIdentifier,
|
||||
sticker: InputFile,
|
||||
threadId: MessageThreadId? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageId? = null,
|
||||
@ -23,6 +24,7 @@ fun SendSticker(
|
||||
): Request<ContentMessage<StickerContent>> = SendStickerByFileId(
|
||||
chatId,
|
||||
sticker as? FileId,
|
||||
threadId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
@ -44,6 +46,8 @@ data class SendStickerByFileId internal constructor(
|
||||
override val chatId: ChatIdentifier,
|
||||
@SerialName(stickerField)
|
||||
val sticker: FileId? = null,
|
||||
@SerialName(messageThreadIdField)
|
||||
override val threadId: MessageThreadId? = null,
|
||||
@SerialName(disableNotificationField)
|
||||
override val disableNotification: Boolean = false,
|
||||
@SerialName(protectContentField)
|
||||
|
@ -25,6 +25,7 @@ fun SendVideo(
|
||||
thumb: InputFile? = null,
|
||||
text: String? = null,
|
||||
parseMode: ParseMode? = null,
|
||||
threadId: MessageThreadId? = null,
|
||||
duration: Long? = null,
|
||||
width: Int? = null,
|
||||
height: Int? = null,
|
||||
@ -47,6 +48,7 @@ fun SendVideo(
|
||||
text,
|
||||
parseMode,
|
||||
null,
|
||||
threadId,
|
||||
duration,
|
||||
width,
|
||||
height,
|
||||
@ -73,6 +75,7 @@ fun SendVideo(
|
||||
video: InputFile,
|
||||
thumb: InputFile? = null,
|
||||
entities: TextSourcesList,
|
||||
threadId: MessageThreadId? = null,
|
||||
duration: Long? = null,
|
||||
width: Int? = null,
|
||||
height: Int? = null,
|
||||
@ -95,6 +98,7 @@ fun SendVideo(
|
||||
entities.makeString(),
|
||||
null,
|
||||
entities.toRawMessageEntities(),
|
||||
threadId,
|
||||
duration,
|
||||
width,
|
||||
height,
|
||||
@ -133,6 +137,8 @@ data class SendVideoData internal constructor(
|
||||
override val parseMode: ParseMode? = null,
|
||||
@SerialName(captionEntitiesField)
|
||||
private val rawEntities: List<RawMessageEntity>? = null,
|
||||
@SerialName(messageThreadIdField)
|
||||
override val threadId: MessageThreadId? = null,
|
||||
@SerialName(durationField)
|
||||
override val duration: Long? = null,
|
||||
@SerialName(widthField)
|
||||
|
@ -14,6 +14,7 @@ import kotlinx.serialization.*
|
||||
fun SendVideoNote(
|
||||
chatId: ChatIdentifier,
|
||||
videoNote: InputFile,
|
||||
threadId: MessageThreadId? = null,
|
||||
thumb: InputFile? = null,
|
||||
duration: Long? = null,
|
||||
size: Int? = null, // in documentation - length (size of video side)
|
||||
@ -31,6 +32,7 @@ fun SendVideoNote(
|
||||
val data = SendVideoNoteData(
|
||||
chatId,
|
||||
videoNoteAsFileId,
|
||||
threadId,
|
||||
thumbAsFileId,
|
||||
duration,
|
||||
size,
|
||||
@ -60,6 +62,8 @@ data class SendVideoNoteData internal constructor(
|
||||
override val chatId: ChatIdentifier,
|
||||
@SerialName(videoNoteField)
|
||||
val videoNote: String? = null,
|
||||
@SerialName(messageThreadIdField)
|
||||
override val threadId: MessageThreadId? = null,
|
||||
@SerialName(thumbField)
|
||||
override val thumb: String? = null,
|
||||
@SerialName(durationField)
|
||||
|
@ -24,6 +24,7 @@ fun SendVoice(
|
||||
voice: InputFile,
|
||||
text: String? = null,
|
||||
parseMode: ParseMode? = null,
|
||||
threadId: MessageThreadId? = null,
|
||||
duration: Long? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
@ -40,6 +41,7 @@ fun SendVoice(
|
||||
text,
|
||||
parseMode,
|
||||
null,
|
||||
threadId,
|
||||
duration,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
@ -62,6 +64,7 @@ fun SendVoice(
|
||||
chatId: ChatIdentifier,
|
||||
voice: InputFile,
|
||||
entities: TextSourcesList,
|
||||
threadId: MessageThreadId? = null,
|
||||
duration: Long? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
@ -78,6 +81,7 @@ fun SendVoice(
|
||||
entities.makeString(),
|
||||
null,
|
||||
entities.toRawMessageEntities(),
|
||||
threadId,
|
||||
duration,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
@ -111,6 +115,8 @@ data class SendVoiceData internal constructor(
|
||||
override val parseMode: ParseMode? = null,
|
||||
@SerialName(captionEntitiesField)
|
||||
private val rawEntities: List<RawMessageEntity>? = null,
|
||||
@SerialName(messageThreadIdField)
|
||||
override val threadId: MessageThreadId? = null,
|
||||
@SerialName(durationField)
|
||||
override val duration: Long? = null,
|
||||
@SerialName(disableNotificationField)
|
||||
|
@ -36,6 +36,8 @@ data class SendInvoice(
|
||||
@Serializable(LabeledPricesSerializer::class)
|
||||
@SerialName(pricesField)
|
||||
override val prices: List<LabeledPrice>,
|
||||
@SerialName(messageThreadIdField)
|
||||
override val threadId: MessageThreadId? = null,
|
||||
@SerialName(maxTipAmountField)
|
||||
override val maxTipAmount: Int? = null,
|
||||
@SerialName(suggestedTipAmountsField)
|
||||
|
@ -46,6 +46,7 @@ fun SendPoll(
|
||||
chatId: ChatIdentifier,
|
||||
question: String,
|
||||
options: List<String>,
|
||||
threadId: MessageThreadId? = null,
|
||||
isAnonymous: Boolean = true,
|
||||
isClosed: Boolean = false,
|
||||
disableNotification: Boolean = false,
|
||||
@ -57,6 +58,7 @@ fun SendPoll(
|
||||
chatId,
|
||||
question,
|
||||
options,
|
||||
threadId,
|
||||
isAnonymous,
|
||||
isClosed,
|
||||
allowSendingWithoutReply = allowSendingWithoutReply,
|
||||
@ -71,6 +73,7 @@ fun SendPoll(
|
||||
*/
|
||||
fun Poll.createRequest(
|
||||
chatId: ChatIdentifier,
|
||||
threadId: MessageThreadId? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageId? = null,
|
||||
@ -81,6 +84,7 @@ fun Poll.createRequest(
|
||||
chatId,
|
||||
question,
|
||||
options.map { it.text },
|
||||
threadId,
|
||||
isAnonymous,
|
||||
isClosed,
|
||||
allowMultipleAnswers,
|
||||
@ -97,6 +101,7 @@ fun Poll.createRequest(
|
||||
question,
|
||||
options.map { it.text },
|
||||
correctOptionId,
|
||||
threadId,
|
||||
isAnonymous,
|
||||
isClosed,
|
||||
textSources,
|
||||
@ -111,6 +116,7 @@ fun Poll.createRequest(
|
||||
chatId,
|
||||
question,
|
||||
options.map { it.text },
|
||||
threadId,
|
||||
isAnonymous,
|
||||
isClosed,
|
||||
false,
|
||||
@ -125,6 +131,7 @@ fun Poll.createRequest(
|
||||
chatId,
|
||||
question,
|
||||
options.map { it.text },
|
||||
threadId,
|
||||
isAnonymous,
|
||||
isClosed,
|
||||
false,
|
||||
@ -183,6 +190,8 @@ data class SendRegularPoll(
|
||||
override val question: String,
|
||||
@SerialName(optionsField)
|
||||
override val options: List<String>,
|
||||
@SerialName(messageThreadIdField)
|
||||
override val threadId: MessageThreadId? = null,
|
||||
@SerialName(isAnonymousField)
|
||||
override val isAnonymous: Boolean = true,
|
||||
@SerialName(isClosedField)
|
||||
@ -218,6 +227,7 @@ fun SendRegularPoll(
|
||||
chatId: ChatIdentifier,
|
||||
question: String,
|
||||
options: List<String>,
|
||||
threadId: MessageThreadId? = null,
|
||||
isAnonymous: Boolean = true,
|
||||
isClosed: Boolean = false,
|
||||
allowMultipleAnswers: Boolean = false,
|
||||
@ -231,6 +241,7 @@ fun SendRegularPoll(
|
||||
chatId,
|
||||
question,
|
||||
options,
|
||||
threadId,
|
||||
isAnonymous,
|
||||
isClosed,
|
||||
allowMultipleAnswers,
|
||||
@ -248,6 +259,7 @@ fun SendQuizPoll(
|
||||
question: String,
|
||||
options: List<String>,
|
||||
correctOptionId: Int,
|
||||
threadId: MessageThreadId? = null,
|
||||
isAnonymous: Boolean = true,
|
||||
isClosed: Boolean = false,
|
||||
explanation: String? = null,
|
||||
@ -263,6 +275,7 @@ fun SendQuizPoll(
|
||||
question,
|
||||
options,
|
||||
correctOptionId,
|
||||
threadId,
|
||||
isAnonymous,
|
||||
isClosed,
|
||||
explanation,
|
||||
@ -281,6 +294,7 @@ fun SendQuizPoll(
|
||||
question: String,
|
||||
options: List<String>,
|
||||
correctOptionId: Int,
|
||||
threadId: MessageThreadId? = null,
|
||||
isAnonymous: Boolean = true,
|
||||
isClosed: Boolean = false,
|
||||
entities: List<TextSource>,
|
||||
@ -295,6 +309,7 @@ fun SendQuizPoll(
|
||||
question,
|
||||
options,
|
||||
correctOptionId,
|
||||
threadId,
|
||||
isAnonymous,
|
||||
isClosed,
|
||||
entities.makeString(),
|
||||
@ -313,6 +328,7 @@ internal fun SendQuizPoll(
|
||||
question: String,
|
||||
options: List<String>,
|
||||
correctOptionId: Int,
|
||||
threadId: MessageThreadId? = null,
|
||||
isAnonymous: Boolean = true,
|
||||
isClosed: Boolean = false,
|
||||
explanation: String? = null,
|
||||
@ -329,6 +345,7 @@ internal fun SendQuizPoll(
|
||||
question,
|
||||
options,
|
||||
correctOptionId,
|
||||
threadId,
|
||||
isAnonymous,
|
||||
isClosed,
|
||||
explanation,
|
||||
@ -353,6 +370,8 @@ data class SendQuizPoll internal constructor(
|
||||
override val options: List<String>,
|
||||
@SerialName(correctOptionIdField)
|
||||
val correctOptionId: Int,
|
||||
@SerialName(messageThreadIdField)
|
||||
override val threadId: MessageThreadId? = null,
|
||||
@SerialName(isAnonymousField)
|
||||
override val isAnonymous: Boolean = true,
|
||||
@SerialName(isClosedField)
|
||||
|
Loading…
Reference in New Issue
Block a user