mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 08:13:47 +00:00
CreatorChatMember implement AdministratorChatMember
This commit is contained in:
parent
116344c0a6
commit
a2d7033745
@ -35,3 +35,4 @@
|
|||||||
* Change signature of `Update`
|
* Change signature of `Update`
|
||||||
* Now `Update` is untyped and data is `Any`
|
* Now `Update` is untyped and data is `Any`
|
||||||
* Media groups now are separated type of updates and you can subscribe on that receiving directly
|
* 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
|
package com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember
|
||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.User
|
interface AdministratorChatMember : ChatMember {
|
||||||
|
val canBeEdited: Boolean
|
||||||
data class AdministratorChatMember(
|
val canChangeInfo: Boolean
|
||||||
override val user: User,
|
val canPostMessages: Boolean
|
||||||
val canBeEdited: Boolean,
|
val canEditMessages: Boolean
|
||||||
val canChangeInfo: Boolean,
|
val canRemoveMessages: Boolean
|
||||||
val canPostMessages: Boolean,
|
val canInviteUsers: Boolean
|
||||||
val canEditMessages: Boolean,
|
val canRestrictMembers: Boolean
|
||||||
val canRemoveMessages: Boolean,
|
val canPinMessages: Boolean
|
||||||
val canInviteUsers: Boolean,
|
|
||||||
val canRestrictMembers: Boolean,
|
|
||||||
val canPinMessages: Boolean,
|
|
||||||
val canPromoteMembers: 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
|
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 {
|
val asChatMember: ChatMember by lazy {
|
||||||
when (status) {
|
when (status) {
|
||||||
"creator" -> CreatorChatMember(user)
|
"creator" -> CreatorChatMember(user)
|
||||||
"administrator" -> AdministratorChatMember(
|
"administrator" -> AdministratorChatMemberImpl(
|
||||||
user,
|
user,
|
||||||
canBeEdited,
|
canBeEdited,
|
||||||
canChangeInfo,
|
canChangeInfo,
|
||||||
|
Loading…
Reference in New Issue
Block a user