From 8f2843cbfab958bb06f96a801325b36ccc8e61ad Mon Sep 17 00:00:00 2001 From: Him188 Date: Sat, 28 Mar 2020 14:16:39 +0800 Subject: [PATCH] Handle mute result as an IllegalStateException --- .../net/mamoe/mirai/qqandroid/contact/GroupImpl.kt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/contact/GroupImpl.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/contact/GroupImpl.kt index 00e838145..730919295 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/contact/GroupImpl.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/contact/GroupImpl.kt @@ -288,9 +288,12 @@ internal class GroupImpl( source = it source.startWaitingSequenceId(this) }.sendAndExpect() - check( - response is MessageSvc.PbSendMsg.Response.SUCCESS - ) { "send message failed: $response" } + if (response is MessageSvc.PbSendMsg.Response.Failed) { + when (response.errorCode) { + 120 -> error("bot is being muted.") + else -> error("send message failed: $response") + } + } } return MessageReceipt(source, this, botAsMember)