Skip to content

Commit 907bc6c

Browse files
committed
补充部分注释
1 parent 45e8954 commit 907bc6c

File tree

3 files changed

+28
-6
lines changed

3 files changed

+28
-6
lines changed

simbot-api/src/commonMain/kotlin/love/forte/simbot/ability/ReplySupport.kt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/*
2-
* Copyright (c) 2024. ForteScarlet.
2+
* Copyright (c) 2024-2025. ForteScarlet.
33
*
44
* Project https://github.com/simple-robot/simpler-robot
55
66
*
7-
* This file is part of the Simple Robot Library.
7+
* This file is part of the Simple Robot Library (Alias: simple-robot, simbot, etc.).
88
*
99
* This program is free software: you can redistribute it and/or modify
1010
* it under the terms of the GNU Lesser General Public License as published by
@@ -23,6 +23,7 @@
2323

2424
package love.forte.simbot.ability
2525

26+
import love.forte.simbot.event.InternalInterceptionException
2627
import love.forte.simbot.event.MessageEvent
2728
import love.forte.simbot.message.Message
2829
import love.forte.simbot.message.MessageContent
@@ -45,6 +46,8 @@ public interface ReplySupport {
4546
* 发送一段纯文本消息。
4647
*
4748
* @return 消息发送成功后的回执
49+
* @throws InternalInterceptionException 在拦截事件处理过程中产生的异常,
50+
* 每一个具体的异常都会被收集在 [InternalInterceptionException.suppressedExceptions] 中。
4851
* @throws Exception 可能产生任何异常
4952
*/
5053
public suspend fun reply(text: String): MessageReceipt
@@ -53,6 +56,8 @@ public interface ReplySupport {
5356
* 发送一个消息 [Message]。
5457
*
5558
* @return 消息发送成功后的回执
59+
* @throws InternalInterceptionException 在拦截事件处理过程中产生的异常,
60+
* 每一个具体的异常都会被收集在 [InternalInterceptionException.suppressedExceptions] 中。
5661
* @throws Exception 可能产生任何异常
5762
*/
5863
public suspend fun reply(message: Message): MessageReceipt
@@ -63,6 +68,8 @@ public interface ReplySupport {
6368
* 并在不支持的情况下降级为使用 [MessageContent.messages]。
6469
*
6570
* @return 消息发送成功后的回执
71+
* @throws InternalInterceptionException 在拦截事件处理过程中产生的异常,
72+
* 每一个具体的异常都会被收集在 [InternalInterceptionException.suppressedExceptions] 中。
6673
* @throws Exception 可能产生任何异常
6774
*/
6875
public suspend fun reply(messageContent: MessageContent): MessageReceipt

simbot-api/src/commonMain/kotlin/love/forte/simbot/ability/SendSupport.kt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/*
2-
* Copyright (c) 2024. ForteScarlet.
2+
* Copyright (c) 2024-2025. ForteScarlet.
33
*
44
* Project https://github.com/simple-robot/simpler-robot
55
66
*
7-
* This file is part of the Simple Robot Library.
7+
* This file is part of the Simple Robot Library (Alias: simple-robot, simbot, etc.).
88
*
99
* This program is free software: you can redistribute it and/or modify
1010
* it under the terms of the GNU Lesser General Public License as published by
@@ -25,6 +25,7 @@ package love.forte.simbot.ability
2525

2626
import love.forte.simbot.definition.Actor
2727
import love.forte.simbot.definition.Contact
28+
import love.forte.simbot.event.InternalInterceptionException
2829
import love.forte.simbot.message.Message
2930
import love.forte.simbot.message.MessageContent
3031
import love.forte.simbot.message.MessageReceipt
@@ -42,6 +43,8 @@ public interface SendSupport {
4243
* 发送一段纯文本消息。
4344
*
4445
* @return 消息发送成功后的回执
46+
* @throws InternalInterceptionException 在拦截事件处理过程中产生的异常,
47+
* 每一个具体的异常都会被收集在 [InternalInterceptionException.suppressedExceptions] 中。
4548
* @throws Exception 可能产生任何异常
4649
*/
4750
public suspend fun send(text: String): MessageReceipt
@@ -50,6 +53,8 @@ public interface SendSupport {
5053
* 发送一个消息 [Message]。
5154
*
5255
* @return 消息发送成功后的回执
56+
* @throws InternalInterceptionException 在拦截事件处理过程中产生的异常,
57+
* 每一个具体的异常都会被收集在 [InternalInterceptionException.suppressedExceptions] 中。
5358
* @throws Exception 可能产生任何异常
5459
*/
5560
public suspend fun send(message: Message): MessageReceipt
@@ -60,6 +65,8 @@ public interface SendSupport {
6065
* 并在不支持的情况下降级为使用 [MessageContent.messages]。
6166
*
6267
* @return 消息发送成功后的回执
68+
* @throws InternalInterceptionException 在拦截事件处理过程中产生的异常,
69+
* 每一个具体的异常都会被收集在 [InternalInterceptionException.suppressedExceptions] 中。
6370
* @throws Exception 可能产生任何异常
6471
*/
6572
public suspend fun send(messageContent: MessageContent): MessageReceipt

simbot-api/src/commonMain/kotlin/love/forte/simbot/event/InternalEvent.kt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,23 @@ public interface InternalNotificationEvent : InternalEvent
5656
* 例如针对 [SendSupport.send][love.forte.simbot.ability.SendSupport.send]
5757
* 进行拦截,并改变其入参。
5858
*
59-
* 在拦截过程中产生的异常应当最终在内部被包装为 [InternalInterceptionException] 再抛出。
59+
* ## 异常处理
60+
*
61+
* 在拦截过程中,如果产生了异常,它们不会影响后续事件的继续调度,
62+
* 而所有产生的异常都会被收集到 [InternalInterceptionException.suppressedExceptions] 中,
63+
* 并在最终抛出并影响原函数的执行。
6064
*
6165
* @since 4.11.0
6266
*
6367
*/
6468
public interface InternalInterceptionEvent : InternalEvent
6569

6670
/**
67-
* [InternalInterceptionEvent] 中产生的异常的包装。
71+
* [InternalInterceptionEvent] 中产生的异常的收集与包装。
72+
* 更多参考 [InternalInterceptionEvent] 中有关异常的说明。
73+
*
74+
* @see InternalInterceptionEvent
75+
* @since 4.11.0
6876
*/
6977
public open class InternalInterceptionException : RuntimeException {
7078
public constructor() : super()

0 commit comments

Comments
 (0)