mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2025-09-07 17:19:24 +00:00
add BusinessBotRights
This commit is contained in:
@@ -186,6 +186,19 @@ const val hasMainWebAppField = "has_main_web_app"
|
|||||||
const val canJoinGroupsField = "can_join_groups"
|
const val canJoinGroupsField = "can_join_groups"
|
||||||
const val canReadAllGroupMessagesField = "can_read_all_group_messages"
|
const val canReadAllGroupMessagesField = "can_read_all_group_messages"
|
||||||
const val canReplyField = "can_reply"
|
const val canReplyField = "can_reply"
|
||||||
|
const val canReadMessagesField = "can_read_messages"
|
||||||
|
const val canDeleteOutgoingMessagesField = "can_delete_outgoing_messages"
|
||||||
|
const val canDeleteAllMessagesField = "can_delete_all_messages"
|
||||||
|
const val canEditNameField = "can_edit_name"
|
||||||
|
const val canEditBioField = "can_edit_bio"
|
||||||
|
const val canEditProfilePhotoField = "can_edit_profile_photo"
|
||||||
|
const val canEditUsernameField = "can_edit_username"
|
||||||
|
const val canChangeGiftSettingsField = "can_change_gift_settings"
|
||||||
|
const val canViewGiftsAndStarsField = "can_view_gifts_and_stars"
|
||||||
|
const val canConvertGiftsToStarsField = "can_convert_gifts_to_stars"
|
||||||
|
const val canTransferAndUpgradeGiftsField = "can_transfer_and_upgrade_gifts"
|
||||||
|
const val canTransferStarsField = "can_transfer_stars"
|
||||||
|
const val canManageStoriesField = "can_manage_stories"
|
||||||
const val supportInlineQueriesField = "supports_inline_queries"
|
const val supportInlineQueriesField = "supports_inline_queries"
|
||||||
const val canConnectToBusinessField = "can_connect_to_business"
|
const val canConnectToBusinessField = "can_connect_to_business"
|
||||||
const val textEntitiesField = "text_entities"
|
const val textEntitiesField = "text_entities"
|
||||||
|
@@ -0,0 +1,50 @@
|
|||||||
|
package dev.inmo.tgbotapi.types.business_connection
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.types.canChangeGiftSettingsField
|
||||||
|
import dev.inmo.tgbotapi.types.canConvertGiftsToStarsField
|
||||||
|
import dev.inmo.tgbotapi.types.canDeleteAllMessagesField
|
||||||
|
import dev.inmo.tgbotapi.types.canDeleteOutgoingMessagesField
|
||||||
|
import dev.inmo.tgbotapi.types.canEditBioField
|
||||||
|
import dev.inmo.tgbotapi.types.canEditNameField
|
||||||
|
import dev.inmo.tgbotapi.types.canEditProfilePhotoField
|
||||||
|
import dev.inmo.tgbotapi.types.canEditUsernameField
|
||||||
|
import dev.inmo.tgbotapi.types.canManageStoriesField
|
||||||
|
import dev.inmo.tgbotapi.types.canReadMessagesField
|
||||||
|
import dev.inmo.tgbotapi.types.canReplyField
|
||||||
|
import dev.inmo.tgbotapi.types.canTransferAndUpgradeGiftsField
|
||||||
|
import dev.inmo.tgbotapi.types.canTransferStarsField
|
||||||
|
import dev.inmo.tgbotapi.types.canViewGiftsAndStarsField
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class BusinessBotRights(
|
||||||
|
@SerialName(canReplyField)
|
||||||
|
val canReply: Boolean = false,
|
||||||
|
@SerialName(canReadMessagesField)
|
||||||
|
val canMarkMessagesAsRead: Boolean = false,
|
||||||
|
@SerialName(canDeleteOutgoingMessagesField)
|
||||||
|
val canDeleteOutgoingMessages: Boolean = false,
|
||||||
|
@SerialName(canDeleteAllMessagesField)
|
||||||
|
val canDeleteAllMessages: Boolean = false,
|
||||||
|
@SerialName(canEditNameField)
|
||||||
|
val canEditName: Boolean = false,
|
||||||
|
@SerialName(canEditBioField)
|
||||||
|
val canEditBio: Boolean = false,
|
||||||
|
@SerialName(canEditProfilePhotoField)
|
||||||
|
val canEditProfilePhoto: Boolean = false,
|
||||||
|
@SerialName(canEditUsernameField)
|
||||||
|
val canEditUsername: Boolean = false,
|
||||||
|
@SerialName(canChangeGiftSettingsField)
|
||||||
|
val canChangeGiftSettings: Boolean = false,
|
||||||
|
@SerialName(canViewGiftsAndStarsField)
|
||||||
|
val canViewGiftsAndStars: Boolean = false,
|
||||||
|
@SerialName(canConvertGiftsToStarsField)
|
||||||
|
val canConvertGiftsToStars: Boolean = false,
|
||||||
|
@SerialName(canTransferAndUpgradeGiftsField)
|
||||||
|
val canTransferAndUpgradeGifts: Boolean = false,
|
||||||
|
@SerialName(canTransferStarsField)
|
||||||
|
val canTransferStars: Boolean = false,
|
||||||
|
@SerialName(canManageStoriesField)
|
||||||
|
val canManageStories: Boolean = false,
|
||||||
|
)
|
@@ -16,7 +16,9 @@ sealed interface BusinessConnection : WithBusinessConnectionId {
|
|||||||
val user: PreviewUser
|
val user: PreviewUser
|
||||||
val userChatId: ChatId
|
val userChatId: ChatId
|
||||||
val date: TelegramDate
|
val date: TelegramDate
|
||||||
|
val rights: BusinessBotRights
|
||||||
val canReply: Boolean
|
val canReply: Boolean
|
||||||
|
get() = rights.canReply
|
||||||
val isEnabled: Boolean
|
val isEnabled: Boolean
|
||||||
|
|
||||||
override val businessConnectionId: BusinessConnectionId
|
override val businessConnectionId: BusinessConnectionId
|
||||||
@@ -32,8 +34,8 @@ sealed interface BusinessConnection : WithBusinessConnectionId {
|
|||||||
override val userChatId: ChatId,
|
override val userChatId: ChatId,
|
||||||
@SerialName(dateField)
|
@SerialName(dateField)
|
||||||
override val date: TelegramDate,
|
override val date: TelegramDate,
|
||||||
@SerialName(canReplyField)
|
@SerialName(rightsField)
|
||||||
override val canReply: Boolean,
|
override val rights: BusinessBotRights = BusinessBotRights(),
|
||||||
) : BusinessConnection {
|
) : BusinessConnection {
|
||||||
@EncodeDefault
|
@EncodeDefault
|
||||||
override val isEnabled: Boolean = true
|
override val isEnabled: Boolean = true
|
||||||
@@ -49,8 +51,8 @@ sealed interface BusinessConnection : WithBusinessConnectionId {
|
|||||||
override val userChatId: ChatId,
|
override val userChatId: ChatId,
|
||||||
@SerialName(dateField)
|
@SerialName(dateField)
|
||||||
override val date: TelegramDate,
|
override val date: TelegramDate,
|
||||||
@SerialName(canReplyField)
|
@SerialName(rightsField)
|
||||||
override val canReply: Boolean,
|
override val rights: BusinessBotRights = BusinessBotRights(),
|
||||||
) : BusinessConnection {
|
) : BusinessConnection {
|
||||||
@EncodeDefault
|
@EncodeDefault
|
||||||
override val isEnabled: Boolean = false
|
override val isEnabled: Boolean = false
|
||||||
|
@@ -15,8 +15,8 @@ internal data class RawBusinessConnection(
|
|||||||
val userChatId: ChatId,
|
val userChatId: ChatId,
|
||||||
@SerialName(dateField)
|
@SerialName(dateField)
|
||||||
val date: TelegramDate,
|
val date: TelegramDate,
|
||||||
@SerialName(canReplyField)
|
@SerialName(rightsField)
|
||||||
val canReply: Boolean,
|
val rights: BusinessBotRights = BusinessBotRights(),
|
||||||
@SerialName(isEnabledField)
|
@SerialName(isEnabledField)
|
||||||
val isEnabled: Boolean
|
val isEnabled: Boolean
|
||||||
) {
|
) {
|
||||||
@@ -27,14 +27,14 @@ internal data class RawBusinessConnection(
|
|||||||
user = user,
|
user = user,
|
||||||
userChatId = userChatId,
|
userChatId = userChatId,
|
||||||
date = date,
|
date = date,
|
||||||
canReply = canReply
|
rights = rights
|
||||||
)
|
)
|
||||||
false -> BusinessConnection.Disabled(
|
false -> BusinessConnection.Disabled(
|
||||||
id = id,
|
id = id,
|
||||||
user = user,
|
user = user,
|
||||||
userChatId = userChatId,
|
userChatId = userChatId,
|
||||||
date = date,
|
date = date,
|
||||||
canReply = canReply
|
rights = rights
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ internal data class RawBusinessConnection(
|
|||||||
user = businessConnection.user,
|
user = businessConnection.user,
|
||||||
userChatId = businessConnection.userChatId,
|
userChatId = businessConnection.userChatId,
|
||||||
date = businessConnection.date,
|
date = businessConnection.date,
|
||||||
canReply = businessConnection.canReply,
|
rights = businessConnection.rights,
|
||||||
isEnabled = businessConnection.isEnabled,
|
isEnabled = businessConnection.isEnabled,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user