mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2025-09-16 13:49:26 +00:00
Merge branch '4.0.0' into task/676-rework_of_media_groups
This commit is contained in:
@@ -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
|
||||
@@ -18,11 +19,13 @@ data class ForwardMessage(
|
||||
val toChatId: ChatIdentifier,
|
||||
@SerialName(messageIdField)
|
||||
override val messageId: MessageId,
|
||||
@SerialName(messageThreadIdField)
|
||||
override val threadId: MessageThreadId? = null,
|
||||
@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
|
||||
|
||||
|
@@ -0,0 +1,20 @@
|
||||
package dev.inmo.tgbotapi.requests.chat.forum
|
||||
|
||||
import dev.inmo.tgbotapi.abstracts.types.ChatRequest
|
||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.utils.RGBColor
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.builtins.serializer
|
||||
|
||||
@Serializable
|
||||
data class CloseForumTopic (
|
||||
@SerialName(chatIdField)
|
||||
override val chatId: ChatIdentifier,
|
||||
@SerialName(messageThreadIdField)
|
||||
val messageThreadId: MessageThreadId
|
||||
): ModifyForumRequest {
|
||||
override fun method(): String = "closeForumTopic"
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
@@ -0,0 +1,32 @@
|
||||
package dev.inmo.tgbotapi.requests.chat.forum
|
||||
|
||||
import dev.inmo.tgbotapi.abstracts.types.ChatRequest
|
||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.utils.RGBColor
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.builtins.serializer
|
||||
|
||||
@Serializable
|
||||
data class CreateForumTopic (
|
||||
@SerialName(chatIdField)
|
||||
override val chatId: ChatIdentifier,
|
||||
@SerialName(nameField)
|
||||
val name: String,
|
||||
@SerialName(iconColorField)
|
||||
val color: RGBColor,
|
||||
@SerialName(iconCustomEmojiIdField)
|
||||
val iconEmojiId: CustomEmojiId? = null,
|
||||
): ForumRequest<ForumTopic> {
|
||||
init {
|
||||
if (name.length !in threadNameLength) {
|
||||
throw IllegalArgumentException("Thread name must be in $threadNameLength range")
|
||||
}
|
||||
}
|
||||
|
||||
override fun method(): String = "createForumTopic"
|
||||
override val resultDeserializer: DeserializationStrategy<ForumTopic>
|
||||
get() = ForumTopic.serializer()
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
@@ -0,0 +1,20 @@
|
||||
package dev.inmo.tgbotapi.requests.chat.forum
|
||||
|
||||
import dev.inmo.tgbotapi.abstracts.types.ChatRequest
|
||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.utils.RGBColor
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.builtins.serializer
|
||||
|
||||
@Serializable
|
||||
data class DeleteForumTopic (
|
||||
@SerialName(chatIdField)
|
||||
override val chatId: ChatIdentifier,
|
||||
@SerialName(messageThreadIdField)
|
||||
val messageThreadId: MessageThreadId
|
||||
): ModifyForumRequest {
|
||||
override fun method(): String = "deleteForumTopic"
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
@@ -0,0 +1,30 @@
|
||||
package dev.inmo.tgbotapi.requests.chat.forum
|
||||
|
||||
import dev.inmo.tgbotapi.abstracts.types.ChatRequest
|
||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.utils.RGBColor
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.builtins.serializer
|
||||
|
||||
@Serializable
|
||||
data class EditForumTopic (
|
||||
@SerialName(chatIdField)
|
||||
override val chatId: ChatIdentifier,
|
||||
@SerialName(messageThreadIdField)
|
||||
val messageThreadId: MessageThreadId,
|
||||
@SerialName(nameField)
|
||||
val name: String,
|
||||
@SerialName(iconCustomEmojiIdField)
|
||||
val iconEmojiId: CustomEmojiId,
|
||||
): ModifyForumRequest {
|
||||
init {
|
||||
if (name.length !in threadNameLength) {
|
||||
throw IllegalArgumentException("Thread name must be in $threadNameLength range")
|
||||
}
|
||||
}
|
||||
|
||||
override fun method(): String = "editForumTopic"
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
@@ -0,0 +1,6 @@
|
||||
package dev.inmo.tgbotapi.requests.chat.forum
|
||||
|
||||
import dev.inmo.tgbotapi.abstracts.types.ChatRequest
|
||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||
|
||||
sealed interface ForumRequest<T : Any> : SimpleRequest<T>, ChatRequest
|
@@ -0,0 +1,10 @@
|
||||
package dev.inmo.tgbotapi.requests.chat.forum
|
||||
|
||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||
import kotlinx.serialization.DeserializationStrategy
|
||||
import kotlinx.serialization.builtins.serializer
|
||||
|
||||
sealed interface ModifyForumRequest : ForumRequest<Boolean> {
|
||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||
get() = Boolean.serializer()
|
||||
}
|
@@ -0,0 +1,20 @@
|
||||
package dev.inmo.tgbotapi.requests.chat.forum
|
||||
|
||||
import dev.inmo.tgbotapi.abstracts.types.ChatRequest
|
||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.utils.RGBColor
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.builtins.serializer
|
||||
|
||||
@Serializable
|
||||
data class ReopenForumTopic (
|
||||
@SerialName(chatIdField)
|
||||
override val chatId: ChatIdentifier,
|
||||
@SerialName(messageThreadIdField)
|
||||
val messageThreadId: MessageThreadId
|
||||
): ModifyForumRequest {
|
||||
override fun method(): String = "reopenForumTopic"
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
@@ -0,0 +1,20 @@
|
||||
package dev.inmo.tgbotapi.requests.chat.forum
|
||||
|
||||
import dev.inmo.tgbotapi.abstracts.types.ChatRequest
|
||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.utils.RGBColor
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.builtins.serializer
|
||||
|
||||
@Serializable
|
||||
data class UnpinAllForumTopicMessages (
|
||||
@SerialName(chatIdField)
|
||||
override val chatId: ChatIdentifier,
|
||||
@SerialName(messageThreadIdField)
|
||||
val messageThreadId: MessageThreadId
|
||||
): ModifyForumRequest {
|
||||
override fun method(): String = "unpinAllForumTopicMessages"
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
@@ -0,0 +1,23 @@
|
||||
package dev.inmo.tgbotapi.requests.chat.get
|
||||
|
||||
import dev.inmo.tgbotapi.abstracts.types.ChatRequest
|
||||
import dev.inmo.tgbotapi.abstracts.types.OptionalChatRequest
|
||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.files.Sticker
|
||||
import dev.inmo.tgbotapi.types.files.StickerSerializer
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.builtins.ListSerializer
|
||||
import kotlinx.serialization.builtins.serializer
|
||||
|
||||
@Serializable
|
||||
object GetForumTopicIconStickers : SimpleRequest<List<Sticker>> {
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
private val deserializer = ListSerializer(StickerSerializer)
|
||||
|
||||
override fun method(): String = "getForumTopicIconStickers"
|
||||
|
||||
override val resultDeserializer: DeserializationStrategy<List<Sticker>>
|
||||
get() = deserializer
|
||||
}
|
@@ -35,7 +35,9 @@ data class PromoteChatMember(
|
||||
@SerialName(canManageVideoChatsField)
|
||||
private val canManageVideoChats: Boolean? = null,
|
||||
@SerialName(canManageChatField)
|
||||
private val canManageChat: Boolean? = null
|
||||
private val canManageChat: Boolean? = null,
|
||||
@SerialName(canManageTopicsField)
|
||||
private val canManageTopics: Boolean? = null
|
||||
) : ChatMemberRequest<Boolean>, UntilDate {
|
||||
override fun method(): String = "promoteChatMember"
|
||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||
|
@@ -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)
|
||||
|
@@ -25,6 +25,7 @@ fun SendTextMessage(
|
||||
text: String,
|
||||
parseMode: ParseMode? = null,
|
||||
disableWebPagePreview: Boolean? = null,
|
||||
threadId: MessageThreadId? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageId? = null,
|
||||
@@ -35,6 +36,7 @@ fun SendTextMessage(
|
||||
text,
|
||||
parseMode,
|
||||
null,
|
||||
threadId,
|
||||
disableWebPagePreview,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
@@ -47,6 +49,7 @@ fun SendTextMessage(
|
||||
chatId: ChatIdentifier,
|
||||
entities: TextSourcesList,
|
||||
disableWebPagePreview: Boolean? = null,
|
||||
threadId: MessageThreadId? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageId? = null,
|
||||
@@ -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)
|
||||
@@ -50,6 +52,7 @@ data class SendVenue(
|
||||
constructor(
|
||||
chatId: ChatIdentifier,
|
||||
venue: Venue,
|
||||
threadId: MessageThreadId? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageId? = null,
|
||||
@@ -65,6 +68,7 @@ data class SendVenue(
|
||||
foursquareType = venue.foursquareType,
|
||||
googlePlaceId = venue.googlePlaceId,
|
||||
googlePlaceType = venue.googlePlaceType,
|
||||
threadId = threadId,
|
||||
disableNotification = disableNotification,
|
||||
protectContent = protectContent,
|
||||
replyToMessageId = replyToMessageId,
|
||||
@@ -81,6 +85,7 @@ data class SendVenue(
|
||||
|
||||
fun Venue.toRequest(
|
||||
chatId: ChatIdentifier,
|
||||
threadId: MessageThreadId? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageId? = null,
|
||||
@@ -89,6 +94,7 @@ fun Venue.toRequest(
|
||||
): SendVenue = SendVenue(
|
||||
chatId,
|
||||
this,
|
||||
threadId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
|
@@ -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)
|
||||
|
@@ -28,6 +28,7 @@ fun SendAnimation(
|
||||
duration: Long? = null,
|
||||
width: Int? = null,
|
||||
height: Int? = null,
|
||||
threadId: MessageThreadId? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageId? = null,
|
||||
@@ -49,6 +50,7 @@ fun SendAnimation(
|
||||
duration,
|
||||
width,
|
||||
height,
|
||||
threadId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
@@ -74,6 +76,7 @@ fun SendAnimation(
|
||||
duration: Long? = null,
|
||||
width: Int? = null,
|
||||
height: Int? = null,
|
||||
threadId: MessageThreadId? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageId? = null,
|
||||
@@ -95,6 +98,7 @@ fun SendAnimation(
|
||||
duration,
|
||||
width,
|
||||
height,
|
||||
threadId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
@@ -135,6 +139,8 @@ data class SendAnimationData internal constructor(
|
||||
override val width: Int? = null,
|
||||
@SerialName(heightField)
|
||||
override val height: Int? = null,
|
||||
@SerialName(messageThreadIdField)
|
||||
override val threadId: MessageThreadId? = null,
|
||||
@SerialName(disableNotificationField)
|
||||
override val disableNotification: Boolean = false,
|
||||
@SerialName(protectContentField)
|
||||
|
@@ -29,6 +29,7 @@ fun SendAudio(
|
||||
duration: Long? = null,
|
||||
performer: String? = null,
|
||||
title: String? = null,
|
||||
threadId: MessageThreadId? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageId? = null,
|
||||
@@ -50,6 +51,7 @@ fun SendAudio(
|
||||
duration,
|
||||
performer,
|
||||
title,
|
||||
threadId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
@@ -75,6 +77,7 @@ fun SendAudio(
|
||||
duration: Long? = null,
|
||||
performer: String? = null,
|
||||
title: String? = null,
|
||||
threadId: MessageThreadId? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageId? = null,
|
||||
@@ -96,6 +99,7 @@ fun SendAudio(
|
||||
duration,
|
||||
performer,
|
||||
title,
|
||||
threadId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
@@ -136,6 +140,8 @@ data class SendAudioData internal constructor(
|
||||
override val performer: String? = null,
|
||||
@SerialName(titleField)
|
||||
override val title: String? = null,
|
||||
@SerialName(messageThreadIdField)
|
||||
override val threadId: MessageThreadId? = null,
|
||||
@SerialName(disableNotificationField)
|
||||
override val disableNotification: Boolean = false,
|
||||
@SerialName(protectContentField)
|
||||
|
@@ -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)
|
||||
|
@@ -30,6 +30,7 @@ const val rawSendingMediaGroupsWarning = "Media groups contains restrictions rel
|
||||
fun <T : MediaGroupPartContent> SendMediaGroup(
|
||||
chatId: ChatIdentifier,
|
||||
media: List<MediaGroupMemberTelegramMedia>,
|
||||
threadId: MessageThreadId? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageId? = null,
|
||||
@@ -53,6 +54,7 @@ fun <T : MediaGroupPartContent> SendMediaGroup(
|
||||
val data = SendMediaGroupData(
|
||||
chatId,
|
||||
media,
|
||||
threadId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
@@ -78,11 +80,12 @@ fun <T : MediaGroupPartContent> 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
|
||||
@@ -93,11 +96,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
|
||||
@@ -109,11 +113,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<VisualMediaGroupPartContent>(chatId, media, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply)
|
||||
) = SendMediaGroup<VisualMediaGroupPartContent>(chatId, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply)
|
||||
|
||||
private object MessagesListSerializer: KSerializer<PossiblySentViaBotCommonMessage<MediaGroupContent>> {
|
||||
private val serializer = ListSerializer(TelegramBotAPIMessageDeserializeOnlySerializerClass<PossiblySentViaBotCommonMessage<MediaGroupPartContent>>())
|
||||
@@ -135,6 +140,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)
|
||||
@@ -143,7 +150,8 @@ data class SendMediaGroupData internal constructor(
|
||||
override val replyToMessageId: MessageId? = null,
|
||||
@SerialName(allowSendingWithoutReplyField)
|
||||
override val allowSendingWithoutReply: Boolean? = null
|
||||
) : DataRequest<List<MediaGroupMessage<MediaGroupPartContent>>>, SendMessageRequest<List<MediaGroupMessage<MediaGroupPartContent>>> {
|
||||
) : DataRequest<PossiblySentViaBotCommonMessage<MediaGroupContent>>,
|
||||
SendMessageRequest<PossiblySentViaBotCommonMessage<MediaGroupContent>> {
|
||||
@SerialName(mediaField)
|
||||
private val convertedMedia: String
|
||||
get() = buildJsonArray {
|
||||
@@ -156,8 +164,8 @@ data class SendMediaGroupData internal constructor(
|
||||
override fun method(): String = "sendMediaGroup"
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
override val resultDeserializer: DeserializationStrategy<List<MediaGroupMessage<MediaGroupPartContent>>>
|
||||
get() = messagesListSerializer
|
||||
override val resultDeserializer: DeserializationStrategy<PossiblySentViaBotCommonMessage<MediaGroupContent>>
|
||||
get() = MessagesListSerializer
|
||||
}
|
||||
|
||||
data class SendMediaGroupFiles internal constructor(
|
||||
|
@@ -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)
|
||||
|
@@ -29,6 +29,7 @@ fun SendVideo(
|
||||
width: Int? = null,
|
||||
height: Int? = null,
|
||||
supportStreaming: Boolean? = null,
|
||||
threadId: MessageThreadId? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageId? = null,
|
||||
@@ -51,6 +52,7 @@ fun SendVideo(
|
||||
width,
|
||||
height,
|
||||
supportStreaming,
|
||||
threadId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
@@ -77,6 +79,7 @@ fun SendVideo(
|
||||
width: Int? = null,
|
||||
height: Int? = null,
|
||||
supportStreaming: Boolean? = null,
|
||||
threadId: MessageThreadId? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageId? = null,
|
||||
@@ -99,6 +102,7 @@ fun SendVideo(
|
||||
width,
|
||||
height,
|
||||
supportStreaming,
|
||||
threadId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
@@ -141,6 +145,8 @@ data class SendVideoData internal constructor(
|
||||
override val height: Int? = null,
|
||||
@SerialName(supportStreamingField)
|
||||
val supportStreaming: Boolean? = null,
|
||||
@SerialName(messageThreadIdField)
|
||||
override val threadId: MessageThreadId? = null,
|
||||
@SerialName(disableNotificationField)
|
||||
override val disableNotification: Boolean = false,
|
||||
@SerialName(protectContentField)
|
||||
|
@@ -17,6 +17,7 @@ fun SendVideoNote(
|
||||
thumb: InputFile? = null,
|
||||
duration: Long? = null,
|
||||
size: Int? = null, // in documentation - length (size of video side)
|
||||
threadId: MessageThreadId? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageId? = null,
|
||||
@@ -34,6 +35,7 @@ fun SendVideoNote(
|
||||
thumbAsFileId,
|
||||
duration,
|
||||
size,
|
||||
threadId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
@@ -66,6 +68,8 @@ data class SendVideoNoteData internal constructor(
|
||||
override val duration: Long? = null,
|
||||
@SerialName(lengthField)
|
||||
override val width: Int? = null,
|
||||
@SerialName(messageThreadIdField)
|
||||
override val threadId: MessageThreadId? = null,
|
||||
@SerialName(disableNotificationField)
|
||||
override val disableNotification: Boolean = false,
|
||||
@SerialName(protectContentField)
|
||||
|
@@ -25,6 +25,7 @@ fun SendVoice(
|
||||
text: String? = null,
|
||||
parseMode: ParseMode? = null,
|
||||
duration: Long? = null,
|
||||
threadId: MessageThreadId? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageId? = null,
|
||||
@@ -41,6 +42,7 @@ fun SendVoice(
|
||||
parseMode,
|
||||
null,
|
||||
duration,
|
||||
threadId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
@@ -62,6 +64,7 @@ fun SendVoice(
|
||||
chatId: ChatIdentifier,
|
||||
voice: InputFile,
|
||||
entities: TextSourcesList,
|
||||
threadId: MessageThreadId? = null,
|
||||
duration: Long? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
@@ -79,6 +82,7 @@ fun SendVoice(
|
||||
null,
|
||||
entities.toRawMessageEntities(),
|
||||
duration,
|
||||
threadId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
@@ -113,6 +117,8 @@ data class SendVoiceData internal constructor(
|
||||
private val rawEntities: List<RawMessageEntity>? = null,
|
||||
@SerialName(durationField)
|
||||
override val duration: Long? = null,
|
||||
@SerialName(messageThreadIdField)
|
||||
override val threadId: MessageThreadId? = null,
|
||||
@SerialName(disableNotificationField)
|
||||
override val disableNotification: Boolean = false,
|
||||
@SerialName(protectContentField)
|
||||
|
@@ -58,6 +58,8 @@ data class SendInvoice(
|
||||
override val shouldSendEmailToProvider: Boolean = false,
|
||||
@SerialName(priceDependOnShipAddressField)
|
||||
override val priceDependOnShipAddress: Boolean = false,
|
||||
@SerialName(messageThreadIdField)
|
||||
override val threadId: MessageThreadId? = null,
|
||||
@SerialName(disableNotificationField)
|
||||
override val disableNotification: Boolean = false,
|
||||
@SerialName(protectContentField)
|
||||
|
@@ -48,6 +48,7 @@ fun SendPoll(
|
||||
options: List<String>,
|
||||
isAnonymous: Boolean = true,
|
||||
isClosed: Boolean = false,
|
||||
threadId: MessageThreadId? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageId? = null,
|
||||
@@ -59,6 +60,8 @@ fun SendPoll(
|
||||
options,
|
||||
isAnonymous,
|
||||
isClosed,
|
||||
threadId = threadId,
|
||||
protectContent = protectContent,
|
||||
allowSendingWithoutReply = allowSendingWithoutReply,
|
||||
disableNotification = disableNotification,
|
||||
replyToMessageId = replyToMessageId,
|
||||
@@ -71,6 +74,7 @@ fun SendPoll(
|
||||
*/
|
||||
fun Poll.createRequest(
|
||||
chatId: ChatIdentifier,
|
||||
threadId: MessageThreadId? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageId? = null,
|
||||
@@ -85,6 +89,7 @@ fun Poll.createRequest(
|
||||
isClosed,
|
||||
allowMultipleAnswers,
|
||||
scheduledCloseInfo,
|
||||
threadId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
@@ -101,6 +106,7 @@ fun Poll.createRequest(
|
||||
isClosed,
|
||||
textSources,
|
||||
scheduledCloseInfo,
|
||||
threadId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
@@ -115,6 +121,7 @@ fun Poll.createRequest(
|
||||
isClosed,
|
||||
false,
|
||||
scheduledCloseInfo,
|
||||
threadId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
@@ -129,6 +136,7 @@ fun Poll.createRequest(
|
||||
isClosed,
|
||||
false,
|
||||
scheduledCloseInfo,
|
||||
threadId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
@@ -193,6 +201,8 @@ data class SendRegularPoll(
|
||||
override val openPeriod: LongSeconds?= null,
|
||||
@SerialName(closeDateField)
|
||||
override val closeDate: LongSeconds?,
|
||||
@SerialName(messageThreadIdField)
|
||||
override val threadId: MessageThreadId? = null,
|
||||
@SerialName(disableNotificationField)
|
||||
override val disableNotification: Boolean = false,
|
||||
@SerialName(protectContentField)
|
||||
@@ -222,6 +232,7 @@ fun SendRegularPoll(
|
||||
isClosed: Boolean = false,
|
||||
allowMultipleAnswers: Boolean = false,
|
||||
closeInfo: ScheduledCloseInfo? = null,
|
||||
threadId: MessageThreadId? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageId? = null,
|
||||
@@ -236,6 +247,7 @@ fun SendRegularPoll(
|
||||
allowMultipleAnswers,
|
||||
(closeInfo as? ApproximateScheduledCloseInfo) ?.openPeriod,
|
||||
(closeInfo as? ExactScheduledCloseInfo) ?.closeDate,
|
||||
threadId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
@@ -253,6 +265,7 @@ fun SendQuizPoll(
|
||||
explanation: String? = null,
|
||||
parseMode: ParseMode? = null,
|
||||
closeInfo: ScheduledCloseInfo? = null,
|
||||
threadId: MessageThreadId? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageId? = null,
|
||||
@@ -269,6 +282,7 @@ fun SendQuizPoll(
|
||||
parseMode,
|
||||
null,
|
||||
closeInfo,
|
||||
threadId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
@@ -285,6 +299,7 @@ fun SendQuizPoll(
|
||||
isClosed: Boolean = false,
|
||||
entities: List<TextSource>,
|
||||
closeInfo: ScheduledCloseInfo? = null,
|
||||
threadId: MessageThreadId? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageId? = null,
|
||||
@@ -301,6 +316,7 @@ fun SendQuizPoll(
|
||||
null,
|
||||
entities.toRawMessageEntities(),
|
||||
closeInfo,
|
||||
threadId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
@@ -319,6 +335,7 @@ internal fun SendQuizPoll(
|
||||
parseMode: ParseMode? = null,
|
||||
rawEntities: List<RawMessageEntity>? = null,
|
||||
closeInfo: ScheduledCloseInfo? = null,
|
||||
threadId: MessageThreadId? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageId? = null,
|
||||
@@ -336,6 +353,7 @@ internal fun SendQuizPoll(
|
||||
rawEntities,
|
||||
(closeInfo as? ApproximateScheduledCloseInfo) ?.openPeriod,
|
||||
(closeInfo as? ExactScheduledCloseInfo) ?.closeDate,
|
||||
threadId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
@@ -367,6 +385,8 @@ data class SendQuizPoll internal constructor(
|
||||
override val openPeriod: LongSeconds? = null,
|
||||
@SerialName(closeDateField)
|
||||
override val closeDate: LongSeconds? = null,
|
||||
@SerialName(messageThreadIdField)
|
||||
override val threadId: MessageThreadId? = null,
|
||||
@SerialName(disableNotificationField)
|
||||
override val disableNotification: Boolean = false,
|
||||
@SerialName(protectContentField)
|
||||
|
@@ -94,6 +94,7 @@ val captionLength = 0 .. 1024
|
||||
val textLength = 1 .. 4096
|
||||
val userProfilePhotosRequestLimit = 0 .. 100
|
||||
val chatTitleLength = 1 until 255
|
||||
val threadNameLength = 1 until 128
|
||||
val chatDescriptionLength = 0 until 256
|
||||
val inlineResultQueryIdLingth = 1 until 64
|
||||
val allowedConnectionsLength = 1 .. 100
|
||||
@@ -170,6 +171,8 @@ const val addedToAttachmentMenuField = "added_to_attachment_menu"
|
||||
const val isPremiumField = "is_premium"
|
||||
const val hasPrivateForwardsField = "has_private_forwards"
|
||||
const val hasRestrictedVoiceAndVideoMessagesField = "has_restricted_voice_and_video_messages"
|
||||
const val emojiStatusCustomEmojiIdField = "emoji_status_custom_emoji_id"
|
||||
const val iconCustomEmojiIdField = "icon_custom_emoji_id"
|
||||
const val canJoinGroupsField = "can_join_groups"
|
||||
const val canReadAllGroupMessagesField = "can_read_all_group_messages"
|
||||
const val supportInlineQueriesField = "supports_inline_queries"
|
||||
@@ -222,6 +225,7 @@ const val totalVoterCountField = "total_voter_count"
|
||||
const val correctOptionIdField = "correct_option_id"
|
||||
const val allowsMultipleAnswersField = "allows_multiple_answers"
|
||||
const val isAnonymousField = "is_anonymous"
|
||||
const val canManageTopicsField = "can_manage_topics"
|
||||
const val captionEntitiesField = "caption_entities"
|
||||
const val loginUrlField = "login_url"
|
||||
const val forwardTextField = "forward_text"
|
||||
@@ -232,6 +236,7 @@ const val isAnimatedField = "is_animated"
|
||||
const val isVideoField = "is_video"
|
||||
const val inviteLinkField = "invite_link"
|
||||
const val pinnedMessageField = "pinned_message"
|
||||
const val activeUsernamesField = "active_usernames"
|
||||
const val customTitleField = "custom_title"
|
||||
const val optionIdsField = "option_ids"
|
||||
const val ipAddressField = "ip_address"
|
||||
@@ -247,6 +252,7 @@ const val expireDateField = "expire_date"
|
||||
const val createsJoinRequestField = "creates_join_request"
|
||||
const val pendingJoinRequestCountField = "pending_join_request_count"
|
||||
const val memberLimitField = "member_limit"
|
||||
const val iconColorField = "icon_color"
|
||||
|
||||
const val requestContactField = "request_contact"
|
||||
const val requestLocationField = "request_location"
|
||||
|
@@ -0,0 +1,26 @@
|
||||
package dev.inmo.tgbotapi.types
|
||||
|
||||
import dev.inmo.tgbotapi.utils.RGBColor
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class ForumTopic(
|
||||
@SerialName(messageThreadIdField)
|
||||
val messageThreadId: MessageThreadId,
|
||||
@SerialName(nameField)
|
||||
val name: String,
|
||||
@SerialName(iconColorField)
|
||||
val color: RGBColor,
|
||||
@SerialName(iconCustomEmojiIdField)
|
||||
val iconEmojiId: CustomEmojiId? = null
|
||||
) {
|
||||
companion object {
|
||||
val CYAN = RGBColor(0x6FB9F0)
|
||||
val YELLOW = RGBColor(0xffd67e)
|
||||
val PURPLE = RGBColor(0xCB86DB)
|
||||
val GREEN = RGBColor(0x8EEE98)
|
||||
val PINK = RGBColor(0xFF93B2)
|
||||
val RED = RGBColor(0xFB6F5F)
|
||||
}
|
||||
}
|
@@ -15,6 +15,8 @@ data class ExtendedChannelChatImpl(
|
||||
override val title: String,
|
||||
@SerialName(usernameField)
|
||||
override val username: Username? = null,
|
||||
@SerialName(activeUsernamesField)
|
||||
override val activeUsernames: List<Username> = emptyList(),
|
||||
@SerialName(photoField)
|
||||
override val chatPhoto: ChatPhoto? = null,
|
||||
@SerialName(descriptionField)
|
||||
@@ -55,6 +57,8 @@ data class ExtendedPrivateChatImpl(
|
||||
override val chatPhoto: ChatPhoto? = null,
|
||||
@SerialName(usernameField)
|
||||
override val username: Username? = null,
|
||||
@SerialName(activeUsernamesField)
|
||||
override val activeUsernames: List<Username> = emptyList(),
|
||||
@SerialName(firstNameField)
|
||||
override val firstName: String = "",
|
||||
@SerialName(lastNameField)
|
||||
@@ -64,7 +68,9 @@ data class ExtendedPrivateChatImpl(
|
||||
@SerialName(hasPrivateForwardsField)
|
||||
override val hasPrivateForwards: Boolean = false,
|
||||
@SerialName(hasRestrictedVoiceAndVideoMessagesField)
|
||||
override val hasRestrictedVoiceAndVideoMessages: Boolean = false
|
||||
override val hasRestrictedVoiceAndVideoMessages: Boolean = false,
|
||||
@SerialName(emojiStatusCustomEmojiIdField)
|
||||
override val statusEmojiId: CustomEmojiId? = null
|
||||
) : ExtendedPrivateChat
|
||||
|
||||
typealias ExtendedUser = ExtendedPrivateChatImpl
|
||||
@@ -77,6 +83,8 @@ data class ExtendedSupergroupChatImpl(
|
||||
override val title: String,
|
||||
@SerialName(usernameField)
|
||||
override val username: Username? = null,
|
||||
@SerialName(activeUsernamesField)
|
||||
override val activeUsernames: List<Username> = emptyList(),
|
||||
@SerialName(photoField)
|
||||
override val chatPhoto: ChatPhoto? = null,
|
||||
@SerialName(permissionsField)
|
||||
@@ -112,6 +120,8 @@ data class ExtendedForumChatImpl(
|
||||
override val title: String,
|
||||
@SerialName(usernameField)
|
||||
override val username: Username? = null,
|
||||
@SerialName(activeUsernamesField)
|
||||
override val activeUsernames: List<Username> = emptyList(),
|
||||
@SerialName(photoField)
|
||||
override val chatPhoto: ChatPhoto? = null,
|
||||
@SerialName(permissionsField)
|
||||
|
@@ -6,7 +6,7 @@ import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializ
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable(ExtendedChatSerializer::class)
|
||||
sealed interface ExtendedChannelChat : ChannelChat, ExtendedPublicChat {
|
||||
sealed interface ExtendedChannelChat : ChannelChat, ExtendedPublicChat, ExtendedChatWithUsername {
|
||||
val linkedGroupChatId: ChatId?
|
||||
}
|
||||
|
||||
@@ -16,10 +16,11 @@ sealed interface ExtendedGroupChat : GroupChat, ExtendedPublicChat {
|
||||
}
|
||||
|
||||
@Serializable(ExtendedChatSerializer::class)
|
||||
sealed interface ExtendedPrivateChat : PrivateChat, ExtendedChat {
|
||||
sealed interface ExtendedPrivateChat : PrivateChat, ExtendedChatWithUsername {
|
||||
val bio: String
|
||||
val hasPrivateForwards: Boolean
|
||||
val hasRestrictedVoiceAndVideoMessages: Boolean
|
||||
val statusEmojiId: CustomEmojiId?
|
||||
|
||||
val allowCreateUserIdLink: Boolean
|
||||
get() = hasPrivateForwards
|
||||
@@ -33,7 +34,7 @@ sealed interface ExtendedPublicChat : ExtendedChat, PublicChat {
|
||||
}
|
||||
|
||||
@Serializable(ExtendedChatSerializer::class)
|
||||
sealed interface ExtendedSupergroupChat : SupergroupChat, ExtendedGroupChat {
|
||||
sealed interface ExtendedSupergroupChat : SupergroupChat, ExtendedGroupChat, ExtendedChatWithUsername {
|
||||
val slowModeDelay: Long?
|
||||
val stickerSetName: StickerSetName?
|
||||
val canSetStickerSet: Boolean
|
||||
@@ -58,3 +59,8 @@ sealed interface ExtendedForumChat : ExtendedSupergroupChat
|
||||
sealed interface ExtendedChat : Chat {
|
||||
val chatPhoto: ChatPhoto?
|
||||
}
|
||||
|
||||
@Serializable(ExtendedChatSerializer::class)
|
||||
sealed interface ExtendedChatWithUsername : UsernameChat, ExtendedChat {
|
||||
val activeUsernames: List<Username>
|
||||
}
|
||||
|
@@ -33,7 +33,9 @@ data class AdministratorChatMemberImpl(
|
||||
@SerialName(isAnonymousField)
|
||||
override val isAnonymous: Boolean = false,
|
||||
@SerialName(customTitleField)
|
||||
override val customTitle: String? = null
|
||||
override val customTitle: String? = null,
|
||||
@SerialName(canManageTopicsField)
|
||||
override val canManageTopics: Boolean = false
|
||||
) : AdministratorChatMember {
|
||||
@SerialName(statusField)
|
||||
@Required
|
||||
|
@@ -4,6 +4,7 @@ sealed interface SpecialChatAdministratorRights {
|
||||
val canChangeInfo: Boolean
|
||||
val canInviteUsers: Boolean
|
||||
val canPinMessages: Boolean
|
||||
val canManageTopics: Boolean
|
||||
}
|
||||
|
||||
sealed interface ChatAdministratorRights : SpecialChatAdministratorRights {
|
||||
|
@@ -27,5 +27,7 @@ data class ChatAdministratorRightsImpl(
|
||||
@SerialName(canManageChatField)
|
||||
override val canManageChat: Boolean = false,
|
||||
@SerialName(isAnonymousField)
|
||||
override val isAnonymous: Boolean = false
|
||||
override val isAnonymous: Boolean = false,
|
||||
@SerialName(canManageTopicsField)
|
||||
override val canManageTopics: Boolean = false
|
||||
) : ChatAdministratorRights
|
||||
|
@@ -34,6 +34,8 @@ data class OwnerChatMember(
|
||||
override val canManageVideoChats: Boolean = true
|
||||
@Transient
|
||||
override val canManageChat: Boolean = true
|
||||
@Transient
|
||||
override val canManageTopics: Boolean = true
|
||||
@SerialName(statusField)
|
||||
@Required
|
||||
private val type: String = "creator"
|
||||
|
@@ -27,7 +27,9 @@ data class RestrictedChatMember(
|
||||
@SerialName(canInviteUsersField)
|
||||
override val canInviteUsers: Boolean = false,
|
||||
@SerialName(canPinMessagesField)
|
||||
override val canPinMessages: Boolean = false
|
||||
override val canPinMessages: Boolean = false,
|
||||
@SerialName(canManageTopicsField)
|
||||
override val canManageTopics: Boolean = false
|
||||
) : BannedChatMember, SpecialRightsChatMember {
|
||||
@SerialName(statusField)
|
||||
@Required
|
||||
|
@@ -3,6 +3,7 @@ package dev.inmo.tgbotapi.types.message
|
||||
import com.soywiz.klock.DateTime
|
||||
import dev.inmo.tgbotapi.types.MediaGroupIdentifier
|
||||
import dev.inmo.tgbotapi.types.MessageId
|
||||
import dev.inmo.tgbotapi.types.MessageThreadId
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.chat.Chat
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.MediaGroupMessage
|
||||
@@ -11,6 +12,7 @@ import dev.inmo.tgbotapi.types.message.content.MediaGroupPartContent
|
||||
|
||||
data class ChannelMediaGroupMessage<T : MediaGroupPartContent>(
|
||||
override val messageId: MessageId,
|
||||
override val threadId: MessageThreadId?,
|
||||
override val chat: Chat,
|
||||
override val date: DateTime,
|
||||
override val mediaGroupId: MediaGroupIdentifier,
|
||||
|
@@ -0,0 +1,3 @@
|
||||
package dev.inmo.tgbotapi.types.message.ChatEvents.abstracts
|
||||
|
||||
interface ForumEvent: SupergroupEvent
|
@@ -0,0 +1,7 @@
|
||||
package dev.inmo.tgbotapi.types.message.ChatEvents.forum
|
||||
|
||||
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.ForumEvent
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
object ForumTopicClosed : ForumEvent
|
@@ -0,0 +1,20 @@
|
||||
package dev.inmo.tgbotapi.types.message.ChatEvents.forum
|
||||
|
||||
import dev.inmo.tgbotapi.types.CustomEmojiId
|
||||
import dev.inmo.tgbotapi.types.iconColorField
|
||||
import dev.inmo.tgbotapi.types.iconCustomEmojiIdField
|
||||
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.ForumEvent
|
||||
import dev.inmo.tgbotapi.types.nameField
|
||||
import dev.inmo.tgbotapi.utils.RGBColor
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class ForumTopicCreated(
|
||||
@SerialName(nameField)
|
||||
val name: String,
|
||||
@SerialName(iconColorField)
|
||||
val iconColor: RGBColor,
|
||||
@SerialName(iconCustomEmojiIdField)
|
||||
val iconEmojiId: CustomEmojiId? = null
|
||||
) : ForumEvent
|
@@ -0,0 +1,7 @@
|
||||
package dev.inmo.tgbotapi.types.message.ChatEvents.forum
|
||||
|
||||
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.ForumEvent
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
object ForumTopicReopened : ForumEvent
|
@@ -10,6 +10,7 @@ import dev.inmo.tgbotapi.types.message.content.MediaGroupPartContent
|
||||
|
||||
data class CommonMediaGroupMessage<T : MediaGroupPartContent>(
|
||||
override val messageId: MessageId,
|
||||
override val threadId: MessageThreadId?,
|
||||
override val from: User,
|
||||
override val chat: Chat,
|
||||
override val date: DateTime,
|
||||
|
@@ -12,6 +12,9 @@ import dev.inmo.tgbotapi.types.games.RawGame
|
||||
import dev.inmo.tgbotapi.types.location.Location
|
||||
import dev.inmo.tgbotapi.types.message.ChatEvents.*
|
||||
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.*
|
||||
import dev.inmo.tgbotapi.types.message.ChatEvents.forum.ForumTopicClosed
|
||||
import dev.inmo.tgbotapi.types.message.ChatEvents.forum.ForumTopicCreated
|
||||
import dev.inmo.tgbotapi.types.message.ChatEvents.forum.ForumTopicReopened
|
||||
import dev.inmo.tgbotapi.types.message.ChatEvents.voice.*
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.*
|
||||
import dev.inmo.tgbotapi.types.message.content.*
|
||||
@@ -91,6 +94,11 @@ internal data class RawMessage(
|
||||
private val video_chat_ended: VideoChatEnded? = null,
|
||||
private val video_chat_participants_invited: VideoChatParticipantsInvited? = null,
|
||||
|
||||
// Forum
|
||||
private val forum_topic_created: ForumTopicCreated? = null,
|
||||
private val forum_topic_closed: ForumTopicClosed? = null,
|
||||
private val forum_topic_reopened: ForumTopicReopened? = null,
|
||||
|
||||
// AutoDelete Message time changed
|
||||
private val message_auto_delete_timer_changed: MessageAutoDeleteTimerChanged? = null,
|
||||
|
||||
@@ -204,6 +212,9 @@ internal data class RawMessage(
|
||||
video_chat_started != null -> video_chat_started
|
||||
video_chat_scheduled != null -> video_chat_scheduled
|
||||
message_auto_delete_timer_changed != null -> message_auto_delete_timer_changed
|
||||
forum_topic_created != null -> forum_topic_created
|
||||
forum_topic_closed != null -> forum_topic_closed
|
||||
forum_topic_reopened != null -> forum_topic_reopened
|
||||
video_chat_ended != null -> video_chat_ended
|
||||
video_chat_participants_invited != null -> video_chat_participants_invited
|
||||
delete_chat_photo -> DeleteChatPhoto()
|
||||
@@ -270,6 +281,7 @@ internal data class RawMessage(
|
||||
when (from) {
|
||||
null -> ChannelMediaGroupMessage(
|
||||
messageId,
|
||||
messageThreadId,
|
||||
chat,
|
||||
date.asDate,
|
||||
it,
|
||||
@@ -282,6 +294,7 @@ internal data class RawMessage(
|
||||
)
|
||||
else -> CommonMediaGroupMessage(
|
||||
messageId,
|
||||
messageThreadId,
|
||||
from,
|
||||
chat,
|
||||
date.asDate,
|
||||
|
@@ -10,9 +10,9 @@ sealed interface GroupContentMessage<T : MessageContent> : PublicContentMessage<
|
||||
override val chat: GroupChat
|
||||
}
|
||||
|
||||
sealed interface ForumContentMessage<T : MessageContent> : GroupContentMessage<T> {
|
||||
sealed interface ForumContentMessage<T : MessageContent> : GroupContentMessage<T>, PossiblyTopicMessage {
|
||||
override val chat: ForumChat
|
||||
val threadId: MessageThreadId
|
||||
override val threadId: MessageThreadId
|
||||
}
|
||||
|
||||
|
||||
|
@@ -1,8 +1,10 @@
|
||||
package dev.inmo.tgbotapi.types.message.abstracts
|
||||
|
||||
import dev.inmo.tgbotapi.types.MediaGroupIdentifier
|
||||
import dev.inmo.tgbotapi.types.MessageThreadId
|
||||
import dev.inmo.tgbotapi.types.message.content.MediaGroupPartContent
|
||||
|
||||
interface MediaGroupMessage<T : MediaGroupPartContent> : CommonMessage<T> {
|
||||
val mediaGroupId: MediaGroupIdentifier
|
||||
val threadId: MessageThreadId?
|
||||
}
|
||||
|
@@ -0,0 +1,7 @@
|
||||
package dev.inmo.tgbotapi.types.message.abstracts
|
||||
|
||||
import dev.inmo.tgbotapi.types.MessageThreadId
|
||||
|
||||
interface PossiblyTopicMessage : Message {
|
||||
val threadId: MessageThreadId?
|
||||
}
|
@@ -4,6 +4,7 @@ import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded
|
||||
import dev.inmo.tgbotapi.requests.abstracts.Request
|
||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.MessageId
|
||||
import dev.inmo.tgbotapi.types.MessageThreadId
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.files.TelegramMediaFile
|
||||
import dev.inmo.tgbotapi.types.media.TelegramMedia
|
||||
@@ -113,6 +114,7 @@ sealed interface MediaContent: MessageContent {
|
||||
sealed interface ResendableContent {
|
||||
fun createResend(
|
||||
chatId: ChatIdentifier,
|
||||
messageThreadId: MessageThreadId? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageId? = null,
|
||||
|
@@ -6,6 +6,7 @@ import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.media.TelegramMediaAnimation
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.MessageId
|
||||
import dev.inmo.tgbotapi.types.MessageThreadId
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.files.AnimationFile
|
||||
import dev.inmo.tgbotapi.types.files.DocumentFile
|
||||
@@ -21,6 +22,7 @@ data class AnimationContent(
|
||||
) : TextedMediaContent {
|
||||
override fun createResend(
|
||||
chatId: ChatIdentifier,
|
||||
messageThreadId: MessageThreadId?,
|
||||
disableNotification: Boolean,
|
||||
protectContent: Boolean,
|
||||
replyToMessageId: MessageId?,
|
||||
@@ -34,6 +36,7 @@ data class AnimationContent(
|
||||
media.duration,
|
||||
media.width,
|
||||
media.height,
|
||||
messageThreadId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
|
@@ -7,6 +7,7 @@ import dev.inmo.tgbotapi.types.media.TelegramMediaAudio
|
||||
import dev.inmo.tgbotapi.types.media.toTelegramMediaAudio
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.MessageId
|
||||
import dev.inmo.tgbotapi.types.MessageThreadId
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.files.AudioFile
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||
@@ -20,6 +21,7 @@ data class AudioContent(
|
||||
) : AudioMediaGroupPartContent {
|
||||
override fun createResend(
|
||||
chatId: ChatIdentifier,
|
||||
messageThreadId: MessageThreadId?,
|
||||
disableNotification: Boolean,
|
||||
protectContent: Boolean,
|
||||
replyToMessageId: MessageId?,
|
||||
@@ -33,6 +35,7 @@ data class AudioContent(
|
||||
media.duration,
|
||||
media.performer,
|
||||
media.title,
|
||||
messageThreadId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
|
@@ -13,12 +13,13 @@ data class ContactContent(
|
||||
) : MessageContent {
|
||||
override fun createResend(
|
||||
chatId: ChatIdentifier,
|
||||
messageThreadId: MessageThreadId?,
|
||||
disableNotification: Boolean,
|
||||
protectContent: Boolean,
|
||||
replyToMessageId: MessageId?,
|
||||
allowSendingWithoutReply: Boolean?,
|
||||
replyMarkup: KeyboardMarkup?
|
||||
): Request<ContentMessage<ContactContent>> = SendContact(
|
||||
chatId, contact, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
||||
chatId, contact, messageThreadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
||||
)
|
||||
}
|
||||
|
@@ -4,6 +4,7 @@ import dev.inmo.tgbotapi.requests.abstracts.Request
|
||||
import dev.inmo.tgbotapi.requests.send.SendDice
|
||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.MessageId
|
||||
import dev.inmo.tgbotapi.types.MessageThreadId
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.dice.Dice
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||
@@ -15,6 +16,7 @@ data class DiceContent(
|
||||
) : MessageContent {
|
||||
override fun createResend(
|
||||
chatId: ChatIdentifier,
|
||||
messageThreadId: MessageThreadId?,
|
||||
disableNotification: Boolean,
|
||||
protectContent: Boolean,
|
||||
replyToMessageId: MessageId?,
|
||||
@@ -23,6 +25,7 @@ data class DiceContent(
|
||||
): Request<ContentMessage<DiceContent>> = SendDice(
|
||||
chatId,
|
||||
dice.animationType,
|
||||
messageThreadId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
|
@@ -8,6 +8,7 @@ import dev.inmo.tgbotapi.types.media.TelegramMediaDocument
|
||||
import dev.inmo.tgbotapi.types.media.toTelegramMediaDocument
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.MessageId
|
||||
import dev.inmo.tgbotapi.types.MessageThreadId
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.files.DocumentFile
|
||||
import dev.inmo.tgbotapi.types.files.asDocumentFile
|
||||
@@ -22,6 +23,7 @@ data class DocumentContent(
|
||||
) : DocumentMediaGroupPartContent {
|
||||
override fun createResend(
|
||||
chatId: ChatIdentifier,
|
||||
messageThreadId: MessageThreadId?,
|
||||
disableNotification: Boolean,
|
||||
protectContent: Boolean,
|
||||
replyToMessageId: MessageId?,
|
||||
@@ -32,6 +34,7 @@ data class DocumentContent(
|
||||
media.fileId,
|
||||
media.thumb ?.fileId,
|
||||
textSources,
|
||||
messageThreadId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
|
@@ -4,6 +4,7 @@ import dev.inmo.tgbotapi.requests.abstracts.Request
|
||||
import dev.inmo.tgbotapi.requests.send.games.SendGame
|
||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.MessageId
|
||||
import dev.inmo.tgbotapi.types.MessageThreadId
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.games.Game
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||
@@ -15,6 +16,7 @@ data class GameContent(
|
||||
) : MessageContent {
|
||||
override fun createResend(
|
||||
chatId: ChatIdentifier,
|
||||
messageThreadId: MessageThreadId?,
|
||||
disableNotification: Boolean,
|
||||
protectContent: Boolean,
|
||||
replyToMessageId: MessageId?,
|
||||
@@ -23,6 +25,7 @@ data class GameContent(
|
||||
): Request<ContentMessage<GameContent>> = SendGame(
|
||||
chatId,
|
||||
game.title,
|
||||
messageThreadId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
|
@@ -3,6 +3,7 @@ package dev.inmo.tgbotapi.types.message.content
|
||||
import dev.inmo.tgbotapi.requests.abstracts.Request
|
||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.MessageId
|
||||
import dev.inmo.tgbotapi.types.MessageThreadId
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||
import dev.inmo.tgbotapi.types.payments.Invoice
|
||||
@@ -14,6 +15,7 @@ data class InvoiceContent(
|
||||
) : MessageContent {
|
||||
override fun createResend(
|
||||
chatId: ChatIdentifier,
|
||||
messageThreadId: MessageThreadId?,
|
||||
disableNotification: Boolean,
|
||||
protectContent: Boolean,
|
||||
replyToMessageId: MessageId?,
|
||||
|
@@ -6,6 +6,7 @@ import dev.inmo.tgbotapi.requests.send.SendStaticLocation
|
||||
import dev.inmo.tgbotapi.requests.send.abstracts.SendMessageRequest
|
||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.MessageId
|
||||
import dev.inmo.tgbotapi.types.MessageThreadId
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.location.*
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||
@@ -99,6 +100,7 @@ data class LiveLocationContent(
|
||||
) : LocationContent {
|
||||
override fun createResend(
|
||||
chatId: ChatIdentifier,
|
||||
messageThreadId: MessageThreadId?,
|
||||
disableNotification: Boolean,
|
||||
protectContent: Boolean,
|
||||
replyToMessageId: MessageId?,
|
||||
@@ -112,6 +114,7 @@ data class LiveLocationContent(
|
||||
location.horizontalAccuracy,
|
||||
location.heading,
|
||||
location.proximityAlertRadius,
|
||||
messageThreadId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
@@ -130,6 +133,7 @@ data class StaticLocationContent(
|
||||
) : LocationContent {
|
||||
override fun createResend(
|
||||
chatId: ChatIdentifier,
|
||||
messageThreadId: MessageThreadId?,
|
||||
disableNotification: Boolean,
|
||||
protectContent: Boolean,
|
||||
replyToMessageId: MessageId?,
|
||||
@@ -139,6 +143,7 @@ data class StaticLocationContent(
|
||||
chatId,
|
||||
location.latitude,
|
||||
location.longitude,
|
||||
messageThreadId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
|
@@ -7,6 +7,7 @@ import dev.inmo.tgbotapi.types.media.TelegramMediaPhoto
|
||||
import dev.inmo.tgbotapi.types.media.toTelegramMediaPhoto
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.MessageId
|
||||
import dev.inmo.tgbotapi.types.MessageThreadId
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.files.*
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||
@@ -22,6 +23,7 @@ data class PhotoContent(
|
||||
|
||||
override fun createResend(
|
||||
chatId: ChatIdentifier,
|
||||
messageThreadId: MessageThreadId?,
|
||||
disableNotification: Boolean,
|
||||
protectContent: Boolean,
|
||||
replyToMessageId: MessageId?,
|
||||
@@ -31,6 +33,7 @@ data class PhotoContent(
|
||||
chatId,
|
||||
media.fileId,
|
||||
textSources,
|
||||
messageThreadId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
|
@@ -4,6 +4,7 @@ import dev.inmo.tgbotapi.requests.abstracts.Request
|
||||
import dev.inmo.tgbotapi.requests.send.polls.createRequest
|
||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.MessageId
|
||||
import dev.inmo.tgbotapi.types.MessageThreadId
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||
import dev.inmo.tgbotapi.types.polls.Poll
|
||||
@@ -15,6 +16,7 @@ data class PollContent(
|
||||
) : MessageContent {
|
||||
override fun createResend(
|
||||
chatId: ChatIdentifier,
|
||||
messageThreadId: MessageThreadId?,
|
||||
disableNotification: Boolean,
|
||||
protectContent: Boolean,
|
||||
replyToMessageId: MessageId?,
|
||||
@@ -22,6 +24,7 @@ data class PollContent(
|
||||
replyMarkup: KeyboardMarkup?
|
||||
): Request<ContentMessage<PollContent>> = poll.createRequest(
|
||||
chatId,
|
||||
messageThreadId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
|
@@ -5,6 +5,7 @@ import dev.inmo.tgbotapi.requests.send.media.SendSticker
|
||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.media.TelegramMediaDocument
|
||||
import dev.inmo.tgbotapi.types.MessageId
|
||||
import dev.inmo.tgbotapi.types.MessageThreadId
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.files.Sticker
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||
@@ -16,6 +17,7 @@ data class StickerContent(
|
||||
) : MediaContent {
|
||||
override fun createResend(
|
||||
chatId: ChatIdentifier,
|
||||
messageThreadId: MessageThreadId?,
|
||||
disableNotification: Boolean,
|
||||
protectContent: Boolean,
|
||||
replyToMessageId: MessageId?,
|
||||
@@ -24,6 +26,7 @@ data class StickerContent(
|
||||
): Request<ContentMessage<StickerContent>> = SendSticker(
|
||||
chatId,
|
||||
media.fileId,
|
||||
messageThreadId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
|
@@ -6,6 +6,7 @@ import dev.inmo.tgbotapi.requests.send.SendTextMessage
|
||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.MessageId
|
||||
import dev.inmo.tgbotapi.types.MessageThreadId
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||
import kotlinx.serialization.Serializable
|
||||
@@ -17,6 +18,7 @@ data class TextContent(
|
||||
) : MessageContent, TextedInput {
|
||||
override fun createResend(
|
||||
chatId: ChatIdentifier,
|
||||
messageThreadId: MessageThreadId?,
|
||||
disableNotification: Boolean,
|
||||
protectContent: Boolean,
|
||||
replyToMessageId: MessageId?,
|
||||
@@ -26,6 +28,7 @@ data class TextContent(
|
||||
chatId,
|
||||
textSources,
|
||||
false,
|
||||
messageThreadId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
|
@@ -4,6 +4,7 @@ import dev.inmo.tgbotapi.requests.abstracts.Request
|
||||
import dev.inmo.tgbotapi.requests.send.SendVenue
|
||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.MessageId
|
||||
import dev.inmo.tgbotapi.types.MessageThreadId
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||
import dev.inmo.tgbotapi.types.venue.Venue
|
||||
@@ -15,12 +16,13 @@ data class VenueContent(
|
||||
) : MessageContent {
|
||||
override fun createResend(
|
||||
chatId: ChatIdentifier,
|
||||
messageThreadId: MessageThreadId?,
|
||||
disableNotification: Boolean,
|
||||
protectContent: Boolean,
|
||||
replyToMessageId: MessageId?,
|
||||
allowSendingWithoutReply: Boolean?,
|
||||
replyMarkup: KeyboardMarkup?
|
||||
): Request<ContentMessage<VenueContent>> = SendVenue(
|
||||
chatId, venue, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
||||
chatId, venue, messageThreadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
||||
)
|
||||
}
|
||||
|
@@ -6,6 +6,7 @@ import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.media.TelegramMediaVideo
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.MessageId
|
||||
import dev.inmo.tgbotapi.types.MessageThreadId
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.files.VideoFile
|
||||
import dev.inmo.tgbotapi.types.files.toTelegramMediaVideo
|
||||
@@ -20,6 +21,7 @@ data class VideoContent(
|
||||
) : VisualMediaGroupPartContent {
|
||||
override fun createResend(
|
||||
chatId: ChatIdentifier,
|
||||
messageThreadId: MessageThreadId?,
|
||||
disableNotification: Boolean,
|
||||
protectContent: Boolean,
|
||||
replyToMessageId: MessageId?,
|
||||
@@ -34,6 +36,7 @@ data class VideoContent(
|
||||
media.width,
|
||||
media.height,
|
||||
null,
|
||||
messageThreadId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
|
@@ -5,6 +5,7 @@ import dev.inmo.tgbotapi.requests.send.media.SendVideoNote
|
||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.media.TelegramMediaVideo
|
||||
import dev.inmo.tgbotapi.types.MessageId
|
||||
import dev.inmo.tgbotapi.types.MessageThreadId
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.files.VideoNoteFile
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||
@@ -16,6 +17,7 @@ data class VideoNoteContent(
|
||||
) : MediaContent {
|
||||
override fun createResend(
|
||||
chatId: ChatIdentifier,
|
||||
messageThreadId: MessageThreadId?,
|
||||
disableNotification: Boolean,
|
||||
protectContent: Boolean,
|
||||
replyToMessageId: MessageId?,
|
||||
@@ -27,6 +29,7 @@ data class VideoNoteContent(
|
||||
media.thumb ?.fileId,
|
||||
media.duration,
|
||||
media.width,
|
||||
messageThreadId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
|
@@ -6,6 +6,7 @@ import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.media.TelegramMediaAudio
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.MessageId
|
||||
import dev.inmo.tgbotapi.types.MessageThreadId
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.files.VoiceFile
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||
@@ -19,6 +20,7 @@ data class VoiceContent(
|
||||
) : TextedMediaContent {
|
||||
override fun createResend(
|
||||
chatId: ChatIdentifier,
|
||||
messageThreadId: MessageThreadId?,
|
||||
disableNotification: Boolean,
|
||||
protectContent: Boolean,
|
||||
replyToMessageId: MessageId?,
|
||||
@@ -29,6 +31,7 @@ data class VoiceContent(
|
||||
media.fileId,
|
||||
textSources,
|
||||
media.duration,
|
||||
messageThreadId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
|
@@ -0,0 +1,10 @@
|
||||
package dev.inmo.tgbotapi.utils
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlin.jvm.JvmInline
|
||||
|
||||
@Serializable
|
||||
@JvmInline
|
||||
value class RGBColor(
|
||||
val int: Int
|
||||
)
|
Reference in New Issue
Block a user