mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-21 15:53:47 +00:00
CreatorChatMember implement AdministratorChatMember
This commit is contained in:
parent
116344c0a6
commit
a2d7033745
@ -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
|
||||
|
@ -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
|
||||
}
|
@ -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
|
@ -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
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ data class RawChatMember(
|
||||
val asChatMember: ChatMember by lazy {
|
||||
when (status) {
|
||||
"creator" -> CreatorChatMember(user)
|
||||
"administrator" -> AdministratorChatMember(
|
||||
"administrator" -> AdministratorChatMemberImpl(
|
||||
user,
|
||||
canBeEdited,
|
||||
canChangeInfo,
|
||||
|
Loading…
Reference in New Issue
Block a user