From d5868ed7c1eb4b12b27f6ac67d7b81124d9d8936 Mon Sep 17 00:00:00 2001 From: Him188 Date: Thu, 2 Apr 2020 18:28:19 +0800 Subject: [PATCH] Add `MessageTooLargeException` to differentiate with mute exception --- .../mirai/qqandroid/contact/GroupImpl.kt | 14 ++++++-- .../qqandroid/network/QQAndroidClient.kt | 12 ++----- .../net/mamoe/mirai/qqandroid/utils/type.kt | 3 ++ .../kotlin/net/mamoe/mirai/contact/Contact.kt | 3 +- .../mirai/contact/ContactJavaFriendlyAPI.kt | 4 ++- .../kotlin/net/mamoe/mirai/contact/Group.kt | 3 +- .../kotlin/net/mamoe/mirai/contact/Member.kt | 3 +- .../kotlin/net/mamoe/mirai/contact/QQ.kt | 3 +- .../kotlin/net.mamoe.mirai/contact/Contact.kt | 3 +- .../kotlin/net.mamoe.mirai/contact/Group.kt | 3 +- .../kotlin/net.mamoe.mirai/contact/Member.kt | 3 +- .../contact/MessageTooLargeException.kt | 32 +++++++++++++++++++ .../kotlin/net.mamoe.mirai/contact/QQ.kt | 3 +- .../kotlin/net/mamoe/mirai/contact/Contact.kt | 3 +- .../mirai/contact/ContactJavaFriendlyAPI.kt | 3 +- .../kotlin/net/mamoe/mirai/contact/Group.kt | 3 +- .../kotlin/net/mamoe/mirai/contact/Member.kt | 3 +- .../kotlin/net/mamoe/mirai/contact/QQ.kt | 3 +- 18 files changed, 78 insertions(+), 26 deletions(-) create mode 100644 mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/MessageTooLargeException.kt 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 7653f3e24..ccd07f151 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 @@ -285,8 +285,18 @@ internal class GroupImpl( throw EventCancelledException("cancelled by GroupMessageSendEvent") } - val length = event.message.estimateLength(4501) - check(length <= 4500 && event.message.count { it is Image } <= 50) { "message is too large. Allow up to 4500 chars or 50 images" } + val length = event.message.estimateLength(5001) + if (!(length <= 5000 && event.message.count { it is Image } <= 50)) { + throw MessageTooLargeException( + this, + message, + event.message, + "message(${event.message.joinToString( + "", + limit = 10 + )}) is too large. Allow up to 5000 in weight (Chinese char=4, English char=1, Quote=700, Image=800, others are estimated in String length.)" + ) + } if (length >= 800) { return bot._lowLevelSendLongGroupMessage(this.id, event.message) } diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidClient.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidClient.kt index 07507ca41..88a7e7221 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidClient.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidClient.kt @@ -14,7 +14,6 @@ package net.mamoe.mirai.qqandroid.network import kotlinx.atomicfu.AtomicInt import kotlinx.atomicfu.atomic import kotlinx.io.core.* -import net.mamoe.mirai.BotAccount import net.mamoe.mirai.RawAccountIdUse import net.mamoe.mirai.data.OnlineStatus import net.mamoe.mirai.qqandroid.QQAndroidBot @@ -22,12 +21,8 @@ import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY import net.mamoe.mirai.qqandroid.network.protocol.packet.PacketLogger import net.mamoe.mirai.qqandroid.network.protocol.packet.Tlv import net.mamoe.mirai.qqandroid.utils.* -import net.mamoe.mirai.qqandroid.utils.MiraiPlatformUtils -import net.mamoe.mirai.qqandroid.utils.NetworkType import net.mamoe.mirai.qqandroid.utils.cryptor.ECDH import net.mamoe.mirai.qqandroid.utils.cryptor.TEA -import net.mamoe.mirai.qqandroid.utils.read -import net.mamoe.mirai.qqandroid.utils.toUHexString import net.mamoe.mirai.utils.* import kotlin.random.Random import kotlin.random.nextInt @@ -63,10 +58,7 @@ internal fun getRandomByteArray(length: Int): ByteArray = ByteArray(length) { Ra @PublishedApi internal open class QQAndroidClient( context: Context, - @MiraiInternalAPI("Be careful. Do not use the id in BotAccount. use client.uin instead") - val account: BotAccount, - - + val id: Long, val ecdh: ECDH = ECDH(), val device: DeviceInfo = SystemDeviceInfo(context), bot: QQAndroidBot @@ -97,7 +89,7 @@ internal open class QQAndroidClient( } override fun toString(): String { // extremely slow - return "QQAndroidClient(account=$account, ecdh=$ecdh, device=$device, tgtgtKey=${tgtgtKey.toUHexString()}, randomKey=${randomKey.toUHexString()}, miscBitMap=$miscBitMap, mainSigMap=$mainSigMap, subSigMap=$subSigMap, openAppId=$openAppId, apkVersionName=${apkVersionName.toUHexString()}, loginState=$loginState, appClientVersion=$appClientVersion, networkType=$networkType, apkSignatureMd5=${apkSignatureMd5.toUHexString()}, protocolVersion=$protocolVersion, apkId=${apkId.toUHexString()}, t150=${t150?.value?.toUHexString()}, rollbackSig=${rollbackSig?.toUHexString()}, ipFromT149=${ipFromT149?.toUHexString()}, timeDifference=$timeDifference, uin=$uin, t530=${t530?.toUHexString()}, t528=${t528?.toUHexString()}, ksid='$ksid', pwdFlag=$pwdFlag, loginExtraData=$loginExtraData, wFastLoginInfo=$wFastLoginInfo, reserveUinInfo=$reserveUinInfo, wLoginSigInfo=$wLoginSigInfo, tlv113=${tlv113?.toUHexString()}, qrPushSig=${qrPushSig.toUHexString()}, mainDisplayName='$mainDisplayName')" + return "QQAndroidClient(id=$id, ecdh=$ecdh, device=$device, tgtgtKey=${tgtgtKey.toUHexString()}, randomKey=${randomKey.toUHexString()}, miscBitMap=$miscBitMap, mainSigMap=$mainSigMap, subSigMap=$subSigMap, openAppId=$openAppId, apkVersionName=${apkVersionName.toUHexString()}, loginState=$loginState, appClientVersion=$appClientVersion, networkType=$networkType, apkSignatureMd5=${apkSignatureMd5.toUHexString()}, protocolVersion=$protocolVersion, apkId=${apkId.toUHexString()}, t150=${t150?.value?.toUHexString()}, rollbackSig=${rollbackSig?.toUHexString()}, ipFromT149=${ipFromT149?.toUHexString()}, timeDifference=$timeDifference, uin=$uin, t530=${t530?.toUHexString()}, t528=${t528?.toUHexString()}, ksid='$ksid', pwdFlag=$pwdFlag, loginExtraData=$loginExtraData, wFastLoginInfo=$wFastLoginInfo, reserveUinInfo=$reserveUinInfo, wLoginSigInfo=$wLoginSigInfo, tlv113=${tlv113?.toUHexString()}, qrPushSig=${qrPushSig.toUHexString()}, mainDisplayName='$mainDisplayName')" } var onlineStatus: OnlineStatus = OnlineStatus.ONLINE 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 d4b02b9e6..23df48254 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 @@ -13,6 +13,7 @@ package net.mamoe.mirai.qqandroid.utils import net.mamoe.mirai.message.data.* +import net.mamoe.mirai.message.data.AtAll.display import kotlin.jvm.JvmMultifileClass import kotlin.jvm.JvmName @@ -48,6 +49,8 @@ internal fun SingleMessage.estimateLength(upTo: Int = Int.MAX_VALUE): Int { } is Image -> 300 is PlainText -> stringValue.chineseLength(upTo) + is At -> display.chineseLength(upTo) + is AtAll -> display.chineseLength(upTo) else -> this.toString().chineseLength(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 671fb63e8..0ae762cfb 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 @@ -59,8 +59,9 @@ actual abstract class Contact : CoroutineScope, ContactJavaFriendlyAPI() { * @see FriendMessageSendEvent 发送好友信息事件, cancellable * @see GroupMessageSendEvent 发送群消息事件. cancellable * - * @throws EventCancelledException 当发送消息事件被取消 + * @throws EventCancelledException 当发送消息事件被取消时抛出 * @throws IllegalStateException 发送群消息时若 [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 98cca8d5b..e3013551f 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 @@ -53,8 +53,10 @@ actual abstract class ContactJavaFriendlyAPI { * @see FriendMessageSendEvent 发送好友信息事件, cancellable * @see GroupMessageSendEvent 发送群消息事件. cancellable * - * @throws EventCancelledException 当发送消息事件被取消 + * @throws EventCancelledException 当发送消息事件被取消时抛出 * @throws IllegalStateException 发送群消息时若 [Bot] 被禁言抛出 + * @throws MessageTooLargeException 当消息过长时抛出 * @throws MessageTooLargeException 当消息过长时抛出 + * * @return 消息回执. 可 [引用回复][MessageReceipt.quote](仅群聊)或 [撤回][MessageReceipt.recall] 这条消息. */ 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 ced5c31ea..9cf8c5fa0 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 @@ -130,8 +130,9 @@ actual abstract class Group : Contact(), CoroutineScope { * @see FriendMessageSendEvent 发送好友信息事件, cancellable * @see GroupMessageSendEvent 发送群消息事件. cancellable * - * @throws EventCancelledException 当发送消息事件被取消 + * @throws EventCancelledException 当发送消息事件被取消时抛出 * @throws IllegalStateException 发送群消息时若 [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 2f490a8f5..6ea2a4df4 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 @@ -115,8 +115,9 @@ actual abstract class Member : MemberJavaFriendlyAPI() { * @see FriendMessageSendEvent 发送好友信息事件, cancellable * @see GroupMessageSendEvent 发送群消息事件. cancellable * - * @throws EventCancelledException 当发送消息事件被取消 + * @throws EventCancelledException 当发送消息事件被取消时抛出 * @throws IllegalStateException 发送群消息时若 [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 034bd8415..715b796ef 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 @@ -83,8 +83,9 @@ actual abstract class QQ : Contact(), CoroutineScope { * @see FriendMessageSendEvent 发送好友信息事件, cancellable * @see GroupMessageSendEvent 发送群消息事件. cancellable * - * @throws EventCancelledException 当发送消息事件被取消 + * @throws EventCancelledException 当发送消息事件被取消时抛出 * @throws IllegalStateException 发送群消息时若 [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 d3f70bf09..c58759669 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 @@ -62,8 +62,9 @@ expect abstract class Contact() : CoroutineScope, ContactJavaFriendlyAPI { * @see FriendMessageSendEvent 发送好友信息事件, cancellable * @see GroupMessageSendEvent 发送群消息事件. cancellable * - * @throws EventCancelledException 当发送消息事件被取消 + * @throws EventCancelledException 当发送消息事件被取消时抛出 * @throws IllegalStateException 发送群消息时若 [Bot] 被禁言抛出 + * @throws MessageTooLargeException 当消息过长时抛出 * * @return 消息回执. 可 [引用回复][MessageReceipt.quote](仅群聊)或 [撤回][MessageReceipt.recall] 这条消息. */ 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 0af8c2001..981a3ebc9 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 @@ -134,8 +134,9 @@ expect abstract class Group() : Contact, CoroutineScope { * @see FriendMessageSendEvent 发送好友信息事件, cancellable * @see GroupMessageSendEvent 发送群消息事件. cancellable * - * @throws EventCancelledException 当发送消息事件被取消 + * @throws EventCancelledException 当发送消息事件被取消时抛出 * @throws IllegalStateException 发送群消息时若 [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 60f4ce045..ec35130e8 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 @@ -137,8 +137,9 @@ expect abstract class Member() : MemberJavaFriendlyAPI { * @see MessageSendEvent.FriendMessageSendEvent 发送好友信息事件, cancellable * @see MessageSendEvent.GroupMessageSendEvent 发送群消息事件. cancellable * - * @throws EventCancelledException 当发送消息事件被取消 + * @throws EventCancelledException 当发送消息事件被取消时抛出 * @throws IllegalStateException 发送群消息时若 [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 new file mode 100644 index 000000000..779c47c47 --- /dev/null +++ b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/MessageTooLargeException.kt @@ -0,0 +1,32 @@ +/* + * Copyright 2020 Mamoe Technologies and contributors. + * + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + +@file:Suppress("unused") + +package net.mamoe.mirai.contact + +import net.mamoe.mirai.message.data.Message +import net.mamoe.mirai.utils.SinceMirai + +/** + * 发送消息时消息过长抛出的异常. + */ +@SinceMirai("0.32.0") +class MessageTooLargeException( + val target: Contact, + /** + * 原发送消息 + */ + val originalMessage: Message, + /** + * 经过事件拦截处理后的消息 + */ + val messageAfterEvent: Message, + exceptionMessage: String +) : RuntimeException(exceptionMessage) \ 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 1e3433e19..41ed14cb0 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 @@ -92,8 +92,9 @@ expect abstract class QQ() : Contact, CoroutineScope { * @see FriendMessageSendEvent 发送好友信息事件, cancellable * @see GroupMessageSendEvent 发送群消息事件. cancellable * - * @throws EventCancelledException 当发送消息事件被取消 + * @throws EventCancelledException 当发送消息事件被取消时抛出 * @throws IllegalStateException 发送群消息时若 [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 627acd8ed..f6b031285 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 @@ -58,8 +58,9 @@ actual abstract class Contact : CoroutineScope, ContactJavaFriendlyAPI() { * @see FriendMessageSendEvent 发送好友信息事件, cancellable * @see GroupMessageSendEvent 发送群消息事件. cancellable * - * @throws EventCancelledException 当发送消息事件被取消 + * @throws EventCancelledException 当发送消息事件被取消时抛出 * @throws IllegalStateException 发送群消息时若 [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 1341e20ab..faf49d401 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 @@ -53,8 +53,9 @@ actual abstract class ContactJavaFriendlyAPI { * @see FriendMessageSendEvent 发送好友信息事件, cancellable * @see GroupMessageSendEvent 发送群消息事件. cancellable * - * @throws EventCancelledException 当发送消息事件被取消 + * @throws EventCancelledException 当发送消息事件被取消时抛出 * @throws IllegalStateException 发送群消息时若 [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 1ae3c798e..53448c7dd 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 @@ -132,8 +132,9 @@ actual abstract class Group : Contact(), CoroutineScope { * @see FriendMessageSendEvent 发送好友信息事件, cancellable * @see GroupMessageSendEvent 发送群消息事件. cancellable * - * @throws EventCancelledException 当发送消息事件被取消 + * @throws EventCancelledException 当发送消息事件被取消时抛出 * @throws IllegalStateException 发送群消息时若 [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 abd3d9249..8058d636e 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 @@ -123,8 +123,9 @@ actual abstract class Member : MemberJavaFriendlyAPI() { * @see FriendMessageSendEvent 发送好友信息事件, cancellable * @see GroupMessageSendEvent 发送群消息事件. cancellable * - * @throws EventCancelledException 当发送消息事件被取消 + * @throws EventCancelledException 当发送消息事件被取消时抛出 * @throws IllegalStateException 发送群消息时若 [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 034bd8415..715b796ef 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 @@ -83,8 +83,9 @@ actual abstract class QQ : Contact(), CoroutineScope { * @see FriendMessageSendEvent 发送好友信息事件, cancellable * @see GroupMessageSendEvent 发送群消息事件. cancellable * - * @throws EventCancelledException 当发送消息事件被取消 + * @throws EventCancelledException 当发送消息事件被取消时抛出 * @throws IllegalStateException 发送群消息时若 [Bot] 被禁言抛出 + * @throws MessageTooLargeException 当消息过长时抛出 * * @return 消息回执. 可进行撤回 ([MessageReceipt.recall]) */