From 152709a0f1be30d31007b60cd90469dd7e055d2d Mon Sep 17 00:00:00 2001 From: Hieuzest <girkirin@hotmail.com> Date: Tue, 15 Sep 2020 19:29:16 +0800 Subject: [PATCH] Fix: add host for Voice.url (#584) * Fix: add host for Voice.url * Full return url for Voice --- .../kotlin/net.mamoe.mirai/message/data/Voice.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/Voice.kt b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/Voice.kt index f564ab225..ce9538f4d 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/Voice.kt +++ b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/Voice.kt @@ -47,9 +47,11 @@ public class Voice @MiraiInternalAPI constructor( } public val url: String? - get() = - if (_url.startsWith("http")) _url - else null + get() = when { + _url.isBlank() -> null + _url.startsWith("http") -> _url + else -> "http://grouptalk.c2c.qq.com$_url" + } private var _stringValue: String? = null get() = field ?: kotlin.run {