我现在使用的是下面的方法(直接放在onEnable中)

GlobalEventChannel.subscribeAlways<MessagePreSendEvent> { for (msg in message.toMessageChain()) { var resultType = false val result = when (msg) { is PlainText -> AipCensor.textCensor(client,msg) is Image -> AipCensor.imageCensor(client,msg) else -> JSONObject("null") } if (result.get("conclusion").equals("不合规")){ resultType = true message = PlainText(ApiConfig.BlockMessage) } if (resultType) break } }

现在的情况是message = PlainText(ApiConfig.BlockMessage)这一条执行后机器人发送的消息还是原来的message的内容,但是控制台输出的内容是修改后的内容
QQ截图20230322204932.png