Add Audio.lengthDuration

This commit is contained in:
Him188 2022-03-16 15:33:56 +00:00
parent ceb192937f
commit ab9c2ef2b2
3 changed files with 13 additions and 1 deletions

View File

@ -4922,6 +4922,7 @@ public final class net/mamoe/mirai/message/data/MessageUtils {
public static final synthetic fun getInternalId (Lnet/mamoe/mirai/message/data/MessageChain;)[I
public static final fun getKind (Lnet/mamoe/mirai/message/data/MessageSource;)Lnet/mamoe/mirai/message/data/MessageSourceKind;
public static final fun getKind (Lnet/mamoe/mirai/message/data/OnlineMessageSource;)Lnet/mamoe/mirai/message/data/MessageSourceKind;
public static final synthetic fun getLengthDuration (Lnet/mamoe/mirai/message/data/OnlineAudio;)J
public static final synthetic fun getOrFail (Lnet/mamoe/mirai/message/data/MessageChain;Lnet/mamoe/mirai/message/data/MessageKey;Lkotlin/jvm/functions/Function1;)Lnet/mamoe/mirai/message/data/SingleMessage;
public static synthetic fun getOrFail$default (Lnet/mamoe/mirai/message/data/MessageChain;Lnet/mamoe/mirai/message/data/MessageKey;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lnet/mamoe/mirai/message/data/SingleMessage;
public static final synthetic fun getSource (Lnet/mamoe/mirai/message/data/MessageChain;)Lnet/mamoe/mirai/message/data/MessageSource;

View File

@ -4922,6 +4922,7 @@ public final class net/mamoe/mirai/message/data/MessageUtils {
public static final synthetic fun getInternalId (Lnet/mamoe/mirai/message/data/MessageChain;)[I
public static final fun getKind (Lnet/mamoe/mirai/message/data/MessageSource;)Lnet/mamoe/mirai/message/data/MessageSourceKind;
public static final fun getKind (Lnet/mamoe/mirai/message/data/OnlineMessageSource;)Lnet/mamoe/mirai/message/data/MessageSourceKind;
public static final synthetic fun getLengthDuration (Lnet/mamoe/mirai/message/data/OnlineAudio;)J
public static final synthetic fun getOrFail (Lnet/mamoe/mirai/message/data/MessageChain;Lnet/mamoe/mirai/message/data/MessageKey;Lkotlin/jvm/functions/Function1;)Lnet/mamoe/mirai/message/data/SingleMessage;
public static synthetic fun getOrFail$default (Lnet/mamoe/mirai/message/data/MessageChain;Lnet/mamoe/mirai/message/data/MessageKey;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lnet/mamoe/mirai/message/data/SingleMessage;
public static final synthetic fun getSource (Lnet/mamoe/mirai/message/data/MessageChain;)Lnet/mamoe/mirai/message/data/MessageSource;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2019-2021 Mamoe Technologies and contributors.
* Copyright 2019-2022 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.
@ -21,6 +21,8 @@ import net.mamoe.mirai.contact.Contact
import net.mamoe.mirai.message.MessageSerializers
import net.mamoe.mirai.message.data.MessageChain.Companion.serializeToJsonString
import net.mamoe.mirai.utils.*
import kotlin.time.Duration
import kotlin.time.Duration.Companion.seconds
/**
* 语音消息.
@ -143,6 +145,14 @@ public interface OnlineAudio : Audio { // 协议实现
}
}
/**
* 获取语音长度秒数, 作为 [Duration].
* @since 2.11
*/
@get:JvmSynthetic
public inline val OnlineAudio.lengthDuration: Duration
get() = length.seconds
/**
* 离线语音消息.
*