From 3cc5cbfcfdd58490766ecc1e8afd224a48065970 Mon Sep 17 00:00:00 2001 From: Him188 Date: Sat, 4 Apr 2020 14:17:32 +0800 Subject: [PATCH] Introduce `BotIsBeingMutedException` to replace `IllegalStateException` --- .../mirai/qqandroid/contact/GroupImpl.kt | 6 +- .../qqandroid/message/MessageSourceImpl.kt | 4 +- .../net/mamoe/mirai/qqandroid/utils/type.kt | 2 +- .../kotlin/net/mamoe/mirai/contact/Contact.kt | 2 +- .../mirai/contact/ContactJavaFriendlyAPI.kt | 2 +- .../kotlin/net/mamoe/mirai/contact/Group.kt | 2 +- .../kotlin/net/mamoe/mirai/contact/Member.kt | 2 +- .../kotlin/net/mamoe/mirai/contact/QQ.kt | 2 +- .../kotlin/net.mamoe.mirai/contact/Contact.kt | 2 +- .../net.mamoe.mirai/contact/ContactList.kt | 103 +++++++++++------- .../kotlin/net.mamoe.mirai/contact/Group.kt | 2 +- .../kotlin/net.mamoe.mirai/contact/Member.kt | 2 +- .../contact/MessageTooLargeException.kt | 19 +++- .../kotlin/net.mamoe.mirai/contact/QQ.kt | 2 +- .../kotlin/net/mamoe/mirai/contact/Contact.kt | 2 +- .../mirai/contact/ContactJavaFriendlyAPI.kt | 2 +- .../kotlin/net/mamoe/mirai/contact/Group.kt | 2 +- .../kotlin/net/mamoe/mirai/contact/Member.kt | 2 +- .../kotlin/net/mamoe/mirai/contact/QQ.kt | 2 +- 19 files changed, 101 insertions(+), 61 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 ec0e34c10..01471c28e 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 @@ -259,16 +259,16 @@ internal class GroupImpl( override operator fun get(id: Long): Member { - return members.delegate.firstOrNull { it.id == id } + return members.firstOrNull { it.id == id } ?: throw NoSuchElementException("member $id not found in group $uin") } override fun contains(id: Long): Boolean { - return members.delegate.firstOrNull { it.id == id } != null + return members.firstOrNull { it.id == id } != null } override fun getOrNull(id: Long): Member? { - return members.delegate.firstOrNull { it.id == id } + return members.firstOrNull { it.id == id } } @OptIn(MiraiExperimentalAPI::class, LowLevelAPI::class) diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/message/MessageSourceImpl.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/message/MessageSourceImpl.kt index 8633a5ab9..853ba61ef 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/message/MessageSourceImpl.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/message/MessageSourceImpl.kt @@ -81,7 +81,7 @@ internal class MessageSourceFromMsg( } else toJceDataImplForGroup() } - val elems by lazy { + private val elems by lazy { delegate.msgBody.richText.elems.toMutableList().also { if (it.last().elemFlags2 == null) it.add(ImMsgBody.Elem(elemFlags2 = ImMsgBody.ElemFlags2())) } @@ -256,7 +256,7 @@ internal class MessageSourceFromSendGroup( override val groupId: Long, override val originalMessage: MessageChain ) : MessageSourceFromSend() { - internal lateinit var sequenceIdDeferred: Deferred + private lateinit var sequenceIdDeferred: Deferred @OptIn(ExperimentalCoroutinesApi::class) override val id: Long diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/type.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/type.kt index 854f69944..64ef2a90f 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/type.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/type.kt @@ -67,7 +67,7 @@ internal inline fun Iterable.sumUpTo(upTo: Int, selector: (T, remaining: } internal inline fun CharSequence.sumUpTo(upTo: Int, selector: (Char) -> Int): Int { - var sum: Int = 0 + var sum = 0 for (element in this) { sum += selector(element) if (sum >= upTo) { diff --git a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/contact/Contact.kt b/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/contact/Contact.kt index 6d90c9ec0..59e50f821 100644 --- a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/contact/Contact.kt +++ b/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/contact/Contact.kt @@ -60,7 +60,7 @@ actual abstract class Contact : CoroutineScope, ContactJavaFriendlyAPI() { * @see GroupMessageSendEvent 发送群消息事件. cancellable * * @throws EventCancelledException 当发送消息事件被取消时抛出 - * @throws IllegalStateException 发送群消息时若 [Bot] 被禁言抛出 + * @throws BotIsBeingMutedException 发送群消息时若 [Bot] 被禁言抛出 * @throws MessageTooLargeException 当消息过长时抛出 * * @return 消息回执. 可 [引用回复][MessageReceipt.quote](仅群聊)或 [撤回][MessageReceipt.recall] 这条消息. diff --git a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/contact/ContactJavaFriendlyAPI.kt b/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/contact/ContactJavaFriendlyAPI.kt index d40cdca5f..89932d07a 100644 --- a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/contact/ContactJavaFriendlyAPI.kt +++ b/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/contact/ContactJavaFriendlyAPI.kt @@ -54,7 +54,7 @@ actual abstract class ContactJavaFriendlyAPI { * @see GroupMessageSendEvent 发送群消息事件. cancellable * * @throws EventCancelledException 当发送消息事件被取消时抛出 - * @throws IllegalStateException 发送群消息时若 [Bot] 被禁言抛出 + * @throws BotIsBeingMutedException 发送群消息时若 [Bot] 被禁言抛出 * @throws MessageTooLargeException 当消息过长时抛出 * @throws MessageTooLargeException 当消息过长时抛出 * diff --git a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/contact/Group.kt b/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/contact/Group.kt index 9cf8c5fa0..92014d246 100644 --- a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/contact/Group.kt +++ b/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/contact/Group.kt @@ -131,7 +131,7 @@ actual abstract class Group : Contact(), CoroutineScope { * @see GroupMessageSendEvent 发送群消息事件. cancellable * * @throws EventCancelledException 当发送消息事件被取消时抛出 - * @throws IllegalStateException 发送群消息时若 [Bot] 被禁言抛出 + * @throws BotIsBeingMutedException 发送群消息时若 [Bot] 被禁言抛出 * @throws MessageTooLargeException 当消息过长时抛出 * * @return 消息回执. 可进行撤回 ([MessageReceipt.recall]) diff --git a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/contact/Member.kt b/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/contact/Member.kt index 6ea2a4df4..2dcc96814 100644 --- a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/contact/Member.kt +++ b/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/contact/Member.kt @@ -116,7 +116,7 @@ actual abstract class Member : MemberJavaFriendlyAPI() { * @see GroupMessageSendEvent 发送群消息事件. cancellable * * @throws EventCancelledException 当发送消息事件被取消时抛出 - * @throws IllegalStateException 发送群消息时若 [Bot] 被禁言抛出 + * @throws BotIsBeingMutedException 发送群消息时若 [Bot] 被禁言抛出 * @throws MessageTooLargeException 当消息过长时抛出 * * @return 消息回执. 可进行撤回 ([MessageReceipt.recall]) diff --git a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/contact/QQ.kt b/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/contact/QQ.kt index 1afef7346..093040808 100644 --- a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/contact/QQ.kt +++ b/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/contact/QQ.kt @@ -84,7 +84,7 @@ actual abstract class QQ : Contact(), CoroutineScope { * @see GroupMessageSendEvent 发送群消息事件. cancellable * * @throws EventCancelledException 当发送消息事件被取消时抛出 - * @throws IllegalStateException 发送群消息时若 [Bot] 被禁言抛出 + * @throws BotIsBeingMutedException 发送群消息时若 [Bot] 被禁言抛出 * @throws MessageTooLargeException 当消息过长时抛出 * * @return 消息回执. 可进行撤回 ([MessageReceipt.recall]) diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Contact.kt b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Contact.kt index 2145342f6..5984d9efd 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Contact.kt +++ b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Contact.kt @@ -63,7 +63,7 @@ expect abstract class Contact() : CoroutineScope, ContactJavaFriendlyAPI { * @see GroupMessageSendEvent 发送群消息事件. cancellable * * @throws EventCancelledException 当发送消息事件被取消时抛出 - * @throws IllegalStateException 发送群消息时若 [Bot] 被禁言抛出 + * @throws BotIsBeingMutedException 发送群消息时若 [Bot] 被禁言抛出 * @throws MessageTooLargeException 当消息过长时抛出 * * @return 消息回执. 可 [引用回复][MessageReceipt.quote](仅群聊)或 [撤回][MessageReceipt.recall] 这条消息. diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/ContactList.kt b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/ContactList.kt index 64b7e8848..eac89ee2b 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/ContactList.kt +++ b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/ContactList.kt @@ -7,11 +7,12 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -@file:Suppress("EXPERIMENTAL_API_USAGE") +@file:Suppress("EXPERIMENTAL_API_USAGE", "unused") package net.mamoe.mirai.contact import net.mamoe.mirai.utils.* +import kotlin.jvm.JvmName /** @@ -21,17 +22,8 @@ import net.mamoe.mirai.utils.* */ @OptIn(MiraiInternalAPI::class) @Suppress("unused") -class ContactList(@MiraiInternalAPI val delegate: LockFreeLinkedList) { - /** - * ID 列表的字符串表示. - * 如: - * ``` - * [123456, 321654, 123654] - * ``` - */ - val idContentString: String get() = "[" + buildString { delegate.forEach { append(it.id).append(", ") } }.dropLast(2) + "]" - - operator fun get(id: Long): C = delegate[id] +class ContactList(@MiraiInternalAPI val delegate: LockFreeLinkedList) : Iterable { + operator fun get(id: Long): C = delegate.asSequence().first { it.id == id } fun getOrNull(id: Long): C? = delegate.getOrNull(id) val size: Int get() = delegate.size @@ -39,21 +31,53 @@ class ContactList(@MiraiInternalAPI val delegate: LockFreeLinkedLis operator fun contains(id: Long): Boolean = delegate.getOrNull(id) != null fun containsAll(elements: Collection): Boolean = elements.all { contains(it) } fun isEmpty(): Boolean = delegate.isEmpty() + + override fun toString(): String = + delegate.asSequence().joinToString(separator = ", ", prefix = "ContactList(", postfix = ")") + + override fun iterator(): Iterator { + return this.delegate.asSequence().iterator() + } + + @PlannedRemoval("1.0.0") + @Suppress("PropertyName") + @get:JvmName("getIdContentString") + @Deprecated("for binary compatibility", level = DeprecationLevel.HIDDEN) + val _idContentString: String + get() = this.idContentString + + @PlannedRemoval("1.0.0") + @Deprecated("for binary compatibility", level = DeprecationLevel.HIDDEN) inline fun forEach(block: (C) -> Unit) = delegate.forEach(block) + + @PlannedRemoval("1.0.0") + @Deprecated("for binary compatibility", level = DeprecationLevel.HIDDEN) fun first(): C { forEach { return it } throw NoSuchElementException() } + @PlannedRemoval("1.0.0") + @Deprecated("for binary compatibility", level = DeprecationLevel.HIDDEN) fun firstOrNull(): C? { forEach { return it } return null } - - override fun toString(): String = - delegate.asSequence().joinToString(separator = ", ", prefix = "ContactList(", postfix = ")") } +/** + * ID 列表的字符串表示. + * 如: + * ``` + * [123456, 321654, 123654] + * ``` + */ +val ContactList<*>.idContentString: String + get() = "[" + @OptIn(MiraiInternalAPI::class) buildString { delegate.forEach { append(it.id).append(", ") } }.dropLast( + 2 + ) + "]" + + operator fun LockFreeLinkedList.get(id: Long): C { forEach { if (it.id == id) return it } throw NoSuchElementException("No such contact: $id") @@ -64,46 +88,45 @@ fun LockFreeLinkedList.getOrNull(id: Long): C? { return null } +@PlannedRemoval("1.0.0") +@Deprecated( + "use firstOrNull from stdlib", + replaceWith = ReplaceWith("this.asSequence().firstOrNull(filter)"), + level = DeprecationLevel.ERROR +) inline fun LockFreeLinkedList.firstOrNull(filter: (C) -> Boolean): C? { forEach { if (filter(it)) return it } return null } @PlannedRemoval("1.0.0") -@Deprecated("use firstOrNull", replaceWith = ReplaceWith("firstOrNull(filter)"), level = DeprecationLevel.ERROR) -inline fun LockFreeLinkedList.filteringGetOrNull(filter: (C) -> Boolean): C? { - return this.firstOrNull(filter) -} +@Deprecated( + "use firstOrNull from stdlib", + replaceWith = ReplaceWith("firstOrNull(filter)"), + level = DeprecationLevel.ERROR +) +inline fun LockFreeLinkedList.filteringGetOrNull(filter: (C) -> Boolean): C? = + this.asSequence().firstOrNull(filter) - -/** - * Collect all the elements into a [MutableList] then cast it as a [List] - */ +@PlannedRemoval("1.0.0") +@Deprecated("use Iterator.toList from stdlib", level = DeprecationLevel.HIDDEN) fun ContactList.toList(): List = toMutableList() -/** - * Collect all the elements into a [MutableList]. - */ +@PlannedRemoval("1.0.0") +@Deprecated("use Iterator.toMutableList from stdlib", level = DeprecationLevel.HIDDEN) @OptIn(MiraiInternalAPI::class) fun ContactList.toMutableList(): MutableList = this.delegate.toMutableList() -/** - * Collect all the elements into a [MutableSet] then cast it as a [Set] - */ +@PlannedRemoval("1.0.0") +@Deprecated("use Iterator.toSet from stdlib", level = DeprecationLevel.HIDDEN) fun ContactList.toSet(): Set = toMutableSet() -/** - * Collect all the elements into a [MutableSet]. - */ +@PlannedRemoval("1.0.0") +@Deprecated("use Iterator.toMutableSet from stdlib", level = DeprecationLevel.HIDDEN) @OptIn(MiraiInternalAPI::class) fun ContactList.toMutableSet(): MutableSet = this.delegate.toMutableSet() -/** - * Builds a [Sequence] containing all the elements in [this] in the same order. - * - * Note that the sequence is dynamic, that is, elements are yielded atomically only when it is required - */ +@PlannedRemoval("1.0.0") +@Deprecated("use Iterator.asSequence from stdlib", level = DeprecationLevel.HIDDEN) @OptIn(MiraiInternalAPI::class) -fun ContactList.asSequence(): Sequence { - return this.delegate.asSequence() -} \ No newline at end of file +fun ContactList.asSequence(): Sequence = this.delegate.asSequence() \ No newline at end of file diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Group.kt b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Group.kt index 981a3ebc9..02ce75ca4 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Group.kt +++ b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Group.kt @@ -135,7 +135,7 @@ expect abstract class Group() : Contact, CoroutineScope { * @see GroupMessageSendEvent 发送群消息事件. cancellable * * @throws EventCancelledException 当发送消息事件被取消时抛出 - * @throws IllegalStateException 发送群消息时若 [Bot] 被禁言抛出 + * @throws BotIsBeingMutedException 发送群消息时若 [Bot] 被禁言抛出 * @throws MessageTooLargeException 当消息过长时抛出 * * @return 消息回执. 可进行撤回 ([MessageReceipt.recall]) diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Member.kt b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Member.kt index ec35130e8..a6e5ada81 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Member.kt +++ b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Member.kt @@ -138,7 +138,7 @@ expect abstract class Member() : MemberJavaFriendlyAPI { * @see MessageSendEvent.GroupMessageSendEvent 发送群消息事件. cancellable * * @throws EventCancelledException 当发送消息事件被取消时抛出 - * @throws IllegalStateException 发送群消息时若 [Bot] 被禁言抛出 + * @throws BotIsBeingMutedException 发送群消息时若 [Bot] 被禁言抛出 * @throws MessageTooLargeException 当消息过长时抛出 * * @return 消息回执. 可进行撤回 ([MessageReceipt.recall]) diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/MessageTooLargeException.kt b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/MessageTooLargeException.kt index 779c47c47..ce789df3e 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/MessageTooLargeException.kt +++ b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/MessageTooLargeException.kt @@ -16,6 +16,8 @@ import net.mamoe.mirai.utils.SinceMirai /** * 发送消息时消息过长抛出的异常. + * + * @see Contact.sendMessage */ @SinceMirai("0.32.0") class MessageTooLargeException( @@ -29,4 +31,19 @@ class MessageTooLargeException( */ val messageAfterEvent: Message, exceptionMessage: String -) : RuntimeException(exceptionMessage) \ No newline at end of file +) : RuntimeException(exceptionMessage) + +/** + * 发送消息时 bot 正处于被禁言状态时抛出的异常. + * + * @see Group.sendMessage + */ +@SinceMirai("0.33.0") +class BotIsBeingMutedException( + val target: Group, + /** + * 被禁言剩余时间 + * @see Group.botMuteRemaining + */ + val remainingMillis: Int +) : RuntimeException() \ No newline at end of file diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/QQ.kt b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/QQ.kt index 2cdaa8b28..c54ad63fb 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/QQ.kt +++ b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/QQ.kt @@ -93,7 +93,7 @@ expect abstract class QQ() : Contact, CoroutineScope { * @see GroupMessageSendEvent 发送群消息事件. cancellable * * @throws EventCancelledException 当发送消息事件被取消时抛出 - * @throws IllegalStateException 发送群消息时若 [Bot] 被禁言抛出 + * @throws BotIsBeingMutedException 发送群消息时若 [Bot] 被禁言抛出 * @throws MessageTooLargeException 当消息过长时抛出 * * @return 消息回执. 可进行撤回 ([MessageReceipt.recall]) diff --git a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/contact/Contact.kt b/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/contact/Contact.kt index a2d957a78..ac8c61799 100644 --- a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/contact/Contact.kt +++ b/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/contact/Contact.kt @@ -59,7 +59,7 @@ actual abstract class Contact : CoroutineScope, ContactJavaFriendlyAPI() { * @see GroupMessageSendEvent 发送群消息事件. cancellable * * @throws EventCancelledException 当发送消息事件被取消时抛出 - * @throws IllegalStateException 发送群消息时若 [Bot] 被禁言抛出 + * @throws BotIsBeingMutedException 发送群消息时若 [Bot] 被禁言抛出 * @throws MessageTooLargeException 当消息过长时抛出 * * @return 消息回执. 可 [引用回复][MessageReceipt.quote](仅群聊)或 [撤回][MessageReceipt.recall] 这条消息. diff --git a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/contact/ContactJavaFriendlyAPI.kt b/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/contact/ContactJavaFriendlyAPI.kt index a53d6b976..8a79554dd 100644 --- a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/contact/ContactJavaFriendlyAPI.kt +++ b/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/contact/ContactJavaFriendlyAPI.kt @@ -54,7 +54,7 @@ actual abstract class ContactJavaFriendlyAPI { * @see GroupMessageSendEvent 发送群消息事件. cancellable * * @throws EventCancelledException 当发送消息事件被取消时抛出 - * @throws IllegalStateException 发送群消息时若 [Bot] 被禁言抛出 + * @throws BotIsBeingMutedException 发送群消息时若 [Bot] 被禁言抛出 * @throws MessageTooLargeException 当消息过长时抛出 * * @return 消息回执. 可 [引用回复][MessageReceipt.quote](仅群聊)或 [撤回][MessageReceipt.recall] 这条消息. diff --git a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/contact/Group.kt b/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/contact/Group.kt index 53448c7dd..434b4e6df 100644 --- a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/contact/Group.kt +++ b/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/contact/Group.kt @@ -133,7 +133,7 @@ actual abstract class Group : Contact(), CoroutineScope { * @see GroupMessageSendEvent 发送群消息事件. cancellable * * @throws EventCancelledException 当发送消息事件被取消时抛出 - * @throws IllegalStateException 发送群消息时若 [Bot] 被禁言抛出 + * @throws BotIsBeingMutedException 发送群消息时若 [Bot] 被禁言抛出 * @throws MessageTooLargeException 当消息过长时抛出 * * @return 消息回执. 可进行撤回 ([MessageReceipt.recall]) diff --git a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/contact/Member.kt b/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/contact/Member.kt index 8058d636e..8afbf1231 100644 --- a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/contact/Member.kt +++ b/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/contact/Member.kt @@ -124,7 +124,7 @@ actual abstract class Member : MemberJavaFriendlyAPI() { * @see GroupMessageSendEvent 发送群消息事件. cancellable * * @throws EventCancelledException 当发送消息事件被取消时抛出 - * @throws IllegalStateException 发送群消息时若 [Bot] 被禁言抛出 + * @throws BotIsBeingMutedException 发送群消息时若 [Bot] 被禁言抛出 * @throws MessageTooLargeException 当消息过长时抛出 * * @return 消息回执. 可进行撤回 ([MessageReceipt.recall]) diff --git a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/contact/QQ.kt b/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/contact/QQ.kt index 1afef7346..093040808 100644 --- a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/contact/QQ.kt +++ b/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/contact/QQ.kt @@ -84,7 +84,7 @@ actual abstract class QQ : Contact(), CoroutineScope { * @see GroupMessageSendEvent 发送群消息事件. cancellable * * @throws EventCancelledException 当发送消息事件被取消时抛出 - * @throws IllegalStateException 发送群消息时若 [Bot] 被禁言抛出 + * @throws BotIsBeingMutedException 发送群消息时若 [Bot] 被禁言抛出 * @throws MessageTooLargeException 当消息过长时抛出 * * @return 消息回执. 可进行撤回 ([MessageReceipt.recall])