1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-22 08:13:47 +00:00

add support of threads in send requests of core module

This commit is contained in:
InsanusMokrassar 2022-11-07 23:02:58 +06:00
parent 8654437293
commit 9df258805d
22 changed files with 131 additions and 7 deletions

View File

@ -3,6 +3,7 @@ package dev.inmo.tgbotapi.requests
import dev.inmo.tgbotapi.abstracts.types.MessageAction import dev.inmo.tgbotapi.abstracts.types.MessageAction
import dev.inmo.tgbotapi.abstracts.types.ProtectContent import dev.inmo.tgbotapi.abstracts.types.ProtectContent
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest 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.*
import dev.inmo.tgbotapi.types.message.abstracts.PossiblyForwardedMessage import dev.inmo.tgbotapi.types.message.abstracts.PossiblyForwardedMessage
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
@ -16,13 +17,15 @@ data class ForwardMessage(
val fromChatId: ChatIdentifier, val fromChatId: ChatIdentifier,
@SerialName(chatIdField) @SerialName(chatIdField)
val toChatId: ChatIdentifier, val toChatId: ChatIdentifier,
@SerialName(messageThreadIdField)
override val threadId: MessageThreadId? = null,
@SerialName(messageIdField) @SerialName(messageIdField)
override val messageId: MessageId, override val messageId: MessageId,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
val disableNotification: Boolean = false, val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)
override val protectContent: Boolean = false override val protectContent: Boolean = false
): SimpleRequest<PossiblyForwardedMessage>, MessageAction, ProtectContent { ): SimpleRequest<PossiblyForwardedMessage>, MessageAction, ProtectContent, OptionallyMessageThreadRequest {
override val chatId: ChatIdentifier override val chatId: ChatIdentifier
get() = fromChatId get() = fromChatId

View File

@ -4,6 +4,7 @@ import dev.inmo.tgbotapi.abstracts.TextedOutput
import dev.inmo.tgbotapi.abstracts.types.MessageAction import dev.inmo.tgbotapi.abstracts.types.MessageAction
import dev.inmo.tgbotapi.abstracts.types.ProtectContent import dev.inmo.tgbotapi.abstracts.types.ProtectContent
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest 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.requests.send.abstracts.ReplyingMarkupSendMessageRequest
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.message.textsources.TextSource import dev.inmo.tgbotapi.types.message.textsources.TextSource
@ -26,6 +27,7 @@ fun CopyMessage(
messageId: MessageId, messageId: MessageId,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -38,6 +40,7 @@ fun CopyMessage(
text, text,
parseMode, parseMode,
null, null,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -50,6 +53,7 @@ fun CopyMessage(
fromChatId: ChatIdentifier, fromChatId: ChatIdentifier,
messageId: MessageId, messageId: MessageId,
entities: List<TextSource>, entities: List<TextSource>,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -62,6 +66,7 @@ fun CopyMessage(
entities.makeString(), entities.makeString(),
null, null,
entities.toRawMessageEntities(), entities.toRawMessageEntities(),
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -75,6 +80,7 @@ fun CopyMessage(
toChatId: ChatIdentifier, toChatId: ChatIdentifier,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -87,6 +93,7 @@ fun CopyMessage(
text, text,
parseMode, parseMode,
null, null,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -99,6 +106,7 @@ fun CopyMessage(
messageId: MessageId, messageId: MessageId,
toChatId: ChatIdentifier, toChatId: ChatIdentifier,
entities: List<TextSource>, entities: List<TextSource>,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -111,6 +119,7 @@ fun CopyMessage(
entities.makeString(), entities.makeString(),
null, null,
entities.toRawMessageEntities(), entities.toRawMessageEntities(),
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -132,6 +141,8 @@ data class CopyMessage internal constructor(
override val parseMode: ParseMode? = null, override val parseMode: ParseMode? = null,
@SerialName(captionEntitiesField) @SerialName(captionEntitiesField)
private val rawEntities: List<RawMessageEntity>? = null, private val rawEntities: List<RawMessageEntity>? = null,
@SerialName(messageThreadIdField)
override val threadId: MessageThreadId? = null,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)
@ -146,7 +157,8 @@ data class CopyMessage internal constructor(
ReplyingMarkupSendMessageRequest<MessageId>, ReplyingMarkupSendMessageRequest<MessageId>,
MessageAction, MessageAction,
TextedOutput, TextedOutput,
ProtectContent { ProtectContent,
OptionallyMessageThreadRequest {
override val chatId: ChatIdentifier override val chatId: ChatIdentifier
get() = fromChatId get() = fromChatId
override val textSources: List<TextSource>? by lazy { override val textSources: List<TextSource>? by lazy {

View File

@ -22,6 +22,8 @@ data class SendContact(
val firstName: String, val firstName: String,
@SerialName(lastNameField) @SerialName(lastNameField)
val lastName: String? = null, val lastName: String? = null,
@SerialName(messageThreadIdField)
override val threadId: MessageThreadId? = null,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)
@ -38,6 +40,7 @@ data class SendContact(
constructor( constructor(
chatId: ChatIdentifier, chatId: ChatIdentifier,
contact: Contact, contact: Contact,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -48,6 +51,7 @@ data class SendContact(
contact.phoneNumber, contact.phoneNumber,
contact.firstName, contact.firstName,
contact.lastName, contact.lastName,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -64,6 +68,7 @@ data class SendContact(
fun Contact.toRequest( fun Contact.toRequest(
chatId: ChatIdentifier, chatId: ChatIdentifier,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -72,6 +77,7 @@ fun Contact.toRequest(
): SendContact = SendContact( ): SendContact = SendContact(
chatId, chatId,
this, this,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,

View File

@ -20,6 +20,8 @@ data class SendDice(
override val chatId: ChatIdentifier, override val chatId: ChatIdentifier,
@SerialName(emojiField) @SerialName(emojiField)
val animationType: DiceAnimationType? = null, val animationType: DiceAnimationType? = null,
@SerialName(messageThreadIdField)
override val threadId: MessageThreadId?,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)

View File

@ -18,6 +18,7 @@ fun SendLocation(
chatId: ChatIdentifier, chatId: ChatIdentifier,
latitude: Double, latitude: Double,
longitude: Double, longitude: Double,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -31,6 +32,7 @@ fun SendLocation(
null, null,
null, null,
null, null,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -42,12 +44,13 @@ fun SendStaticLocation(
chatId: ChatIdentifier, chatId: ChatIdentifier,
latitude: Double, latitude: Double,
longitude: Double, longitude: Double,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = 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( fun SendLiveLocation(
chatId: ChatIdentifier, chatId: ChatIdentifier,
@ -57,6 +60,7 @@ fun SendLiveLocation(
horizontalAccuracy: Meters? = null, horizontalAccuracy: Meters? = null,
heading: Degrees? = null, heading: Degrees? = null,
proximityAlertRadius: Meters? = null, proximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -70,6 +74,7 @@ fun SendLiveLocation(
horizontalAccuracy, horizontalAccuracy,
heading, heading,
proximityAlertRadius, proximityAlertRadius,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -93,6 +98,8 @@ data class SendLocation internal constructor(
override val heading: Degrees? = null, override val heading: Degrees? = null,
@SerialName(proximityAlertRadiusField) @SerialName(proximityAlertRadiusField)
override val proximityAlertRadius: Meters? = null, override val proximityAlertRadius: Meters? = null,
@SerialName(messageThreadIdField)
override val threadId: MessageThreadId? = null,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)

View File

@ -24,6 +24,7 @@ fun SendTextMessage(
chatId: ChatIdentifier, chatId: ChatIdentifier,
text: String, text: String,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
threadId: MessageThreadId? = null,
disableWebPagePreview: Boolean? = null, disableWebPagePreview: Boolean? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
@ -35,6 +36,7 @@ fun SendTextMessage(
text, text,
parseMode, parseMode,
null, null,
threadId,
disableWebPagePreview, disableWebPagePreview,
disableNotification, disableNotification,
protectContent, protectContent,
@ -46,6 +48,7 @@ fun SendTextMessage(
fun SendTextMessage( fun SendTextMessage(
chatId: ChatIdentifier, chatId: ChatIdentifier,
entities: TextSourcesList, entities: TextSourcesList,
threadId: MessageThreadId? = null,
disableWebPagePreview: Boolean? = null, disableWebPagePreview: Boolean? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
@ -57,6 +60,7 @@ fun SendTextMessage(
entities.makeString(), entities.makeString(),
null, null,
entities.toRawMessageEntities(), entities.toRawMessageEntities(),
threadId,
disableWebPagePreview, disableWebPagePreview,
disableNotification, disableNotification,
protectContent, protectContent,
@ -75,6 +79,8 @@ data class SendTextMessage internal constructor(
override val parseMode: ParseMode? = null, override val parseMode: ParseMode? = null,
@SerialName(entitiesField) @SerialName(entitiesField)
private val rawEntities: List<RawMessageEntity>? = null, private val rawEntities: List<RawMessageEntity>? = null,
@SerialName(messageThreadIdField)
override val threadId: MessageThreadId? = null,
@SerialName(disableWebPagePreviewField) @SerialName(disableWebPagePreviewField)
override val disableWebPagePreview: Boolean? = null, override val disableWebPagePreview: Boolean? = null,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)

View File

@ -32,6 +32,8 @@ data class SendVenue(
val googlePlaceId: GooglePlaceId? = null, val googlePlaceId: GooglePlaceId? = null,
@SerialName(googlePlaceTypeField) @SerialName(googlePlaceTypeField)
val googlePlaceType: GooglePlaceType? = null, val googlePlaceType: GooglePlaceType? = null,
@SerialName(messageThreadIdField)
override val threadId: MessageThreadId? = null,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)

View File

@ -0,0 +1,7 @@
package dev.inmo.tgbotapi.requests.send.abstracts
import dev.inmo.tgbotapi.types.MessageThreadId
interface OptionallyMessageThreadRequest {
val threadId: MessageThreadId?
}

View File

@ -2,5 +2,6 @@ package dev.inmo.tgbotapi.requests.send.abstracts
import dev.inmo.tgbotapi.abstracts.types.ChatRequest import dev.inmo.tgbotapi.abstracts.types.ChatRequest
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
import dev.inmo.tgbotapi.types.MessageThreadId
interface SendChatMessageRequest<T: Any> : SimpleRequest<T>, ChatRequest interface SendChatMessageRequest<T: Any> : SimpleRequest<T>, ChatRequest

View File

@ -2,4 +2,8 @@ package dev.inmo.tgbotapi.requests.send.abstracts
import dev.inmo.tgbotapi.abstracts.types.* 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

View File

@ -18,6 +18,8 @@ data class SendGame (
override val chatId: ChatIdentifier, override val chatId: ChatIdentifier,
@SerialName(gameShortNameField) @SerialName(gameShortNameField)
val gameShortName: String, val gameShortName: String,
@SerialName(messageThreadIdField)
override val threadId: MessageThreadId? = null,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)

View File

@ -25,6 +25,7 @@ fun SendAnimation(
thumb: InputFile? = null, thumb: InputFile? = null,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
threadId: MessageThreadId? = null,
duration: Long? = null, duration: Long? = null,
width: Int? = null, width: Int? = null,
height: Int? = null, height: Int? = null,
@ -46,6 +47,7 @@ fun SendAnimation(
text, text,
parseMode, parseMode,
null, null,
threadId,
duration, duration,
width, width,
height, height,
@ -71,6 +73,7 @@ fun SendAnimation(
animation: InputFile, animation: InputFile,
thumb: InputFile? = null, thumb: InputFile? = null,
entities: TextSourcesList, entities: TextSourcesList,
threadId: MessageThreadId? = null,
duration: Long? = null, duration: Long? = null,
width: Int? = null, width: Int? = null,
height: Int? = null, height: Int? = null,
@ -92,6 +95,7 @@ fun SendAnimation(
entities.makeString(), entities.makeString(),
null, null,
entities.toRawMessageEntities(), entities.toRawMessageEntities(),
threadId,
duration, duration,
width, width,
height, height,
@ -129,6 +133,8 @@ data class SendAnimationData internal constructor(
override val parseMode: ParseMode? = null, override val parseMode: ParseMode? = null,
@SerialName(captionEntitiesField) @SerialName(captionEntitiesField)
private val rawEntities: List<RawMessageEntity>? = null, private val rawEntities: List<RawMessageEntity>? = null,
@SerialName(messageThreadIdField)
override val threadId: MessageThreadId? = null,
@SerialName(durationField) @SerialName(durationField)
override val duration: Long? = null, override val duration: Long? = null,
@SerialName(widthField) @SerialName(widthField)

View File

@ -26,6 +26,7 @@ fun SendAudio(
thumb: InputFile? = null, thumb: InputFile? = null,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
threadId: MessageThreadId? = null,
duration: Long? = null, duration: Long? = null,
performer: String? = null, performer: String? = null,
title: String? = null, title: String? = null,
@ -47,6 +48,7 @@ fun SendAudio(
text, text,
parseMode, parseMode,
null, null,
threadId,
duration, duration,
performer, performer,
title, title,
@ -72,6 +74,7 @@ fun SendAudio(
audio: InputFile, audio: InputFile,
thumb: InputFile? = null, thumb: InputFile? = null,
entities: List<TextSource>, entities: List<TextSource>,
threadId: MessageThreadId? = null,
duration: Long? = null, duration: Long? = null,
performer: String? = null, performer: String? = null,
title: String? = null, title: String? = null,
@ -93,6 +96,7 @@ fun SendAudio(
entities.makeString(), entities.makeString(),
null, null,
entities.toRawMessageEntities(), entities.toRawMessageEntities(),
threadId,
duration, duration,
performer, performer,
title, title,
@ -130,6 +134,8 @@ data class SendAudioData internal constructor(
override val parseMode: ParseMode? = null, override val parseMode: ParseMode? = null,
@SerialName(captionEntitiesField) @SerialName(captionEntitiesField)
private val rawEntities: List<RawMessageEntity>? = null, private val rawEntities: List<RawMessageEntity>? = null,
@SerialName(messageThreadIdField)
override val threadId: MessageThreadId? = null,
@SerialName(durationField) @SerialName(durationField)
override val duration: Long? = null, override val duration: Long? = null,
@SerialName(performerField) @SerialName(performerField)

View File

@ -34,6 +34,7 @@ fun SendDocument(
thumb: InputFile? = null, thumb: InputFile? = null,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -53,6 +54,7 @@ fun SendDocument(
text, text,
parseMode, parseMode,
null, null,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -85,6 +87,7 @@ fun SendDocument(
document: InputFile, document: InputFile,
thumb: InputFile? = null, thumb: InputFile? = null,
entities: TextSourcesList, entities: TextSourcesList,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -104,6 +107,7 @@ fun SendDocument(
entities.makeString(), entities.makeString(),
null, null,
entities.toRawMessageEntities(), entities.toRawMessageEntities(),
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -148,6 +152,8 @@ data class SendDocumentData internal constructor(
override val parseMode: ParseMode? = null, override val parseMode: ParseMode? = null,
@SerialName(captionEntitiesField) @SerialName(captionEntitiesField)
private val rawEntities: List<RawMessageEntity>? = null, private val rawEntities: List<RawMessageEntity>? = null,
@SerialName(messageThreadIdField)
override val threadId: MessageThreadId? = null,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)

View File

@ -24,6 +24,7 @@ const val rawSendingMediaGroupsWarning = "Media groups contains restrictions rel
fun <T : MediaGroupContent> SendMediaGroup( fun <T : MediaGroupContent> SendMediaGroup(
chatId: ChatIdentifier, chatId: ChatIdentifier,
media: List<MediaGroupMemberTelegramMedia>, media: List<MediaGroupMemberTelegramMedia>,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -47,6 +48,7 @@ fun <T : MediaGroupContent> SendMediaGroup(
val data = SendMediaGroupData( val data = SendMediaGroupData(
chatId, chatId,
media, media,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -72,11 +74,12 @@ fun <T : MediaGroupContent> SendMediaGroup(
inline fun SendPlaylist( inline fun SendPlaylist(
chatId: ChatIdentifier, chatId: ChatIdentifier,
media: List<AudioMediaGroupMemberTelegramMedia>, media: List<AudioMediaGroupMemberTelegramMedia>,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = 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 * Use this method to be sure that you are correctly sending documents media group
@ -87,11 +90,12 @@ inline fun SendPlaylist(
inline fun SendDocumentsGroup( inline fun SendDocumentsGroup(
chatId: ChatIdentifier, chatId: ChatIdentifier,
media: List<DocumentMediaGroupMemberTelegramMedia>, media: List<DocumentMediaGroupMemberTelegramMedia>,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = 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 * Use this method to be sure that you are correctly sending visual media group
@ -103,11 +107,12 @@ inline fun SendDocumentsGroup(
inline fun SendVisualMediaGroup( inline fun SendVisualMediaGroup(
chatId: ChatIdentifier, chatId: ChatIdentifier,
media: List<VisualMediaGroupMemberTelegramMedia>, media: List<VisualMediaGroupMemberTelegramMedia>,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = 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>>> private val messagesListSerializer: KSerializer<List<MediaGroupMessage<MediaGroupContent>>>
= ListSerializer(TelegramBotAPIMessageDeserializeOnlySerializerClass()) = ListSerializer(TelegramBotAPIMessageDeserializeOnlySerializerClass())
@ -117,6 +122,8 @@ data class SendMediaGroupData internal constructor(
@SerialName(chatIdField) @SerialName(chatIdField)
override val chatId: ChatIdentifier, override val chatId: ChatIdentifier,
val media: List<MediaGroupMemberTelegramMedia> = emptyList(), val media: List<MediaGroupMemberTelegramMedia> = emptyList(),
@SerialName(messageThreadIdField)
override val threadId: MessageThreadId? = null,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)

View File

@ -23,6 +23,7 @@ fun SendPhoto(
photo: InputFile, photo: InputFile,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -35,6 +36,7 @@ fun SendPhoto(
text, text,
parseMode, parseMode,
null, null,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -53,6 +55,7 @@ fun SendPhoto(
chatId: ChatIdentifier, chatId: ChatIdentifier,
photo: InputFile, photo: InputFile,
entities: TextSourcesList, entities: TextSourcesList,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -65,6 +68,7 @@ fun SendPhoto(
entities.makeString(), entities.makeString(),
null, null,
entities.toRawMessageEntities(), entities.toRawMessageEntities(),
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -94,6 +98,8 @@ data class SendPhotoData internal constructor(
override val parseMode: ParseMode? = null, override val parseMode: ParseMode? = null,
@SerialName(captionEntitiesField) @SerialName(captionEntitiesField)
private val rawEntities: List<RawMessageEntity>? = null, private val rawEntities: List<RawMessageEntity>? = null,
@SerialName(messageThreadIdField)
override val threadId: MessageThreadId? = null,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)

View File

@ -15,6 +15,7 @@ import kotlinx.serialization.json.JsonObject
fun SendSticker( fun SendSticker(
chatId: ChatIdentifier, chatId: ChatIdentifier,
sticker: InputFile, sticker: InputFile,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -23,6 +24,7 @@ fun SendSticker(
): Request<ContentMessage<StickerContent>> = SendStickerByFileId( ): Request<ContentMessage<StickerContent>> = SendStickerByFileId(
chatId, chatId,
sticker as? FileId, sticker as? FileId,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -44,6 +46,8 @@ data class SendStickerByFileId internal constructor(
override val chatId: ChatIdentifier, override val chatId: ChatIdentifier,
@SerialName(stickerField) @SerialName(stickerField)
val sticker: FileId? = null, val sticker: FileId? = null,
@SerialName(messageThreadIdField)
override val threadId: MessageThreadId? = null,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)

View File

@ -25,6 +25,7 @@ fun SendVideo(
thumb: InputFile? = null, thumb: InputFile? = null,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
threadId: MessageThreadId? = null,
duration: Long? = null, duration: Long? = null,
width: Int? = null, width: Int? = null,
height: Int? = null, height: Int? = null,
@ -47,6 +48,7 @@ fun SendVideo(
text, text,
parseMode, parseMode,
null, null,
threadId,
duration, duration,
width, width,
height, height,
@ -73,6 +75,7 @@ fun SendVideo(
video: InputFile, video: InputFile,
thumb: InputFile? = null, thumb: InputFile? = null,
entities: TextSourcesList, entities: TextSourcesList,
threadId: MessageThreadId? = null,
duration: Long? = null, duration: Long? = null,
width: Int? = null, width: Int? = null,
height: Int? = null, height: Int? = null,
@ -95,6 +98,7 @@ fun SendVideo(
entities.makeString(), entities.makeString(),
null, null,
entities.toRawMessageEntities(), entities.toRawMessageEntities(),
threadId,
duration, duration,
width, width,
height, height,
@ -133,6 +137,8 @@ data class SendVideoData internal constructor(
override val parseMode: ParseMode? = null, override val parseMode: ParseMode? = null,
@SerialName(captionEntitiesField) @SerialName(captionEntitiesField)
private val rawEntities: List<RawMessageEntity>? = null, private val rawEntities: List<RawMessageEntity>? = null,
@SerialName(messageThreadIdField)
override val threadId: MessageThreadId? = null,
@SerialName(durationField) @SerialName(durationField)
override val duration: Long? = null, override val duration: Long? = null,
@SerialName(widthField) @SerialName(widthField)

View File

@ -14,6 +14,7 @@ import kotlinx.serialization.*
fun SendVideoNote( fun SendVideoNote(
chatId: ChatIdentifier, chatId: ChatIdentifier,
videoNote: InputFile, videoNote: InputFile,
threadId: MessageThreadId? = null,
thumb: InputFile? = null, thumb: InputFile? = null,
duration: Long? = null, duration: Long? = null,
size: Int? = null, // in documentation - length (size of video side) size: Int? = null, // in documentation - length (size of video side)
@ -31,6 +32,7 @@ fun SendVideoNote(
val data = SendVideoNoteData( val data = SendVideoNoteData(
chatId, chatId,
videoNoteAsFileId, videoNoteAsFileId,
threadId,
thumbAsFileId, thumbAsFileId,
duration, duration,
size, size,
@ -60,6 +62,8 @@ data class SendVideoNoteData internal constructor(
override val chatId: ChatIdentifier, override val chatId: ChatIdentifier,
@SerialName(videoNoteField) @SerialName(videoNoteField)
val videoNote: String? = null, val videoNote: String? = null,
@SerialName(messageThreadIdField)
override val threadId: MessageThreadId? = null,
@SerialName(thumbField) @SerialName(thumbField)
override val thumb: String? = null, override val thumb: String? = null,
@SerialName(durationField) @SerialName(durationField)

View File

@ -24,6 +24,7 @@ fun SendVoice(
voice: InputFile, voice: InputFile,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
threadId: MessageThreadId? = null,
duration: Long? = null, duration: Long? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
@ -40,6 +41,7 @@ fun SendVoice(
text, text,
parseMode, parseMode,
null, null,
threadId,
duration, duration,
disableNotification, disableNotification,
protectContent, protectContent,
@ -62,6 +64,7 @@ fun SendVoice(
chatId: ChatIdentifier, chatId: ChatIdentifier,
voice: InputFile, voice: InputFile,
entities: TextSourcesList, entities: TextSourcesList,
threadId: MessageThreadId? = null,
duration: Long? = null, duration: Long? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
@ -78,6 +81,7 @@ fun SendVoice(
entities.makeString(), entities.makeString(),
null, null,
entities.toRawMessageEntities(), entities.toRawMessageEntities(),
threadId,
duration, duration,
disableNotification, disableNotification,
protectContent, protectContent,
@ -111,6 +115,8 @@ data class SendVoiceData internal constructor(
override val parseMode: ParseMode? = null, override val parseMode: ParseMode? = null,
@SerialName(captionEntitiesField) @SerialName(captionEntitiesField)
private val rawEntities: List<RawMessageEntity>? = null, private val rawEntities: List<RawMessageEntity>? = null,
@SerialName(messageThreadIdField)
override val threadId: MessageThreadId? = null,
@SerialName(durationField) @SerialName(durationField)
override val duration: Long? = null, override val duration: Long? = null,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)

View File

@ -36,6 +36,8 @@ data class SendInvoice(
@Serializable(LabeledPricesSerializer::class) @Serializable(LabeledPricesSerializer::class)
@SerialName(pricesField) @SerialName(pricesField)
override val prices: List<LabeledPrice>, override val prices: List<LabeledPrice>,
@SerialName(messageThreadIdField)
override val threadId: MessageThreadId? = null,
@SerialName(maxTipAmountField) @SerialName(maxTipAmountField)
override val maxTipAmount: Int? = null, override val maxTipAmount: Int? = null,
@SerialName(suggestedTipAmountsField) @SerialName(suggestedTipAmountsField)

View File

@ -46,6 +46,7 @@ fun SendPoll(
chatId: ChatIdentifier, chatId: ChatIdentifier,
question: String, question: String,
options: List<String>, options: List<String>,
threadId: MessageThreadId? = null,
isAnonymous: Boolean = true, isAnonymous: Boolean = true,
isClosed: Boolean = false, isClosed: Boolean = false,
disableNotification: Boolean = false, disableNotification: Boolean = false,
@ -57,6 +58,7 @@ fun SendPoll(
chatId, chatId,
question, question,
options, options,
threadId,
isAnonymous, isAnonymous,
isClosed, isClosed,
allowSendingWithoutReply = allowSendingWithoutReply, allowSendingWithoutReply = allowSendingWithoutReply,
@ -71,6 +73,7 @@ fun SendPoll(
*/ */
fun Poll.createRequest( fun Poll.createRequest(
chatId: ChatIdentifier, chatId: ChatIdentifier,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -81,6 +84,7 @@ fun Poll.createRequest(
chatId, chatId,
question, question,
options.map { it.text }, options.map { it.text },
threadId,
isAnonymous, isAnonymous,
isClosed, isClosed,
allowMultipleAnswers, allowMultipleAnswers,
@ -97,6 +101,7 @@ fun Poll.createRequest(
question, question,
options.map { it.text }, options.map { it.text },
correctOptionId, correctOptionId,
threadId,
isAnonymous, isAnonymous,
isClosed, isClosed,
textSources, textSources,
@ -111,6 +116,7 @@ fun Poll.createRequest(
chatId, chatId,
question, question,
options.map { it.text }, options.map { it.text },
threadId,
isAnonymous, isAnonymous,
isClosed, isClosed,
false, false,
@ -125,6 +131,7 @@ fun Poll.createRequest(
chatId, chatId,
question, question,
options.map { it.text }, options.map { it.text },
threadId,
isAnonymous, isAnonymous,
isClosed, isClosed,
false, false,
@ -183,6 +190,8 @@ data class SendRegularPoll(
override val question: String, override val question: String,
@SerialName(optionsField) @SerialName(optionsField)
override val options: List<String>, override val options: List<String>,
@SerialName(messageThreadIdField)
override val threadId: MessageThreadId? = null,
@SerialName(isAnonymousField) @SerialName(isAnonymousField)
override val isAnonymous: Boolean = true, override val isAnonymous: Boolean = true,
@SerialName(isClosedField) @SerialName(isClosedField)
@ -218,6 +227,7 @@ fun SendRegularPoll(
chatId: ChatIdentifier, chatId: ChatIdentifier,
question: String, question: String,
options: List<String>, options: List<String>,
threadId: MessageThreadId? = null,
isAnonymous: Boolean = true, isAnonymous: Boolean = true,
isClosed: Boolean = false, isClosed: Boolean = false,
allowMultipleAnswers: Boolean = false, allowMultipleAnswers: Boolean = false,
@ -231,6 +241,7 @@ fun SendRegularPoll(
chatId, chatId,
question, question,
options, options,
threadId,
isAnonymous, isAnonymous,
isClosed, isClosed,
allowMultipleAnswers, allowMultipleAnswers,
@ -248,6 +259,7 @@ fun SendQuizPoll(
question: String, question: String,
options: List<String>, options: List<String>,
correctOptionId: Int, correctOptionId: Int,
threadId: MessageThreadId? = null,
isAnonymous: Boolean = true, isAnonymous: Boolean = true,
isClosed: Boolean = false, isClosed: Boolean = false,
explanation: String? = null, explanation: String? = null,
@ -263,6 +275,7 @@ fun SendQuizPoll(
question, question,
options, options,
correctOptionId, correctOptionId,
threadId,
isAnonymous, isAnonymous,
isClosed, isClosed,
explanation, explanation,
@ -281,6 +294,7 @@ fun SendQuizPoll(
question: String, question: String,
options: List<String>, options: List<String>,
correctOptionId: Int, correctOptionId: Int,
threadId: MessageThreadId? = null,
isAnonymous: Boolean = true, isAnonymous: Boolean = true,
isClosed: Boolean = false, isClosed: Boolean = false,
entities: List<TextSource>, entities: List<TextSource>,
@ -295,6 +309,7 @@ fun SendQuizPoll(
question, question,
options, options,
correctOptionId, correctOptionId,
threadId,
isAnonymous, isAnonymous,
isClosed, isClosed,
entities.makeString(), entities.makeString(),
@ -313,6 +328,7 @@ internal fun SendQuizPoll(
question: String, question: String,
options: List<String>, options: List<String>,
correctOptionId: Int, correctOptionId: Int,
threadId: MessageThreadId? = null,
isAnonymous: Boolean = true, isAnonymous: Boolean = true,
isClosed: Boolean = false, isClosed: Boolean = false,
explanation: String? = null, explanation: String? = null,
@ -329,6 +345,7 @@ internal fun SendQuizPoll(
question, question,
options, options,
correctOptionId, correctOptionId,
threadId,
isAnonymous, isAnonymous,
isClosed, isClosed,
explanation, explanation,
@ -353,6 +370,8 @@ data class SendQuizPoll internal constructor(
override val options: List<String>, override val options: List<String>,
@SerialName(correctOptionIdField) @SerialName(correctOptionIdField)
val correctOptionId: Int, val correctOptionId: Int,
@SerialName(messageThreadIdField)
override val threadId: MessageThreadId? = null,
@SerialName(isAnonymousField) @SerialName(isAnonymousField)
override val isAnonymous: Boolean = true, override val isAnonymous: Boolean = true,
@SerialName(isClosedField) @SerialName(isClosedField)