1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-22 16:23:48 +00:00

small improvements

This commit is contained in:
InsanusMokrassar 2022-06-21 18:30:31 +06:00
parent 1df653f428
commit b0c6b80d8b
4 changed files with 24 additions and 5 deletions

View File

@ -97,9 +97,9 @@ data class ExtendedSupergroupChatImpl(
@SerialName(locationField)
override val location: ChatLocation? = null,
@SerialName(joinToSendMessagesField)
override val requireToJoinForMessaging: Boolean = false,
override val requiresJoinForMessaging: Boolean = false,
@SerialName(joinByRequestField)
override val requireAdminApproveOnJoin: Boolean = false
override val requireAdminApproveToJoin: Boolean = false
) : ExtendedSupergroupChat
@Serializable

View File

@ -1,7 +1,6 @@
package dev.inmo.tgbotapi.types.chat
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.chat.ExtendedChat
import dev.inmo.tgbotapi.types.message.abstracts.Message
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializeOnlySerializer
import kotlinx.serialization.Serializable
@ -43,12 +42,12 @@ sealed interface ExtendedSupergroupChat : SupergroupChat, ExtendedGroupChat {
/**
* This field represents field "join_to_send_messages" from API
*/
val requireToJoinForMessaging: Boolean
val requiresJoinForMessaging: Boolean
/**
* This field represents field "join_by_request" from API
*/
val requireAdminApproveOnJoin: Boolean
val requireAdminApproveToJoin: Boolean
}
@Serializable(ExtendedChatSerializer::class)

View File

@ -235,6 +235,24 @@ inline fun Chat.asExtendedSupergroupChat(): ExtendedSupergroupChat? = this as? E
@PreviewFeature
inline fun Chat.requireExtendedSupergroupChat(): ExtendedSupergroupChat = this as ExtendedSupergroupChat
@PreviewFeature
inline fun <T> Chat.whenPremiumChat(block: (PremiumChat) -> T) = asPremiumChat() ?.let(block)
@PreviewFeature
inline fun Chat.asPremiumChat(): PremiumChat? = this as? PremiumChat
@PreviewFeature
inline fun Chat.requirePremiumChat(): PremiumChat = this as PremiumChat
@PreviewFeature
inline fun <T> Chat.whenAbleToAddInAttachmentMenuChat(block: (AbleToAddInAttachmentMenuChat) -> T) = asAbleToAddInAttachmentMenuChat() ?.let(block)
@PreviewFeature
inline fun Chat.asAbleToAddInAttachmentMenuChat(): AbleToAddInAttachmentMenuChat? = this as? AbleToAddInAttachmentMenuChat
@PreviewFeature
inline fun Chat.requireAbleToAddInAttachmentMenuChat(): AbleToAddInAttachmentMenuChat = this as AbleToAddInAttachmentMenuChat
@PreviewFeature
inline fun <T> CallbackQuery.whenDataCallbackQuery(block: (DataCallbackQuery) -> T) = asDataCallbackQuery() ?.let(block)

View File

@ -19,3 +19,5 @@ inline val Sticker.mask_position: MaskPosition?
get() = maskPosition
inline val Sticker.file_size: Long?
get() = fileSize
inline val Sticker.premium_animation: File?
get() = premiumAnimationFile