From cf908472e2a553f24914339c377f7ed53b774f24 Mon Sep 17 00:00:00 2001 From: Him188 <Him188@mamoe.net> Date: Fri, 18 Dec 2020 20:12:06 +0800 Subject: [PATCH] Add migration helper for ServiceMessage --- .../src/commonMain/kotlin/message/data/RichMessage.kt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/mirai-core-api/src/commonMain/kotlin/message/data/RichMessage.kt b/mirai-core-api/src/commonMain/kotlin/message/data/RichMessage.kt index 9e30794ed..34c1db42f 100644 --- a/mirai-core-api/src/commonMain/kotlin/message/data/RichMessage.kt +++ b/mirai-core-api/src/commonMain/kotlin/message/data/RichMessage.kt @@ -15,6 +15,7 @@ package net.mamoe.mirai.message.data import kotlinx.serialization.Serializable import net.mamoe.mirai.utils.MiraiExperimentalApi +import net.mamoe.mirai.utils.PlannedRemoval import net.mamoe.mirai.utils.safeCast import kotlin.annotation.AnnotationTarget.* @@ -150,6 +151,15 @@ public interface ServiceMessage : RichMessage { public val serviceId: Int } +@Suppress("FunctionName") +@Deprecated( + "Use SimpleServiceMessage.", + ReplaceWith("SimpleServiceMessage(serviceId, content)", "net.mamoe.mirai.message.data.SimpleServiceMessage") +) +@PlannedRemoval("2.0-M2") +public fun ServiceMessage(serviceId: Int, content: String): SimpleServiceMessage = + SimpleServiceMessage(serviceId, content) + @MiraiExperimentalApi @Serializable public abstract class AbstractServiceMessage : ServiceMessage {