From 60e13e73e904b60ec06a11918d3dca962a518cd5 Mon Sep 17 00:00:00 2001 From: Him188 Date: Tue, 8 Sep 2020 17:24:02 +0800 Subject: [PATCH] Fix ExactMember, ExactTemp --- .../kotlin/net/mamoe/mirai/console/command/CommandSender.kt | 5 +++-- .../kotlin/net/mamoe/mirai/console/permission/Permissible.kt | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/command/CommandSender.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/command/CommandSender.kt index 2820a90da..af199bcb4 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/command/CommandSender.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/command/CommandSender.kt @@ -636,7 +636,7 @@ public open class MemberCommandSender internal constructor( public override fun toString(): String = "MemberCommandSender($user)" @ExperimentalPermission - public override val identifier: PermissibleIdentifier = AbstractPermissibleIdentifier.ExactMember(user.id, group.id) + public override val identifier: PermissibleIdentifier = AbstractPermissibleIdentifier.ExactMember(group.id, user.id) @JvmBlockingBridge public override suspend fun sendMessage(message: String): MessageReceipt = sendMessage(PlainText(message)) @@ -659,7 +659,8 @@ public open class TempCommandSender internal constructor( public override fun toString(): String = "TempCommandSender($user)" @ExperimentalPermission - override val identifier: PermissibleIdentifier = AbstractPermissibleIdentifier.ExactTemp(user.id) + public override val identifier: PermissibleIdentifier = + AbstractPermissibleIdentifier.ExactTemp(user.group.id, user.id) @JvmBlockingBridge public override suspend fun sendMessage(message: String): MessageReceipt = sendMessage(PlainText(message)) diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/permission/Permissible.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/permission/Permissible.kt index 30a5976a2..3b5c53b4e 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/permission/Permissible.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/permission/Permissible.kt @@ -71,8 +71,9 @@ public sealed class AbstractPermissibleIdentifier( public object AnyTemp : AbstractPermissibleIdentifier(AnyUser) public data class ExactTemp( + public val groupId: Long, public val id: Long - ) : AbstractPermissibleIdentifier(ExactUser(id)) + ) : AbstractPermissibleIdentifier(ExactUser(groupId)) // TODO: 2020/9/8 ExactMember ? public object AnyUser : AbstractPermissibleIdentifier(AnyContact) public data class ExactUser(