diff --git a/CHANGELOG b/CHANGELOG index b9ad38e912..4a4c2f58d8 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -35,3 +35,4 @@ * Change signature of `Update` * Now `Update` is untyped and data is `Any` * Media groups now are separated type of updates and you can subscribe on that receiving directly +* Now `AdministratorChatMember` is interface and `CreatorChatMember` implement it diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/AdministratorChatMember.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/AdministratorChatMember.kt index f9dd24f588..0f1ec8e402 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/AdministratorChatMember.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/AdministratorChatMember.kt @@ -1,16 +1,13 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember -import com.github.insanusmokrassar.TelegramBotAPI.types.User - -data class AdministratorChatMember( - override val user: User, - val canBeEdited: Boolean, - val canChangeInfo: Boolean, - val canPostMessages: Boolean, - val canEditMessages: Boolean, - val canRemoveMessages: Boolean, - val canInviteUsers: Boolean, - val canRestrictMembers: Boolean, - val canPinMessages: Boolean, +interface AdministratorChatMember : ChatMember { + val canBeEdited: Boolean + val canChangeInfo: Boolean + val canPostMessages: Boolean + val canEditMessages: Boolean + val canRemoveMessages: Boolean + val canInviteUsers: Boolean + val canRestrictMembers: Boolean + val canPinMessages: Boolean val canPromoteMembers: Boolean -) : ChatMember +} \ No newline at end of file diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/AdministratorChatMemberImpl.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/AdministratorChatMemberImpl.kt new file mode 100644 index 0000000000..dd0245717d --- /dev/null +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/AdministratorChatMemberImpl.kt @@ -0,0 +1,16 @@ +package com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember + +import com.github.insanusmokrassar.TelegramBotAPI.types.User + +data class AdministratorChatMemberImpl( + override val user: User, + override val canBeEdited: Boolean, + override val canChangeInfo: Boolean, + override val canPostMessages: Boolean, + override val canEditMessages: Boolean, + override val canRemoveMessages: Boolean, + override val canInviteUsers: Boolean, + override val canRestrictMembers: Boolean, + override val canPinMessages: Boolean, + override val canPromoteMembers: Boolean +) : AdministratorChatMember diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/CreatorChatMember.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/CreatorChatMember.kt index 1999680d49..c6507cdd2a 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/CreatorChatMember.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/CreatorChatMember.kt @@ -2,4 +2,14 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember import com.github.insanusmokrassar.TelegramBotAPI.types.User -data class CreatorChatMember(override val user: User) : ChatMember +data class CreatorChatMember(override val user: User) : AdministratorChatMember { + override val canBeEdited: Boolean = true + override val canChangeInfo: Boolean = true + override val canPostMessages: Boolean = true + override val canEditMessages: Boolean = true + override val canRemoveMessages: Boolean = true + override val canInviteUsers: Boolean = true + override val canRestrictMembers: Boolean = true + override val canPinMessages: Boolean = true + override val canPromoteMembers: Boolean = true +} diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/RawChatMember.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/RawChatMember.kt index f216b1fbe0..f64040c859 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/RawChatMember.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/RawChatMember.kt @@ -53,7 +53,7 @@ data class RawChatMember( val asChatMember: ChatMember by lazy { when (status) { "creator" -> CreatorChatMember(user) - "administrator" -> AdministratorChatMember( + "administrator" -> AdministratorChatMemberImpl( user, canBeEdited, canChangeInfo,